diff --git a/sdk/security/azure-resourcemanager-security/CHANGELOG.md b/sdk/security/azure-resourcemanager-security/CHANGELOG.md index 356ec381b7c0..51a429d22461 100644 --- a/sdk/security/azure-resourcemanager-security/CHANGELOG.md +++ b/sdk/security/azure-resourcemanager-security/CHANGELOG.md @@ -1,14 +1,1395 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0-beta.1 (2026-05-09) -### 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) alerts resource provider. Package api-version AlertsAPI: 2022-01-01, AlertsSuppressionRulesAPI: 2019-01-01-preview, ApiCollectionsAPI: 2023-11-15, ApplicationsAPI: 2022-07-01-preview, AssessmentAPI: 2025-05-04, ATPSettingsAPI: 2019-01-01, AutomationsAPI: 2023-12-01-preview, ComplianceResultsAPI: 2017-08-01, DefenderForStorageAPI: 2025-09-01-preview, GovernanceAPI: 2022-01-01-preview, HealthReportsAPI: 2023-05-01-preview, IoTSecurityAPI: 2019-08-01, LegacySettingsAPI: 2017-08-01-preview, LocationsAPI: 2015-06-01-preview, MdeOnboardingAPI: 2021-10-01-preview, OperationsAPI: 2025-10-01-preview, PricingsAPI: 2024-01-01, PrivateLinksAPI: 2026-01-01, RegulatoryComplianceAPI: 2019-01-01-preview, SecureScoreAPI: 2020-01-01, SecurityConnectorsAPI: 2024-08-01-preview, SecurityConnectorsDevOpsAPI: 2025-11-01-preview, SecurityOperatorsAPI: 2023-01-01-preview, SecuritySolutionsAPI: 2020-01-01, SecurityStandardsAPI: 2024-08-01, SensitivitySettingsAPI: 2023-02-15-preview, ServerVulnerabilityAssessmentsSettingsAPI: 2023-05-01, SettingsAPI: 2022-05-01, SqlVulnerabilityAssessmentsAPI: 2026-04-01-preview, StandardsAPI: 2021-08-01-preview, SubAssessmentsAPI: 2019-01-01-preview, TasksAPI: 2015-06-01-preview. 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 +#### `models.ComplianceResultList` was removed -### Other Changes +#### `models.StandardAssignmentsList` was removed + +#### `models.AadConnectivityStateAutoGenerated` was removed + +#### `models.DirectMethodInvokesNotInAllowedRange` was removed + +#### `models.Code` was removed + +#### `models.SettingsList` was removed + +#### `models.AllowedConnectionsList` was removed + +#### `models.ConnectionToIpNotAllowed` was removed + +#### `models.Location` was removed + +#### `models.FailedLocalLoginsNotInAllowedRange` was removed + +#### `models.FileUploadsNotInAllowedRange` was removed + +#### `models.MqttC2DMessagesNotInAllowedRange` was removed + +#### `models.IoTSecuritySolutionsList` was removed + +#### `models.TopologyList` was removed + +#### `models.AlertList` was removed + +#### `models.ConnectionFromIpNotAllowed` was removed + +#### `models.AmqpC2DRejectedMessagesNotInAllowedRange` was removed + +#### `models.LocalUserNotAllowed` was removed + +#### `models.SecurityStandardList` was removed + +#### `models.IoTSecurityAggregatedRecommendationList` was removed + +#### `models.MqttC2DRejectedMessagesNotInAllowedRange` was removed + +#### `models.CustomRecommendationsList` was removed + +#### `models.ApiCollectionList` was removed + +#### `models.SecureScoresList` was removed + +#### `models.TwinUpdatesNotInAllowedRange` was removed + +#### `models.ServerVulnerabilityAssessmentsSettingsList` was removed + +#### `models.KindAutoGenerated` was removed + +#### `models.AmqpC2DMessagesNotInAllowedRange` was removed + +#### `models.HttpC2DRejectedMessagesNotInAllowedRange` was removed + +#### `models.AmqpD2CMessagesNotInAllowedRange` was removed + +#### `models.DiscoveredSecuritySolutionList` was removed + +#### `models.MqttD2CMessagesNotInAllowedRange` was removed + +#### `models.ActiveConnectionsNotInAllowedRange` was removed + +#### `models.QueuePurgesNotInAllowedRange` was removed + +#### `models.ExternalSecuritySolutionList` was removed + +#### `models.IoTSecurityAggregatedAlertList` was removed + +#### `models.SecureScoreControlDefinitionList` was removed + +#### `models.HttpC2DMessagesNotInAllowedRange` was removed + +#### `models.SecuritySolutionList` was removed + +#### `models.HttpD2CMessagesNotInAllowedRange` was removed + +#### `models.UnauthorizedOperationsNotInAllowedRange` was removed + +#### `models.JitNetworkAccessPoliciesList` was removed + +#### `models.SecurityAssessmentList` was removed + +#### `models.DeviceSecurityGroupList` was removed + +#### `models.SecureScoreControlList` was removed + +#### `models.SecurityAssessmentMetadataResponseList` was removed + +#### `models.ProcessNotAllowed` was removed + +#### `models.AzureResourceIdentifier` was modified + +* `AzureResourceIdentifier()` was changed to private access + +#### `models.IoTSecurityDeviceRecommendation` was modified + +* `IoTSecurityDeviceRecommendation()` was changed to private access + +#### `models.SecurityAssessmentResponse` was modified + +* `fluent.models.SecurityAssessmentMetadataProperties metadata()` -> `models.SecurityAssessmentMetadataProperties metadata()` + +#### `models.SecurityAssessmentResponse$Definition` was modified + +* `withMetadata(fluent.models.SecurityAssessmentMetadataProperties)` was removed + +#### `models.ConnectableResource` was modified + +* `ConnectableResource()` was changed to private access + +#### `models.LogAnalyticsIdentifier` was modified + +* `LogAnalyticsIdentifier()` was changed to private access + +#### `models.AssessmentLinks` was modified + +* `AssessmentLinks()` was changed to private access + +#### `models.IoTSecurityDeviceAlert` was modified + +* `IoTSecurityDeviceAlert()` was changed to private access + +#### `models.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem` was modified + +* `IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem()` was changed to private access +* `withDate(java.time.OffsetDateTime)` was removed +* `withDevicesMetrics(models.IoTSeverityMetrics)` was removed + +#### `models.TopologySingleResource` was modified + +* `TopologySingleResource()` was changed to private access + +#### `models.AlertEntity` was modified + +* `AlertEntity()` was changed to private access +* `withAdditionalProperties(java.util.Map)` was removed + +#### `models.SecuritySolutionsReferenceData` was modified + +* `SecuritySolutionsReferenceData()` was changed to private access +* `withProductName(java.lang.String)` was removed +* `withPackageInfoUrl(java.lang.String)` was removed +* `withAlertVendorName(java.lang.String)` was removed +* `withPublisherDisplayName(java.lang.String)` was removed +* `withPublisher(java.lang.String)` was removed +* `withSecurityFamily(models.SecurityFamily)` was removed +* `withTemplate(java.lang.String)` was removed + +#### `models.SecurityAssessmentResponse$Update` was modified + +* `withMetadata(fluent.models.SecurityAssessmentMetadataProperties)` was removed + +#### `models.TopologySingleResourceChild` was modified + +* `TopologySingleResourceChild()` was changed to private access + +#### `models.CefSolutionProperties` was modified + +* `CefSolutionProperties()` was changed to private access +* `withLastEventReceived(java.lang.String)` was removed +* `withWorkspace(models.ConnectedWorkspace)` was removed +* `withDeviceType(java.lang.String)` was removed +* `withDeviceVendor(java.lang.String)` was removed +* `withHostname(java.lang.String)` was removed +* `withAgent(java.lang.String)` was removed + +#### `models.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem` was modified + +* `IoTSecurityAggregatedAlertPropertiesTopDevicesListItem()` was changed to private access + +#### `models.ExternalSecuritySolutionProperties` was modified + +* `models.ExternalSecuritySolutionProperties withAdditionalProperties(java.util.Map)` -> `models.ExternalSecuritySolutionProperties withAdditionalProperties(java.util.Map)` +* `models.ExternalSecuritySolutionProperties withDeviceType(java.lang.String)` -> `models.ExternalSecuritySolutionProperties withDeviceType(java.lang.String)` +* `models.ExternalSecuritySolutionProperties withWorkspace(models.ConnectedWorkspace)` -> `models.ExternalSecuritySolutionProperties withWorkspace(models.ConnectedWorkspace)` +* `models.ExternalSecuritySolutionProperties withDeviceVendor(java.lang.String)` -> `models.ExternalSecuritySolutionProperties withDeviceVendor(java.lang.String)` + +#### `models.AtaSolutionProperties` was modified + +* `AtaSolutionProperties()` was changed to private access +* `withDeviceType(java.lang.String)` was removed +* `withDeviceVendor(java.lang.String)` was removed +* `withWorkspace(models.ConnectedWorkspace)` was removed +* `withLastEventReceived(java.lang.String)` was removed + +#### `models.SecurityAssessmentPropertiesBase` was modified + +* `fluent.models.SecurityAssessmentMetadataProperties metadata()` -> `models.SecurityAssessmentMetadataProperties metadata()` +* `withMetadata(fluent.models.SecurityAssessmentMetadataProperties)` was removed + +#### `models.AtaExternalSecuritySolution` was modified + +* `AtaExternalSecuritySolution()` was changed to private access +* `withProperties(models.AtaSolutionProperties)` was removed + +#### `models.TopologySingleResourceParent` was modified + +* `TopologySingleResourceParent()` was changed to private access + +#### `models.CefExternalSecuritySolution` was modified + +* `CefExternalSecuritySolution()` was changed to private access +* `withProperties(models.CefSolutionProperties)` was removed + +#### `models.AssessmentStatusResponse` was modified + +* `AssessmentStatusResponse()` was changed to private access +* `withDescription(java.lang.String)` was removed +* `withCause(java.lang.String)` was removed +* `withCode(models.AssessmentStatusCode)` was removed + +#### `models.IoTSeverityMetrics` was modified + +* `IoTSeverityMetrics()` was changed to private access +* `withHigh(java.lang.Long)` was removed +* `withLow(java.lang.Long)` was removed +* `withMedium(java.lang.Long)` was removed + +#### `models.ConnectedResource` was modified + +* `ConnectedResource()` was changed to private access + +#### `models.SecurityAssessment` was modified + +* `withMetadata(fluent.models.SecurityAssessmentMetadataProperties)` was removed +* `fluent.models.SecurityAssessmentMetadataProperties metadata()` -> `models.SecurityAssessmentMetadataProperties metadata()` + +#### `models.ConnectedWorkspace` was modified + +* `ConnectedWorkspace()` was changed to private access +* `withId(java.lang.String)` was removed + +#### `models.Protocol` was modified + +* `ASTERISK` was removed + +#### `models.AadExternalSecuritySolution` was modified + +* `AadExternalSecuritySolution()` was changed to private access +* `withProperties(models.AadSolutionProperties)` was removed + +#### `models.SecureScoreControlDefinitionSource` was modified + +* `SecureScoreControlDefinitionSource()` was changed to private access +* `withSourceType(models.ControlType)` was removed + +#### `models.AlertPropertiesSupportingEvidence` was modified + +* `AlertPropertiesSupportingEvidence()` was changed to private access +* `withAdditionalProperties(java.util.Map)` was removed + +#### `models.IoTSecurityAlertedDevice` was modified + +* `IoTSecurityAlertedDevice()` was changed to private access + +#### `models.AadSolutionProperties` was modified + +* `AadSolutionProperties()` was changed to private access +* `withDeviceType(java.lang.String)` was removed +* `withConnectivityState(models.AadConnectivityState)` was removed +* `withWorkspace(models.ConnectedWorkspace)` was removed +* `withDeviceVendor(java.lang.String)` was removed + +#### `models.AzureResourceLink` was modified + +* `AzureResourceLink()` was changed to private access + +#### `models.OperationStatus` was modified + +* `OperationStatus()` was changed to private access +* `withCode(models.Code)` was removed +* `models.Code code()` -> `java.lang.String code()` +* `withMessage(java.lang.String)` was removed + +### Features Added + +* `models.AdditionalData` was added + +* `models.GovernanceAssignment$Definition` was added + +* `models.AgentlessEnablement` was added + +* `models.RegulatoryComplianceAssessments` was added + +* `models.DefenderForContainersGcpOfferingVmScanners` was added + +* `models.OnboardingState` was added + +* `models.NotificationsSourceAlert` was added + +* `models.GcpOrganizationalDataOrganization` was added + +* `models.SecurityConnector` was added + +* `models.AlertsSuppressionRule` was added + +* `models.SqlVulnerabilityAssessmentScanOperationResultProperties` was added + +* `models.SecurityConnector$Update` was added + +* `models.OperationResultsGetResponse` was added + +* `models.SensitivityLabel` was added + +* `models.Automation` was added + +* `models.RegulatoryComplianceControl` was added + +* `models.AutomationTriggeringRule` was added + +* `models.OperationResultStatus` was added + +* `models.RuleResultsProperties` was added + +* `models.ExecuteGovernanceRuleParams` was added + +* `models.DevOpsProvisioningState` was added + +* `models.ArcAutoProvisioning` was added + +* `models.AzureDevOpsRepository$UpdateStages` was added + +* `models.SecurityConnectors` was added + +* `models.Baseline` was added + +* `models.RulesResults` was added + +* `models.AzureDevOpsProject$UpdateStages` was added + +* `models.DefenderForStorageSetting$Definition` was added + +* `models.Compliance` was added + +* `models.AzureDevOpsRepository$Definition` was added + +* `models.DefenderForServersGcpOffering` was added + +* `models.SecurityConnector$UpdateStages` was added + +* `models.GcpProjectEnvironmentData` was added + +* `models.AutoProvisioningSetting$Definition` was added + +* `models.DefenderForContainersAwsOfferingMdcContainersImageAssessment` was added + +* `models.DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S` was added + +* `models.RiskLevel` was added + +* `models.ResourceIdentityType` was added + +* `models.ActionableRemediationState` was added + +* `models.AwsOrganizationalDataMaster` was added + +* `models.GcpOrganizationalDataMember` was added + +* `models.GitHubRepositoryProperties` was added + +* `models.ServerVulnerabilityAssessmentsSettingProperties` was added + +* `models.WorkspaceSetting$UpdateStages` was added + +* `models.Assignments` was added + +* `models.DefenderForServersAwsOfferingSubPlan` was added + +* `models.GovernanceRulesOperationResultsHeaders` was added + +* `models.SubAssessments` was added + +* `models.ScanSummary` was added + +* `models.AssignmentPropertiesAdditionalData` was added + +* `models.SensitivitySettings` was added + +* `models.DefenderFoDatabasesAwsOfferingDatabasesDspm` was added + +* `models.GovernanceAssignments` was added + +* `models.DockerHubEnvironmentData` was added + +* `models.CspmMonitorDockerHubOffering` was added + +* `models.Assignment$DefinitionStages` was added + +* `models.InformationProtectionPolicy$UpdateStages` was added + +* `models.Automations` was added + +* `models.GovernanceRuleSourceResourceType` was added + +* `models.FilesScanSummary` was added + +* `models.PrivateEndpointServiceConnectionStatus` was added + +* `models.DefenderForServersGcpOfferingMdeAutoProvisioning` was added + +* `models.RuleState` was added + +* `models.SecurityContactRole` was added + +* `models.Operation` was added + +* `models.Automation$DefinitionStages` was added + +* `models.AzureDevOpsProject$Update` was added + +* `models.SqlVulnerabilityAssessmentSettingsOperations` was added + +* `models.GitlabScopeEnvironmentData` was added + +* `models.DefenderCspmGcpOfferingMdcContainersImageAssessment` was added + +* `models.PrivateLinkResource$UpdateStages` was added + +* `models.OperationStatuses` was added + +* `models.SubAssessmentStatus` was added + +* `models.ArcAutoProvisioningAws` was added + +* `models.AwsOrganizationalDataMember` was added + +* `models.AzureDevOpsProjects` was added + +* `models.DevOpsConfigurationProperties` was added + +* `models.AzureDevOpsOrgProperties` was added + +* `models.ScanningMode` was added + +* `models.ArcAutoProvisioningConfiguration` was added + +* `models.AzureDevOpsScopeEnvironmentData` was added + +* `models.GitLabProject` was added + +* `models.BenchmarkReference` was added + +* `models.IssueCreationRequest` was added + +* `models.DefenderFoDatabasesAwsOfferingRds` was added + +* `models.ScanTriggerType` was added + +* `models.NotificationsSourceAttackPath` was added + +* `models.VmScannersGcp` was added + +* `models.AutomationValidationStatus` was added + +* `models.Cve` was added + +* `models.OperationDisplay` was added + +* `models.ActionType` was added + +* `models.GovernanceRule$Update` was added + +* `models.OperationResult` was added + +* `models.PrivateEndpointConnection$Update` was added + +* `models.GovernanceAssignment$Update` was added + +* `models.Type` was added + +* `models.SecurityConnectorApplications` was added + +* `models.GitLabProjects` was added + +* `models.Standard$DefinitionStages` was added + +* `models.RuleResults$UpdateStages` was added + +* `models.TaskUpdateActionType` was added + +* `models.InventoryListKind` was added + +* `models.GitHubOwnerProperties` was added + +* `models.Automation$Definition` was added + +* `models.Label` was added + +* `models.PrivateLinks` was added + +* `models.MdeOnboardingData` was added + +* `models.DefenderForStorageSetting$DefinitionStages` was added + +* `models.VaRule` was added + +* `models.AssignedComponentItem` was added + +* `models.MalwareScanProperties` was added + +* `models.DefenderCspmGcpOfferingVmScanners` was added + +* `models.Application$UpdateStages` was added + +* `models.GovernanceRuleType` was added + +* `models.AutomationActionWorkspace` was added + +* `models.StatusName` was added + +* `models.OnUploadProperties` was added + +* `models.BlobScanResultsOptions` was added + +* `models.CspmMonitorJFrogOffering` was added + +* `models.InformationType` was added + +* `models.InventoryKind` was added + +* `models.AzureDevOpsRepository$DefinitionStages` was added + +* `models.AutoProvision` was added + +* `models.PrivateLinkUpdate` was added + +* `models.PropertyType` was added + +* `models.Authentication` was added + +* `models.PrivateLinkResource$Update` was added + +* `models.SecurityAssessmentPropertiesBaseRiskPathsItemEdge` was added + +* `models.AgentlessConfiguration` was added + +* `models.CspmMonitorAzureDevOpsOffering` was added + +* `models.SecurityOperators` was added + +* `models.ScanResultProperties` was added + +* `models.AzureDevOpsOrgListResponse` was added + +* `models.HealthReport` was added + +* `models.AnnotateDefaultBranchState` was added + +* `models.HealthReportResourceDetails` was added + +* `models.ActionableRemediation` was added + +* `models.WorkspaceSetting$DefinitionStages` was added + +* `models.PrivateEndpoint` was added + +* `models.MdeOnboardings` was added + +* `models.RuleSeverity` was added + +* `models.AutoProvisioningSettings` was added + +* `models.OperationStatusResult` was added + +* `models.AutoProvisioningSetting$DefinitionStages` was added + +* `models.EnvironmentData` was added + +* `models.DefenderForServersAwsOffering` was added + +* `models.DefenderForServersAwsOfferingVaAutoProvisioning` was added + +* `models.MalwareScan` was added + +* `models.CspmMonitorGithubOffering` was added + +* `models.GitLabSubgroups` was added + +* `models.DefenderCspmJFrogOfferingMdcContainersImageAssessment` was added + +* `models.GetSensitivitySettingsListResponse` was added + +* `models.AzureDevOpsRepository$Update` was added + +* `models.PrivateLinkResource$DefinitionStages` was added + +* `models.CspmMonitorAwsOfferingNativeCloudConnection` was added + +* `models.PrivateEndpointConnection` was added + +* `models.AzureDevOpsRepos` was added + +* `models.Standard$UpdateStages` was added + +* `models.GitLabGroup` was added + +* `models.GovernanceRule$UpdateStages` was added + +* `models.ContainerRegistryVulnerabilityProperties` was added + +* `models.Tags` was added + +* `models.Locations` was added + +* `models.PublicNetworkAccess` was added + +* `models.AutomationSource` was added + +* `models.Rank` was added + +* `models.EnvironmentType` was added + +* `models.GovernanceAssignment` was added + +* `models.AutomationAction` was added + +* `models.OperationResultsGetHeaders` was added + +* `models.GitHubRepository` was added + +* `models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning` was added + +* `models.RuleResults$Update` was added + +* `models.HealthReports` was added + +* `models.SecurityContacts` was added + +* `models.AutomationScope` was added + +* `models.Issue` was added + +* `models.GovernanceRule$Definition` was added + +* `models.VmScannersBaseConfiguration` was added + +* `models.InformationProtectionPolicy` was added + +* `models.SecurityAssessmentPropertiesBaseRiskPathsPropertiesItemsItem` was added + +* `models.Assignment` was added + +* `models.OfferingType` was added + +* `models.SettingProperties` was added + +* `models.AutomationActionEventHub` was added + +* `models.OnUploadFilters` was added + +* `models.SecurityContactName` was added + +* `models.StandardSupportedClouds` was added + +* `models.DefenderForServersGcpOfferingArcAutoProvisioning` was added + +* `models.DefenderCspmAwsOfferingDatabasesDspm` was added + +* `models.Applications` was added + +* `models.InformationProtectionPolicy$Update` was added + +* `models.DefenderForServersGcpOfferingSubPlan` was added + +* `models.VendorReference` was added + +* `models.DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S` was added + +* `models.GitHubOwners` was added + +* `models.SqlVulnerabilityAssessmentState` was added + +* `models.SourceType` was added + +* `models.DevOpsOperationResults` was added + +* `models.ScanState` was added + +* `models.DefenderForServersGcpOfferingVmScanners` was added + +* `models.GovernanceAssignment$UpdateStages` was added + +* `models.DefenderForStorageSettingProperties` was added + +* `models.InformationProtectionPolicy$DefinitionStages` was added + +* `models.SqlServerVulnerabilityProperties` was added + +* `models.RegulatoryComplianceStandards` was added + +* `models.AuthenticationType` was added + +* `models.AlertsSuppressionRules` was added + +* `models.Automation$UpdateStages` was added + +* `models.AwsOrganizationalData` was added + +* `models.Standard$Definition` was added + +* `models.SqlVulnerabilityAssessmentSettings` was added + +* `models.PrivateEndpointConnectionProvisioningState` was added + +* `models.AwsEnvironmentData` was added + +* `models.MalwareScanningProperties` was added + +* `models.GetSensitivitySettingsResponseProperties` was added + +* `models.GitLabGroupProperties` was added + +* `models.StandardComponentProperties` was added + +* `models.SqlVulnerabilityAssessmentSettingsProperties` was added + +* `models.PrivateLinkResource` was added + +* `models.DefenderForStorages` was added + +* `models.SecurityContactPropertiesNotificationsByRole` was added + +* `models.GitHubOwner` was added + +* `models.DefenderForContainersJFrogOffering` was added + +* `models.MipIntegrationStatus` was added + +* `models.AzureDevOpsProject` was added + +* `models.SecurityContact$DefinitionStages` was added + +* `models.AzureDevOpsOrg$Definition` was added + +* `models.QueryCheck` was added + +* `models.GovernanceRule` was added + +* `models.DefenderForDatabasesGcpOfferingArcAutoProvisioning` was added + +* `models.DefenderForServersGcpOfferingVaAutoProvisioning` was added + +* `models.DefenderForContainersGcpOfferingMdcContainersImageAssessment` was added + +* `models.AutomationRuleSet` was added + +* `models.RegulatoryComplianceAssessment` was added + +* `models.GcpOrganizationalData` was added + +* `models.MinimalSeverity` was added + +* `models.SqlVulnerabilityAssessmentBaselineRules` was added + +* `models.AzureDevOpsProject$Definition` was added + +* `models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning` was added + +* `models.Application$Definition` was added + +* `models.RuleResults$Definition` was added + +* `models.WorkspaceSetting$Definition` was added + +* `models.WorkspaceSetting` was added + +* `models.GitLabGroupListResponse` was added + +* `models.AutomationUpdateModel` was added + +* `models.RuleResultsInput` was added + +* `models.PrivateLinkGroupResource` was added + +* `models.CloudOffering` was added + +* `models.PrivateEndpointConnection$UpdateStages` was added + +* `models.DefenderCspmAwsOfferingVmScanners` was added + +* `models.VmScannersBase` was added + +* `models.InformationProtectionPolicies` was added + +* `models.SubPlan` was added + +* `models.PrivateEndpointConnection$Definition` was added + +* `models.ComplianceSegment` was added + +* `models.DefenderCspmAwsOfferingCiemOidc` was added + +* `models.SensitiveDataDiscoveryProperties` was added + +* `models.UpdateSensitivitySettingsRequest` was added + +* `models.Cvss` was added + +* `models.SecurityConnector$Definition` was added + +* `models.JFrogEnvironmentData` was added + +* `models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection` was added + +* `models.DevOpsConfigurations` was added + +* `models.AssessedResourceType` was added + +* `models.DefenderCspmAwsOfferingCiem` was added + +* `models.DefenderForContainersGcpOfferingNativeCloudConnection` was added + +* `models.BaselineAdjustedResult` was added + +* `models.AzureDevOpsOrg$UpdateStages` was added + +* `models.Tasks` was added + +* `models.Application$Update` was added + +* `models.PrivateLinkResources` was added + +* `models.CspmMonitorGcpOfferingNativeCloudConnection` was added + +* `models.PrivateLinkResource$Definition` was added + +* `models.DefenderForContainersAwsOfferingCloudWatchToKinesis` was added + +* `models.GithubScopeEnvironmentData` was added + +* `models.DefenderForServersAwsOfferingVmScanners` was added + +* `models.AzureDevOpsOrg` was added + +* `models.DefenderCspmGcpOfferingDataSensitivityDiscovery` was added + +* `models.OperationResults` was added + +* `models.Assignment$UpdateStages` was added + +* `models.WorkspaceSettings` was added + +* `models.RulesResultsInput` was added + +* `models.AzureDevOpsRepositoryProperties` was added + +* `models.Authorization` was added + +* `models.DefenderFoDatabasesAwsOffering` was added + +* `models.AutomationActionLogicApp` was added + +* `models.PrivateEndpointConnections` was added + +* `models.Standard` was added + +* `models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration` was added + +* `models.RuleResults$DefinitionStages` was added + +* `models.GovernanceRuleOwnerSource` was added + +* `models.CspmMonitorGcpOffering` was added + +* `models.DefenderForContainersAwsOfferingKubernetesService` was added + +* `models.ArcAutoProvisioningGcp` was added + +* `models.SuppressionAlertsScope` was added + +* `models.GovernanceAssignmentAdditionalData` was added + +* `models.AzureDevOpsRepository` was added + +* `models.RuleResults` was added + +* `models.GitHubRepos` was added + +* `models.VmScannersAws` was added + +* `models.SecurityAssessmentPropertiesBaseRiskPathsItem` was added + +* `models.CategoryConfiguration` was added + +* `models.DefenderCspmAwsOfferingCiemDiscovery` was added + +* `models.Identity` was added + +* `models.CspmMonitorAwsOffering` was added + +* `models.SqlVulnerabilityAssessmentScanOperationResult` was added + +* `models.Assignment$Definition` was added + +* `models.GovernanceRuleMetadata` was added + +* `models.PrivateEndpointConnection$DefinitionStages` was added + +* `models.SecurityConnector$DefinitionStages` was added + +* `models.CloudName` was added + +* `models.InventoryList` was added + +* `models.Origin` was added + +* `models.RegulatoryComplianceControls` was added + +* `models.ScanResult` was added + +* `models.DefenderForDatabasesGcpOffering` was added + +* `models.RuleCategory` was added + +* `models.RegulatoryComplianceStandard` was added + +* `models.Remediation` was added + +* `models.ArmActionType` was added + +* `models.HealthReportStatus` was added + +* `models.BuiltInInfoType` was added + +* `models.GovernanceAssignment$DefinitionStages` was added + +* `models.ScanV2` was added + +* `models.Automation$Update` was added + +* `models.GitLabProjectProperties` was added + +* `models.Application$DefinitionStages` was added + +* `models.DefenderForContainersAwsOfferingKubernetesDataCollection` was added + +* `models.SecurityAssessmentMetadataProperties` was added + +* `models.DefenderForStorageSetting` was added + +* `models.PrivateLinkServiceConnectionState` was added + +* `models.SecurityTaskParameters` was added + +* `models.OrganizationMembershipType` was added + +* `models.SecurityContact$Definition` was added + +* `models.RuleType` was added + +* `models.GitLabGroups` was added + +* `models.DefenderCspmGcpOfferingCiemDiscovery` was added + +* `models.GovernanceRule$DefinitionStages` was added + +* `models.DefenderForContainersAwsOffering` was added + +* `models.ScanPropertiesV2` was added + +* `models.Application` was added + +* `models.SqlVulnerabilityAssessmentScanResults` was added + +* `models.GovernanceRuleOwnerSourceType` was added + +* `models.DefenderForServersGcpOfferingDefenderForServers` was added + +* `models.RemediationEta` was added + +* `models.InfoType` was added + +* `models.SecurityOperator` was added + +* `models.Operations` was added + +* `models.WorkspaceSetting$Update` was added + +* `models.DefenderCspmAwsOfferingDataSensitivityDiscovery` was added + +* `models.InformationProtectionKeyword` was added + +* `models.EventSource` was added + +* `models.InformationProtectionPolicyName` was added + +* `models.DevOpsCapability` was added + +* `models.Compliances` was added + +* `models.AutoDiscovery` was added + +* `models.SubAssessmentStatusCode` was added + +* `models.AccessTokenAuthentication` was added + +* `models.GcpProjectDetails` was added + +* `models.ScopeElement` was added + +* `models.GitHubOwnerListResponse` was added + +* `models.Standards` was added + +* `models.DefenderForServersAwsOfferingDefenderForServers` was added + +* `models.DefenderForContainersAwsOfferingKinesisToS3` was added + +* `models.RuleStatus` was added + +* `models.InheritFromParentState` was added + +* `models.GetSensitivitySettingsResponse` was added + +* `models.MinimalRiskLevel` was added + +* `models.AzureDevOpsOrg$Update` was added + +* `models.SecurityTask` was added + +* `models.ApplicationSourceResourceType` was added + +* `models.AutoProvisioningSetting` was added + +* `models.GetSensitivitySettingsResponsePropertiesMipInformation` was added + +* `models.TargetBranchConfiguration` was added + +* `models.AutomatedResponseType` was added + +* `models.DefenderForContainersGcpOffering` was added + +* `models.Operator` was added + +* `models.AzureDevOpsProjectProperties` was added + +* `models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S` was added + +* `models.DefenderCspmAwsOffering` was added + +* `models.InformationProtectionPolicy$Definition` was added + +* `models.SecurityAssessmentPropertiesBaseRisk` was added + +* `models.DefenderForServersAwsOfferingMdeAutoProvisioning` was added + +* `models.HealthDataClassification` was added + +* `models.DefenderCspmAwsOfferingMdcContainersImageAssessment` was added + +* `models.GovernanceRules` was added + +* `models.MdeOnboardingDataList` was added + +* `models.DefenderCspmDockerHubOffering` was added + +* `models.AzureDevOpsOrg$DefinitionStages` was added + +* `models.Standard$Update` was added + +* `models.SqlVulnerabilityAssessmentScans` was added + +* `models.ServerVulnerabilityProperties` was added + +* `models.GovernanceEmailNotification` was added + +* `models.DevOpsConfiguration` was added + +* `models.CspmMonitorGitLabOffering` was added + +* `models.GovernanceRuleEmailNotification` was added + +* `models.DefenderForContainersDockerHubOffering` was added + +* `models.DefenderCspmGcpOffering` was added + +* `models.GitHubIssues` was added + +* `models.SecuritySubAssessment` was added + +* `models.BlobsScanSummary` was added + +* `models.DefenderForServersAwsOfferingArcAutoProvisioning` was added + +* `models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration` was added + +* `models.AzureDevOpsProject$DefinitionStages` was added + +* `models.GovernanceRulesOperationResultsResponse` was added + +* `models.AzureDevOpsOrgs` was added + +* `models.DefenderForContainersAwsOfferingVmScanners` was added + +* `models.SecurityContact` was added + +* `models.ScanOperationStatus` was added + +* `models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S` was added + +* `models.NotificationsSource` was added + +* `models.Assignment$Update` was added + +* `models.EnvironmentDetails` was added + +* `models.DefenderCspmJFrogOffering` was added + +* `models.State` was added + +* `models.AscLocation` was added + +#### `models.Categories` was modified + +* `CONTAINER` was added +* `APP_SERVICES` was added + +#### `models.SecureScoreItem` was modified + +* `systemData()` was added + +#### `models.Source` was modified + +* `GCP` was added +* `ON_PREMISE_RESOURCE_DETAILS` was added +* `AWS` was added + +#### `models.SecurityAssessmentResponse` was modified + +* `risk()` was added +* `systemData()` was added + +#### `models.SecurityAssessmentResponse$Definition` was modified + +* `withMetadata(models.SecurityAssessmentMetadataProperties)` was added +* `withRisk(models.SecurityAssessmentPropertiesBaseRisk)` was added + +#### `models.DeviceSecurityGroup` was modified + +* `systemData()` was added + +#### `models.SecureScoreControlDefinitionItem` was modified + +* `systemData()` was added + +#### `models.IoTSecuritySolutionAnalyticsModel` was modified + +* `systemData()` was added + +#### `models.DiscoveredSecuritySolution` was modified + +* `systemData()` was added + +#### `models.Pricing` was modified + +* `systemData()` was added + +#### `models.StandardAssignment` was modified + +* `systemData()` was added + +#### `models.ExternalSecuritySolution` was modified + +* `properties()` was added +* `systemData()` was added + +#### `models.AssessmentType` was modified + +* `BUILT_IN_POLICY` was added +* `MANUAL_CUSTOM_POLICY` was added +* `MANUAL_BUILT_IN_POLICY` was added +* `CUSTOM` was added +* `UNKNOWN` was added +* `DYNAMIC_BUILT_IN` was added +* `MANUAL_BUILT_IN` was added + +#### `models.SecuritySolutionsReferenceData` was modified + +* `systemData()` was added + +#### `models.AllowedConnectionsResource` was modified + +* `systemData()` was added + +#### `models.SecurityAssessmentResponse$Update` was modified + +* `withMetadata(models.SecurityAssessmentMetadataProperties)` was added +* `withRisk(models.SecurityAssessmentPropertiesBaseRisk)` was added + +#### `models.Alert` was modified + +* `systemData()` was added + +#### `models.CefSolutionProperties` was modified + +* `deviceVendor()` was added +* `additionalProperties()` was added +* `workspace()` was added +* `deviceType()` was added + +#### `models.SettingName` was modified + +* `CURRENT` was added + +#### `models.ComplianceResult` was modified + +* `systemData()` was added + +#### `models.AdvancedThreatProtectionSetting` was modified + +* `systemData()` was added + +#### `models.AtaSolutionProperties` was modified + +* `workspace()` was added +* `deviceVendor()` was added +* `deviceType()` was added +* `additionalProperties()` was added + +#### `models.SecurityAssessmentPropertiesBase` was modified + +* `withMetadata(models.SecurityAssessmentMetadataProperties)` was added +* `withRisk(models.SecurityAssessmentPropertiesBaseRisk)` was added +* `risk()` was added + +#### `models.AzureServersSetting` was modified + +* `withProperties(models.ServerVulnerabilityAssessmentsSettingProperties)` was added + +#### `models.SecurityStandard` was modified + +* `systemData()` was added + +#### `models.AtaExternalSecuritySolution` was modified + +* `systemData()` was added +* `properties()` was added + +#### `models.AlertSyncSettings` was modified + +* `withProperties(models.SettingProperties)` was added +* `systemData()` was added + +#### `models.IoTSecurityAggregatedAlert` was modified + +* `systemData()` was added + +#### `models.SecureScoreControlDetails` was modified + +* `systemData()` was added + +#### `models.CefExternalSecuritySolution` was modified + +* `properties()` was added +* `systemData()` was added + +#### `SecurityManager` was modified + +* `azureDevOpsOrgs()` was added +* `gitHubRepos()` was added +* `subAssessments()` was added +* `regulatoryComplianceStandards()` was added +* `operations()` was added +* `assignments()` was added +* `privateEndpointConnections()` was added +* `devOpsOperationResults()` was added +* `gitLabSubgroups()` was added +* `locations()` was added +* `alertsSuppressionRules()` was added +* `azureDevOpsRepos()` was added +* `gitLabProjects()` was added +* `compliances()` was added +* `tasks()` was added +* `operationStatuses()` was added +* `securityContacts()` was added +* `gitLabGroups()` was added +* `regulatoryComplianceAssessments()` was added +* `privateLinks()` was added +* `regulatoryComplianceControls()` was added +* `automations()` was added +* `sqlVulnerabilityAssessmentBaselineRules()` was added +* `operationResults()` was added +* `gitHubOwners()` was added +* `workspaceSettings()` was added +* `governanceAssignments()` was added +* `healthReports()` was added +* `informationProtectionPolicies()` was added +* `mdeOnboardings()` was added +* `sqlVulnerabilityAssessmentScans()` was added +* `applications()` was added +* `gitHubIssues()` was added +* `standards()` was added +* `defenderForStorages()` was added +* `sqlVulnerabilityAssessmentSettingsOperations()` was added +* `sensitivitySettings()` was added +* `autoProvisioningSettings()` was added +* `governanceRules()` was added +* `devOpsConfigurations()` was added +* `securityOperators()` was added +* `securityConnectorApplications()` was added +* `azureDevOpsProjects()` was added +* `privateLinkResources()` was added +* `securityConnectors()` was added +* `sqlVulnerabilityAssessmentScanResults()` was added + +#### `models.SecurityAssessmentMetadataResponse` was modified + +* `systemData()` was added + +#### `models.SecurityAssessment` was modified + +* `systemData()` was added +* `withMetadata(models.SecurityAssessmentMetadataProperties)` was added +* `risk()` was added +* `withRisk(models.SecurityAssessmentPropertiesBaseRisk)` was added + +#### `models.Protocol` was modified + +* `ALL` was added + +#### `models.DataExportSettings` was modified + +* `systemData()` was added +* `withProperties(models.SettingProperties)` was added + +#### `models.SecuritySolution` was modified + +* `systemData()` was added + +#### `models.JitNetworkAccessPolicy` was modified + +* `systemData()` was added + +#### `models.AadExternalSecuritySolution` was modified + +* `systemData()` was added +* `properties()` was added + +#### `models.ServerVulnerabilityAssessmentsSetting` was modified + +* `properties()` was added + +#### `models.IoTSecurityAggregatedRecommendation` was modified + +* `systemData()` was added + +#### `models.TopologyResource` was modified + +* `systemData()` was added + +#### `models.Severity` was modified + +* `CRITICAL` was added + +#### `models.ApiCollection` was modified + +* `systemData()` was added + +#### `models.Setting` was modified + +* `properties()` was added +* `systemData()` was added + +#### `models.ServerVulnerabilityAssessment` was modified + +* `systemData()` was added + +#### `models.AadSolutionProperties` was modified + +* `deviceVendor()` was added +* `deviceType()` was added +* `workspace()` was added +* `additionalProperties()` was added + +#### `models.ProvisioningState` was modified + +* `IN_PROGRESS` was added +* `CANCELED` was added +* `DELETING` was added +* `CREATING` was added ## 1.0.0 (2024-12-26) diff --git a/sdk/security/azure-resourcemanager-security/README.md b/sdk/security/azure-resourcemanager-security/README.md index 071b03b0d824..985a69702a32 100644 --- a/sdk/security/azure-resourcemanager-security/README.md +++ b/sdk/security/azure-resourcemanager-security/README.md @@ -2,7 +2,7 @@ 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). +This package contains Microsoft Azure SDK for Security Management SDK. API spec for Microsoft.Security (Azure Security Center) alerts resource provider. Package api-version AlertsAPI: 2022-01-01, AlertsSuppressionRulesAPI: 2019-01-01-preview, ApiCollectionsAPI: 2023-11-15, ApplicationsAPI: 2022-07-01-preview, AssessmentAPI: 2025-05-04, ATPSettingsAPI: 2019-01-01, AutomationsAPI: 2023-12-01-preview, ComplianceResultsAPI: 2017-08-01, DefenderForStorageAPI: 2025-09-01-preview, GovernanceAPI: 2022-01-01-preview, HealthReportsAPI: 2023-05-01-preview, IoTSecurityAPI: 2019-08-01, LegacySettingsAPI: 2017-08-01-preview, LocationsAPI: 2015-06-01-preview, MdeOnboardingAPI: 2021-10-01-preview, OperationsAPI: 2025-10-01-preview, PricingsAPI: 2024-01-01, PrivateLinksAPI: 2026-01-01, RegulatoryComplianceAPI: 2019-01-01-preview, SecureScoreAPI: 2020-01-01, SecurityConnectorsAPI: 2024-08-01-preview, SecurityConnectorsDevOpsAPI: 2025-11-01-preview, SecurityOperatorsAPI: 2023-01-01-preview, SecuritySolutionsAPI: 2020-01-01, SecurityStandardsAPI: 2024-08-01, SensitivitySettingsAPI: 2023-02-15-preview, ServerVulnerabilityAssessmentsSettingsAPI: 2023-05-01, SettingsAPI: 2022-05-01, SqlVulnerabilityAssessmentsAPI: 2026-04-01-preview, StandardsAPI: 2021-08-01-preview, SubAssessmentsAPI: 2019-01-01-preview, TasksAPI: 2015-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ SecurityManager manager = SecurityManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/security/azure-resourcemanager-security/SAMPLE.md b/sdk/security/azure-resourcemanager-security/SAMPLE.md index a0765d25ba82..77e24ff3efbd 100644 --- a/sdk/security/azure-resourcemanager-security/SAMPLE.md +++ b/sdk/security/azure-resourcemanager-security/SAMPLE.md @@ -1,3703 +1,2 @@ # Code snippets and samples - -## AdvancedThreatProtection - -- [Create](#advancedthreatprotection_create) -- [Get](#advancedthreatprotection_get) - -## Alerts - -- [GetResourceGroupLevel](#alerts_getresourcegrouplevel) -- [GetSubscriptionLevel](#alerts_getsubscriptionlevel) -- [List](#alerts_list) -- [ListByResourceGroup](#alerts_listbyresourcegroup) -- [ListResourceGroupLevelByRegion](#alerts_listresourcegrouplevelbyregion) -- [ListSubscriptionLevelByRegion](#alerts_listsubscriptionlevelbyregion) -- [Simulate](#alerts_simulate) -- [UpdateResourceGroupLevelStateToActivate](#alerts_updateresourcegrouplevelstatetoactivate) -- [UpdateResourceGroupLevelStateToDismiss](#alerts_updateresourcegrouplevelstatetodismiss) -- [UpdateResourceGroupLevelStateToInProgress](#alerts_updateresourcegrouplevelstatetoinprogress) -- [UpdateResourceGroupLevelStateToResolve](#alerts_updateresourcegrouplevelstatetoresolve) -- [UpdateSubscriptionLevelStateToActivate](#alerts_updatesubscriptionlevelstatetoactivate) -- [UpdateSubscriptionLevelStateToDismiss](#alerts_updatesubscriptionlevelstatetodismiss) -- [UpdateSubscriptionLevelStateToInProgress](#alerts_updatesubscriptionlevelstatetoinprogress) -- [UpdateSubscriptionLevelStateToResolve](#alerts_updatesubscriptionlevelstatetoresolve) - -## AllowedConnections - -- [Get](#allowedconnections_get) -- [List](#allowedconnections_list) -- [ListByHomeRegion](#allowedconnections_listbyhomeregion) - -## ApiCollections - -- [GetByAzureApiManagementService](#apicollections_getbyazureapimanagementservice) -- [List](#apicollections_list) -- [ListByAzureApiManagementService](#apicollections_listbyazureapimanagementservice) -- [ListByResourceGroup](#apicollections_listbyresourcegroup) -- [OffboardAzureApiManagementApi](#apicollections_offboardazureapimanagementapi) -- [OnboardAzureApiManagementApi](#apicollections_onboardazureapimanagementapi) - -## Assessments - -- [CreateOrUpdate](#assessments_createorupdate) -- [Delete](#assessments_delete) -- [Get](#assessments_get) -- [List](#assessments_list) - -## AssessmentsMetadata - -- [CreateInSubscription](#assessmentsmetadata_createinsubscription) -- [DeleteInSubscription](#assessmentsmetadata_deleteinsubscription) -- [Get](#assessmentsmetadata_get) -- [GetInSubscription](#assessmentsmetadata_getinsubscription) -- [List](#assessmentsmetadata_list) -- [ListBySubscription](#assessmentsmetadata_listbysubscription) - -## ComplianceResults - -- [Get](#complianceresults_get) -- [List](#complianceresults_list) - -## CustomRecommendations - -- [CreateOrUpdate](#customrecommendations_createorupdate) -- [Delete](#customrecommendations_delete) -- [Get](#customrecommendations_get) -- [List](#customrecommendations_list) - -## DeviceSecurityGroups - -- [CreateOrUpdate](#devicesecuritygroups_createorupdate) -- [Delete](#devicesecuritygroups_delete) -- [Get](#devicesecuritygroups_get) -- [List](#devicesecuritygroups_list) - -## DiscoveredSecuritySolutions - -- [Get](#discoveredsecuritysolutions_get) -- [List](#discoveredsecuritysolutions_list) -- [ListByHomeRegion](#discoveredsecuritysolutions_listbyhomeregion) - -## ExternalSecuritySolutions - -- [Get](#externalsecuritysolutions_get) -- [List](#externalsecuritysolutions_list) -- [ListByHomeRegion](#externalsecuritysolutions_listbyhomeregion) - -## IotSecuritySolution - -- [CreateOrUpdate](#iotsecuritysolution_createorupdate) -- [Delete](#iotsecuritysolution_delete) -- [GetByResourceGroup](#iotsecuritysolution_getbyresourcegroup) -- [List](#iotsecuritysolution_list) -- [ListByResourceGroup](#iotsecuritysolution_listbyresourcegroup) -- [Update](#iotsecuritysolution_update) - -## IotSecuritySolutionAnalytics - -- [Get](#iotsecuritysolutionanalytics_get) -- [List](#iotsecuritysolutionanalytics_list) - -## IotSecuritySolutionsAnalyticsAggregatedAlert - -- [Dismiss](#iotsecuritysolutionsanalyticsaggregatedalert_dismiss) -- [Get](#iotsecuritysolutionsanalyticsaggregatedalert_get) -- [List](#iotsecuritysolutionsanalyticsaggregatedalert_list) - -## IotSecuritySolutionsAnalyticsRecommendation - -- [Get](#iotsecuritysolutionsanalyticsrecommendation_get) -- [List](#iotsecuritysolutionsanalyticsrecommendation_list) - -## JitNetworkAccessPolicies - -- [CreateOrUpdate](#jitnetworkaccesspolicies_createorupdate) -- [Delete](#jitnetworkaccesspolicies_delete) -- [Get](#jitnetworkaccesspolicies_get) -- [Initiate](#jitnetworkaccesspolicies_initiate) -- [List](#jitnetworkaccesspolicies_list) -- [ListByRegion](#jitnetworkaccesspolicies_listbyregion) -- [ListByResourceGroup](#jitnetworkaccesspolicies_listbyresourcegroup) -- [ListByResourceGroupAndRegion](#jitnetworkaccesspolicies_listbyresourcegroupandregion) - -## Pricings - -- [Delete](#pricings_delete) -- [Get](#pricings_get) -- [List](#pricings_list) -- [Update](#pricings_update) - -## SecureScoreControlDefinitions - -- [List](#securescorecontroldefinitions_list) -- [ListBySubscription](#securescorecontroldefinitions_listbysubscription) - -## SecureScoreControls - -- [List](#securescorecontrols_list) -- [ListBySecureScore](#securescorecontrols_listbysecurescore) - -## SecureScores - -- [Get](#securescores_get) -- [List](#securescores_list) - -## SecuritySolutions - -- [Get](#securitysolutions_get) -- [List](#securitysolutions_list) - -## SecuritySolutionsReferenceData - -- [List](#securitysolutionsreferencedata_list) -- [ListByHomeRegion](#securitysolutionsreferencedata_listbyhomeregion) - -## SecurityStandards - -- [CreateOrUpdate](#securitystandards_createorupdate) -- [Delete](#securitystandards_delete) -- [Get](#securitystandards_get) -- [List](#securitystandards_list) - -## ServerVulnerabilityAssessment - -- [CreateOrUpdate](#servervulnerabilityassessment_createorupdate) -- [Delete](#servervulnerabilityassessment_delete) -- [Get](#servervulnerabilityassessment_get) -- [ListByExtendedResource](#servervulnerabilityassessment_listbyextendedresource) - -## ServerVulnerabilityAssessmentsSettings - -- [CreateOrUpdate](#servervulnerabilityassessmentssettings_createorupdate) -- [Delete](#servervulnerabilityassessmentssettings_delete) -- [Get](#servervulnerabilityassessmentssettings_get) -- [List](#servervulnerabilityassessmentssettings_list) - -## Settings - -- [Get](#settings_get) -- [List](#settings_list) -- [Update](#settings_update) - -## StandardAssignments - -- [Create](#standardassignments_create) -- [Delete](#standardassignments_delete) -- [Get](#standardassignments_get) -- [List](#standardassignments_list) - -## Topology - -- [Get](#topology_get) -- [List](#topology_list) -- [ListByHomeRegion](#topology_listbyhomeregion) -### AdvancedThreatProtection_Create - -```java -/** - * Samples for AdvancedThreatProtection Create. - */ -public final class AdvancedThreatProtectionCreateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void createsOrUpdatesTheAdvancedThreatProtectionSettingsOnASpecifiedResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.advancedThreatProtections() - .define() - .withExistingResourceId( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount") - .withIsEnabled(true) - .create(); - } -} -``` - -### AdvancedThreatProtection_Get - -```java -/** - * Samples for AdvancedThreatProtection Get. - */ -public final class AdvancedThreatProtectionGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getsTheAdvancedThreatProtectionSettingsForTheSpecifiedResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.advancedThreatProtections() - .getWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", - com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_GetResourceGroupLevel - -```java -/** - * Samples for Alerts GetResourceGroupLevel. - */ -public final class AlertsGetResourceGroupLevelSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityAlertOnAResourceGroupFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .getResourceGroupLevelWithResponse("myRg1", "westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_GetSubscriptionLevel - -```java -/** - * Samples for Alerts GetSubscriptionLevel. - */ -public final class AlertsGetSubscriptionLevelSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityAlertOnASubscriptionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .getSubscriptionLevelWithResponse("westeurope", "2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA", - com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_List - -```java -/** - * Samples for Alerts List. - */ -public final class AlertsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityAlertsOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts().list(com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_ListByResourceGroup - -```java -/** - * Samples for Alerts ListByResourceGroup. - */ -public final class AlertsListByResourceGroupSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityAlertsOnAResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts().listByResourceGroup("myRg1", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_ListResourceGroupLevelByRegion - -```java -/** - * Samples for Alerts ListResourceGroupLevelByRegion. - */ -public final class AlertsListResourceGroupLevelByRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityAlertsOnAResourceGroupFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts().listResourceGroupLevelByRegion("westeurope", "myRg1", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_ListSubscriptionLevelByRegion - -```java -/** - * Samples for Alerts ListSubscriptionLevelByRegion. - */ -public final class AlertsListSubscriptionLevelByRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityAlertsOnASubscriptionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts().listSubscriptionLevelByRegion("westeurope", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_Simulate - -```java -import com.azure.resourcemanager.security.models.AlertSimulatorBundlesRequestProperties; -import com.azure.resourcemanager.security.models.AlertSimulatorRequestBody; -import com.azure.resourcemanager.security.models.BundleType; -import java.util.Arrays; - -/** - * Samples for Alerts Simulate. - */ -public final class AlertsSimulateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - simulateSecurityAlertsOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .simulate("centralus", - new AlertSimulatorRequestBody().withProperties(new AlertSimulatorBundlesRequestProperties() - .withBundles(Arrays.asList(BundleType.APP_SERVICES, BundleType.DNS, BundleType.KEY_VAULTS, - BundleType.KUBERNETES_SERVICE, BundleType.RESOURCE_MANAGER, BundleType.SQL_SERVERS, - BundleType.STORAGE_ACCOUNTS, BundleType.VIRTUAL_MACHINES, BundleType.COSMOS_DBS))), - com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateResourceGroupLevelStateToActivate - -```java -/** - * Samples for Alerts UpdateResourceGroupLevelStateToActivate. - */ -public final class AlertsUpdateResourceGroupLevelStateToActivateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateResourceGroupLevelStateToActivateWithResponse("myRg2", "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateResourceGroupLevelStateToDismiss - -```java -/** - * Samples for Alerts UpdateResourceGroupLevelStateToDismiss. - */ -public final class AlertsUpdateResourceGroupLevelStateToDismissSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateResourceGroupLevelStateToDismissWithResponse("myRg2", "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateResourceGroupLevelStateToInProgress - -```java -/** - * Samples for Alerts UpdateResourceGroupLevelStateToInProgress. - */ -public final class AlertsUpdateResourceGroupLevelStateToInProgressSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateResourceGroupLevelStateToInProgressWithResponse("myRg2", "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateResourceGroupLevelStateToResolve - -```java -/** - * Samples for Alerts UpdateResourceGroupLevelStateToResolve. - */ -public final class AlertsUpdateResourceGroupLevelStateToResolveSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateResourceGroupLevelStateToResolveWithResponse("myRg2", "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateSubscriptionLevelStateToActivate - -```java -/** - * Samples for Alerts UpdateSubscriptionLevelStateToActivate. - */ -public final class AlertsUpdateSubscriptionLevelStateToActivateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateSubscriptionLevelStateToActivateWithResponse("westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateSubscriptionLevelStateToDismiss - -```java -/** - * Samples for Alerts UpdateSubscriptionLevelStateToDismiss. - */ -public final class AlertsUpdateSubscriptionLevelStateToDismissSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateSubscriptionLevelStateToDismissWithResponse("westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateSubscriptionLevelStateToInProgress - -```java -/** - * Samples for Alerts UpdateSubscriptionLevelStateToInProgress. - */ -public final class AlertsUpdateSubscriptionLevelStateToInProgressSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateSubscriptionLevelStateToInProgressWithResponse("westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); - } -} -``` - -### Alerts_UpdateSubscriptionLevelStateToResolve - -```java -/** - * Samples for Alerts UpdateSubscriptionLevelStateToResolve. - */ -public final class AlertsUpdateSubscriptionLevelStateToResolveSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateSubscriptionLevelStateToResolveWithResponse("westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); - } -} -``` - -### AllowedConnections_Get - -```java -import com.azure.resourcemanager.security.models.ConnectionType; - -/** - * Samples for AllowedConnections Get. - */ -public final class AllowedConnectionsGetSamples { - /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/ - * GetAllowedConnections_example.json - */ - /** - * Sample code: Get allowed connections. - * - * @param manager Entry point to SecurityManager. - */ - public static void getAllowedConnections(com.azure.resourcemanager.security.SecurityManager manager) { - manager.allowedConnections() - .getWithResponse("myResourceGroup", "centralus", ConnectionType.INTERNAL, com.azure.core.util.Context.NONE); - } -} -``` - -### AllowedConnections_List - -```java -/** - * Samples for AllowedConnections List. - */ -public final class AllowedConnectionsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getAllowedConnectionsOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.allowedConnections().list(com.azure.core.util.Context.NONE); - } -} -``` - -### AllowedConnections_ListByHomeRegion - -```java -/** - * Samples for AllowedConnections ListByHomeRegion. - */ -public final class AllowedConnectionsListByHomeRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getAllowedConnectionsOnASubscriptionFromSecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.allowedConnections().listByHomeRegion("centralus", com.azure.core.util.Context.NONE); - } -} -``` - -### ApiCollections_GetByAzureApiManagementService - -```java -/** - * Samples for ApiCollections GetByAzureApiManagementService. - */ -public final class ApiCollectionsGetByAzureApiManagementServiceSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getsAnAzureAPIManagementAPIIfItHasBeenOnboardedToMicrosoftDefenderForAPIs( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections() - .getByAzureApiManagementServiceWithResponse("rg1", "apimService1", "echo-api", - com.azure.core.util.Context.NONE); - } -} -``` - -### ApiCollections_List - -```java -/** - * Samples for ApiCollections List. - */ -public final class ApiCollectionsListSamples { - /* - * 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 - * for APIs. - * - * @param manager Entry point to SecurityManager. - */ - public static void getsAListOfAPICollectionsWithinASubscriptionThatHaveBeenOnboardedToMicrosoftDefenderForAPIs( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections().list(com.azure.core.util.Context.NONE); - } -} -``` - -### ApiCollections_ListByAzureApiManagementService - -```java -/** - * Samples for ApiCollections ListByAzureApiManagementService. - */ -public final class ApiCollectionsListByAzureApiManagementServiceSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getsAListOfAzureAPIManagementAPIsThatHaveBeenOnboardedToMicrosoftDefenderForAPIs( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections() - .listByAzureApiManagementService("rg1", "apimService1", com.azure.core.util.Context.NONE); - } -} -``` - -### ApiCollections_ListByResourceGroup - -```java -/** - * Samples for ApiCollections ListByResourceGroup. - */ -public final class ApiCollectionsListByResourceGroupSamples { - /* - * 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 - * Defender for APIs. - * - * @param manager Entry point to SecurityManager. - */ - public static void getsAListOfAPICollectionsWithinAResourceGroupThatHaveBeenOnboardedToMicrosoftDefenderForAPIs( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); - } -} -``` - -### ApiCollections_OffboardAzureApiManagementApi - -```java -/** - * Samples for ApiCollections OffboardAzureApiManagementApi. - */ -public final class ApiCollectionsOffboardAzureApiManagementApiSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void offboardAnAzureAPIManagementAPIFromMicrosoftDefenderForAPIs( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections() - .offboardAzureApiManagementApiWithResponse("rg1", "apimService1", "echo-api", - com.azure.core.util.Context.NONE); - } -} -``` - -### ApiCollections_OnboardAzureApiManagementApi - -```java -/** - * Samples for ApiCollections OnboardAzureApiManagementApi. - */ -public final class ApiCollectionsOnboardAzureApiManagementApiSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void onboardAnAzureAPIManagementAPIToMicrosoftDefenderForAPIs( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections() - .onboardAzureApiManagementApi("rg1", "apimService1", "echo-api", com.azure.core.util.Context.NONE); - } -} -``` - -### Assessments_CreateOrUpdate - -```java -import com.azure.resourcemanager.security.models.AssessmentStatus; -import com.azure.resourcemanager.security.models.AssessmentStatusCode; -import com.azure.resourcemanager.security.models.AzureResourceDetails; - -/** - * Samples for Assessments CreateOrUpdate. - */ -public final class AssessmentsCreateOrUpdateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - createSecurityRecommendationTaskOnAResource(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessments() - .define("8bb8be0a-6010-4789-812f-e4d661c4ed0e") - .withExistingResourceId( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2") - .withStatus(new AssessmentStatus().withCode(AssessmentStatusCode.HEALTHY)) - .withResourceDetails(new AzureResourceDetails()) - .create(); - } -} -``` - -### Assessments_Delete - -```java -/** - * Samples for Assessments Delete. - */ -public final class AssessmentsDeleteSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - deleteASecurityRecommendationTaskOnAResource(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessments() - .deleteByResourceGroupWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", - "8bb8be0a-6010-4789-812f-e4d661c4ed0e", com.azure.core.util.Context.NONE); - } -} -``` - -### Assessments_Get - -```java -import com.azure.resourcemanager.security.models.ExpandEnum; - -/** - * Samples for Assessments Get. - */ -public final class AssessmentsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityRecommendationTaskFromSecurityDataLocationWithExpandParameter( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessments() - .getWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", - "21300918-b2e3-0346-785f-c77ff57d243b", ExpandEnum.LINKS, com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityRecommendationTaskFromSecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessments() - .getWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", - "21300918-b2e3-0346-785f-c77ff57d243b", null, com.azure.core.util.Context.NONE); - } -} -``` - -### Assessments_List - -```java -/** - * Samples for Assessments List. - */ -public final class AssessmentsListSamples { - /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ - * ListAssessments_example.json - */ - /** - * Sample code: List security assessments. - * - * @param manager Entry point to SecurityManager. - */ - public static void listSecurityAssessments(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessments() - .list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", com.azure.core.util.Context.NONE); - } -} -``` - -### AssessmentsMetadata_CreateInSubscription - -```java -import com.azure.resourcemanager.security.models.AssessmentType; -import com.azure.resourcemanager.security.models.Categories; -import com.azure.resourcemanager.security.models.ImplementationEffort; -import com.azure.resourcemanager.security.models.Severity; -import com.azure.resourcemanager.security.models.Threats; -import com.azure.resourcemanager.security.models.UserImpact; -import java.util.Arrays; - -/** - * Samples for AssessmentsMetadata CreateInSubscription. - */ -public final class AssessmentsMetadataCreateInSubscriptionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - createSecurityAssessmentMetadataForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessmentsMetadatas() - .define("ca039e75-a276-4175-aebc-bcd41e4b14b7") - .withDisplayName("Install endpoint protection solution on virtual machine scale sets") - .withDescription( - "Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities.") - .withRemediationDescription( - "To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set") - .withCategories(Arrays.asList(Categories.COMPUTE)) - .withSeverity(Severity.MEDIUM) - .withUserImpact(UserImpact.LOW) - .withImplementationEffort(ImplementationEffort.LOW) - .withThreats(Arrays.asList(Threats.DATA_EXFILTRATION, Threats.DATA_SPILLAGE, Threats.MALICIOUS_INSIDER)) - .withAssessmentType(AssessmentType.CUSTOMER_MANAGED) - .create(); - } -} -``` - -### AssessmentsMetadata_DeleteInSubscription - -```java -/** - * Samples for AssessmentsMetadata DeleteInSubscription. - */ -public final class AssessmentsMetadataDeleteInSubscriptionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - deleteASecurityAssessmentMetadataForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessmentsMetadatas() - .deleteInSubscriptionWithResponse("ca039e75-a276-4175-aebc-bcd41e4b14b7", com.azure.core.util.Context.NONE); - } -} -``` - -### AssessmentsMetadata_Get - -```java -/** - * Samples for AssessmentsMetadata Get. - */ -public final class AssessmentsMetadataGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityAssessmentMetadata(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessmentsMetadatas() - .getWithResponse("21300918-b2e3-0346-785f-c77ff57d243b", com.azure.core.util.Context.NONE); - } -} -``` - -### AssessmentsMetadata_GetInSubscription - -```java -/** - * Samples for AssessmentsMetadata GetInSubscription. - */ -public final class AssessmentsMetadataGetInSubscriptionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getSecurityAssessmentMetadataForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessmentsMetadatas() - .getInSubscriptionWithResponse("21300918-b2e3-0346-785f-c77ff57d243b", com.azure.core.util.Context.NONE); - } -} -``` - -### AssessmentsMetadata_List - -```java -/** - * Samples for AssessmentsMetadata List. - */ -public final class AssessmentsMetadataListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void listSecurityAssessmentMetadata(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessmentsMetadatas().list(com.azure.core.util.Context.NONE); - } -} -``` - -### AssessmentsMetadata_ListBySubscription - -```java -/** - * Samples for AssessmentsMetadata ListBySubscription. - */ -public final class AssessmentsMetadataListBySubscriptionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - listSecurityAssessmentMetadataForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.assessmentsMetadatas().listBySubscription(com.azure.core.util.Context.NONE); - } -} -``` - -### ComplianceResults_Get - -```java -/** - * Samples for ComplianceResults Get. - */ -public final class ComplianceResultsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getComplianceResultsOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.complianceResults() - .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "DesignateMoreThanOneOwner", - com.azure.core.util.Context.NONE); - } -} -``` - -### ComplianceResults_List - -```java -/** - * Samples for ComplianceResults List. - */ -public final class ComplianceResultsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getComplianceResultsOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.complianceResults() - .list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", com.azure.core.util.Context.NONE); - } -} -``` - -### 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); - } -} -``` - -### DeviceSecurityGroups_CreateOrUpdate - -```java -import com.azure.resourcemanager.security.models.ActiveConnectionsNotInAllowedRange; -import java.time.Duration; -import java.util.Arrays; - -/** - * Samples for DeviceSecurityGroups CreateOrUpdate. - */ -public final class DeviceSecurityGroupsCreateOrUpdateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void createOrUpdateADeviceSecurityGroupForTheSpecifiedIoTHubResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.deviceSecurityGroups() - .define("samplesecuritygroup") - .withExistingResourceId( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub") - .withTimeWindowRules(Arrays.asList(new ActiveConnectionsNotInAllowedRange().withIsEnabled(true) - .withMinThreshold(0) - .withMaxThreshold(30) - .withTimeWindowSize(Duration.parse("PT05M")))) - .create(); - } -} -``` - -### DeviceSecurityGroups_Delete - -```java -/** - * Samples for DeviceSecurityGroups Delete. - */ -public final class DeviceSecurityGroupsDeleteSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void deleteADeviceSecurityGroupForTheSpecifiedIoTHubResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.deviceSecurityGroups() - .deleteByResourceGroupWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", - "samplesecuritygroup", com.azure.core.util.Context.NONE); - } -} -``` - -### DeviceSecurityGroups_Get - -```java -/** - * Samples for DeviceSecurityGroups Get. - */ -public final class DeviceSecurityGroupsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getADeviceSecurityGroupForTheSpecifiedIoTHubResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.deviceSecurityGroups() - .getWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", - "samplesecuritygroup", com.azure.core.util.Context.NONE); - } -} -``` - -### DeviceSecurityGroups_List - -```java -/** - * Samples for DeviceSecurityGroups List. - */ -public final class DeviceSecurityGroupsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void listAllDeviceSecurityGroupsForTheSpecifiedIoTHubResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.deviceSecurityGroups() - .list( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", - com.azure.core.util.Context.NONE); - } -} -``` - -### DiscoveredSecuritySolutions_Get - -```java -/** - * Samples for DiscoveredSecuritySolutions Get. - */ -public final class DiscoveredSecuritySolutionsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getDiscoveredSecuritySolutionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.discoveredSecuritySolutions() - .getWithResponse("myRg2", "centralus", "paloalto7", com.azure.core.util.Context.NONE); - } -} -``` - -### DiscoveredSecuritySolutions_List - -```java -/** - * Samples for DiscoveredSecuritySolutions List. - */ -public final class DiscoveredSecuritySolutionsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getDiscoveredSecuritySolutions(com.azure.resourcemanager.security.SecurityManager manager) { - manager.discoveredSecuritySolutions().list(com.azure.core.util.Context.NONE); - } -} -``` - -### DiscoveredSecuritySolutions_ListByHomeRegion - -```java -/** - * Samples for DiscoveredSecuritySolutions ListByHomeRegion. - */ -public final class DiscoveredSecuritySolutionsListByHomeRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getDiscoveredSecuritySolutionsFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.discoveredSecuritySolutions().listByHomeRegion("centralus", com.azure.core.util.Context.NONE); - } -} -``` - -### ExternalSecuritySolutions_Get - -```java -/** - * Samples for ExternalSecuritySolutions Get. - */ -public final class ExternalSecuritySolutionsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getExternalSecuritySolution(com.azure.resourcemanager.security.SecurityManager manager) { - manager.externalSecuritySolutions() - .getWithResponse("defaultresourcegroup-eus", "centralus", - "aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus", com.azure.core.util.Context.NONE); - } -} -``` - -### ExternalSecuritySolutions_List - -```java -/** - * Samples for ExternalSecuritySolutions List. - */ -public final class ExternalSecuritySolutionsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getExternalSecuritySolutionsOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.externalSecuritySolutions().list(com.azure.core.util.Context.NONE); - } -} -``` - -### ExternalSecuritySolutions_ListByHomeRegion - -```java -/** - * Samples for ExternalSecuritySolutions ListByHomeRegion. - */ -public final class ExternalSecuritySolutionsListByHomeRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getExternalSecuritySolutionsOnASubscriptionFromSecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.externalSecuritySolutions().listByHomeRegion("centralus", com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolution_CreateOrUpdate - -```java -import com.azure.resourcemanager.security.models.RecommendationConfigStatus; -import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties; -import com.azure.resourcemanager.security.models.RecommendationType; -import com.azure.resourcemanager.security.models.SecuritySolutionStatus; -import com.azure.resourcemanager.security.models.UnmaskedIpLoggingStatus; -import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for IotSecuritySolution CreateOrUpdate. - */ -public final class IotSecuritySolutionCreateOrUpdateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void createOrUpdateAIoTSecuritySolution(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutions() - .define("default") - .withExistingResourceGroup("MyGroup") - .withRegion("East Us") - .withTags(mapOf()) - .withWorkspace( - "/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1") - .withDisplayName("Solution Default") - .withStatus(SecuritySolutionStatus.ENABLED) - .withExport(Arrays.asList()) - .withDisabledDataSources(Arrays.asList()) - .withIotHubs(Arrays.asList( - "/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")) - .withUserDefinedResources(new UserDefinedResourcesProperties() - .withQuery("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\"") - .withQuerySubscriptions(Arrays.asList("075423e9-7d33-4166-8bdf-3920b04e3735"))) - .withRecommendationsConfiguration(Arrays.asList( - new RecommendationConfigurationProperties().withRecommendationType(RecommendationType.IO_T_OPEN_PORTS) - .withStatus(RecommendationConfigStatus.DISABLED), - new RecommendationConfigurationProperties() - .withRecommendationType(RecommendationType.IO_T_SHARED_CREDENTIALS) - .withStatus(RecommendationConfigStatus.DISABLED))) - .withUnmaskedIpLoggingStatus(UnmaskedIpLoggingStatus.ENABLED) - .create(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} -``` - -### IotSecuritySolution_Delete - -```java -/** - * Samples for IotSecuritySolution Delete. - */ -public final class IotSecuritySolutionDeleteSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void deleteAnIoTSecuritySolution(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutions() - .deleteByResourceGroupWithResponse("MyGroup", "default", com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolution_GetByResourceGroup - -```java -/** - * Samples for IotSecuritySolution GetByResourceGroup. - */ -public final class IotSecuritySolutionGetByResourceGroupSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getAIoTSecuritySolution(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutions() - .getByResourceGroupWithResponse("MyGroup", "default", com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolution_List - -```java -/** - * Samples for IotSecuritySolution List. - */ -public final class IotSecuritySolutionListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - listIoTSecuritySolutionsBySubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutions().list(null, com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void listIoTSecuritySolutionsByIoTHub(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutions() - .list( - "properties.iotHubs/any(i eq \"/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub\")", - com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolution_ListByResourceGroup - -```java -/** - * Samples for IotSecuritySolution ListByResourceGroup. - */ -public final class IotSecuritySolutionListByResourceGroupSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - listIoTSecuritySolutionsByResourceGroupAndIoTHub(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutions() - .listByResourceGroup("MyRg", - "properties.iotHubs/any(i eq \"/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub\")", - com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - listIoTSecuritySolutionsByResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutions().listByResourceGroup("MyGroup", null, com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolution_Update - -```java -import com.azure.resourcemanager.security.models.IoTSecuritySolutionModel; -import com.azure.resourcemanager.security.models.RecommendationConfigStatus; -import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties; -import com.azure.resourcemanager.security.models.RecommendationType; -import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for IotSecuritySolution Update. - */ -public final class IotSecuritySolutionUpdateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - useThisMethodToUpdateExistingIoTSecuritySolution(com.azure.resourcemanager.security.SecurityManager manager) { - IoTSecuritySolutionModel resource = manager.iotSecuritySolutions() - .getByResourceGroupWithResponse("myRg", "default", com.azure.core.util.Context.NONE) - .getValue(); - resource.update() - .withTags(mapOf("foo", "bar")) - .withUserDefinedResources(new UserDefinedResourcesProperties() - .withQuery("where type != \"microsoft.devices/iothubs\" | where name contains \"v2\"") - .withQuerySubscriptions(Arrays.asList("075423e9-7d33-4166-8bdf-3920b04e3735"))) - .withRecommendationsConfiguration(Arrays.asList( - new RecommendationConfigurationProperties().withRecommendationType(RecommendationType.IO_T_OPEN_PORTS) - .withStatus(RecommendationConfigStatus.DISABLED), - new RecommendationConfigurationProperties() - .withRecommendationType(RecommendationType.IO_T_SHARED_CREDENTIALS) - .withStatus(RecommendationConfigStatus.DISABLED))) - .apply(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} -``` - -### IotSecuritySolutionAnalytics_Get - -```java -/** - * Samples for IotSecuritySolutionAnalytics Get. - */ -public final class IotSecuritySolutionAnalyticsGetSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ - * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalytics.json - */ - /** - * Sample code: Get Security Solution Analytics. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecuritySolutionAnalytics(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutionAnalytics().getWithResponse("MyGroup", "default", com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolutionAnalytics_List - -```java -/** - * Samples for IotSecuritySolutionAnalytics List. - */ -public final class IotSecuritySolutionAnalyticsListSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ - * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json - */ - /** - * Sample code: Get Security Solution Analytics. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecuritySolutionAnalytics(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutionAnalytics().listWithResponse("MyGroup", "default", com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolutionsAnalyticsAggregatedAlert_Dismiss - -```java -/** - * Samples for IotSecuritySolutionsAnalyticsAggregatedAlert Dismiss. - */ -public final class IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - dismissAnAggregatedIoTSecuritySolutionAlert(com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutionsAnalyticsAggregatedAlerts() - .dismissWithResponse("IoTEdgeResources", "default", "IoT_Bruteforce_Fail/2019-02-02/dismiss", - com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolutionsAnalyticsAggregatedAlert_Get - -```java -/** - * Samples for IotSecuritySolutionsAnalyticsAggregatedAlert Get. - */ -public final class IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples { - /* - * 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 - * performed by alert name. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getTheAggregatedSecurityAnalyticsAlertOfYoursIoTSecuritySolutionThisAggregationIsPerformedByAlertName( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutionsAnalyticsAggregatedAlerts() - .getWithResponse("MyGroup", "default", "IoT_Bruteforce_Fail/2019-02-02", com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolutionsAnalyticsAggregatedAlert_List - -```java -/** - * Samples for IotSecuritySolutionsAnalyticsAggregatedAlert List. - */ -public final class IotSecuritySolutionsAnalyticsAggregatedAlertListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getTheAggregatedAlertListOfYoursIoTSecuritySolution( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutionsAnalyticsAggregatedAlerts() - .list("MyGroup", "default", null, com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolutionsAnalyticsRecommendation_Get - -```java -/** - * Samples for IotSecuritySolutionsAnalyticsRecommendation Get. - */ -public final class IotSecuritySolutionsAnalyticsRecommendationGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getTheAggregatedSecurityAnalyticsRecommendationOfYoursIoTSecuritySolution( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutionsAnalyticsRecommendations() - .getWithResponse("IoTEdgeResources", "default", "OpenPortsOnDevice", com.azure.core.util.Context.NONE); - } -} -``` - -### IotSecuritySolutionsAnalyticsRecommendation_List - -```java -/** - * Samples for IotSecuritySolutionsAnalyticsRecommendation List. - */ -public final class IotSecuritySolutionsAnalyticsRecommendationListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getTheListOfAggregatedSecurityAnalyticsRecommendationsOfYoursIoTSecuritySolution( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.iotSecuritySolutionsAnalyticsRecommendations() - .list("IoTEdgeResources", "default", null, com.azure.core.util.Context.NONE); - } -} -``` - -### JitNetworkAccessPolicies_CreateOrUpdate - -```java -import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; -import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyVirtualMachine; -import com.azure.resourcemanager.security.models.JitNetworkAccessPortRule; -import com.azure.resourcemanager.security.models.JitNetworkAccessRequestPort; -import com.azure.resourcemanager.security.models.JitNetworkAccessRequestVirtualMachine; -import com.azure.resourcemanager.security.models.Protocol; -import com.azure.resourcemanager.security.models.Status; -import com.azure.resourcemanager.security.models.StatusReason; -import java.time.OffsetDateTime; -import java.util.Arrays; - -/** - * Samples for JitNetworkAccessPolicies CreateOrUpdate. - */ -public final class JitNetworkAccessPoliciesCreateOrUpdateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void createJITNetworkAccessPolicy(com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies() - .define("default") - .withExistingLocation("myRg1", "westeurope") - .withVirtualMachines(Arrays.asList(new JitNetworkAccessPolicyVirtualMachine().withId( - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1") - .withPorts(Arrays.asList( - new JitNetworkAccessPortRule().withNumber(22) - .withProtocol(Protocol.ASTERISK) - .withAllowedSourceAddressPrefix("*") - .withMaxRequestAccessDuration("PT3H"), - new JitNetworkAccessPortRule().withNumber(3389) - .withProtocol(Protocol.ASTERISK) - .withAllowedSourceAddressPrefix("*") - .withMaxRequestAccessDuration("PT3H"))))) - .withKind("Basic") - .withRequests(Arrays.asList(new JitNetworkAccessRequestInner() - .withVirtualMachines(Arrays.asList(new JitNetworkAccessRequestVirtualMachine().withId( - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1") - .withPorts(Arrays.asList(new JitNetworkAccessRequestPort().withNumber(3389) - .withAllowedSourceAddressPrefix("192.127.0.2") - .withEndTimeUtc(OffsetDateTime.parse("2018-05-17T09:06:45.5691611Z")) - .withStatus(Status.INITIATED) - .withStatusReason(StatusReason.USER_REQUESTED))))) - .withStartTimeUtc(OffsetDateTime.parse("2018-05-17T08:06:45.5691611Z")) - .withRequestor("barbara@contoso.com"))) - .create(); - } -} -``` - -### JitNetworkAccessPolicies_Delete - -```java -/** - * Samples for JitNetworkAccessPolicies Delete. - */ -public final class JitNetworkAccessPoliciesDeleteSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void deleteAJITNetworkAccessPolicy(com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies() - .deleteWithResponse("myRg1", "westeurope", "default", com.azure.core.util.Context.NONE); - } -} -``` - -### JitNetworkAccessPolicies_Get - -```java -/** - * Samples for JitNetworkAccessPolicies Get. - */ -public final class JitNetworkAccessPoliciesGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getJITNetworkAccessPolicy(com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies() - .getWithResponse("myRg1", "westeurope", "default", com.azure.core.util.Context.NONE); - } -} -``` - -### JitNetworkAccessPolicies_Initiate - -```java -import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiatePort; -import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateRequest; -import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateVirtualMachine; -import java.util.Arrays; - -/** - * Samples for JitNetworkAccessPolicies Initiate. - */ -public final class JitNetworkAccessPoliciesInitiateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - initiateAnActionOnAJITNetworkAccessPolicy(com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies() - .initiateWithResponse("myRg1", "westeurope", "default", new JitNetworkAccessPolicyInitiateRequest() - .withVirtualMachines(Arrays.asList(new JitNetworkAccessPolicyInitiateVirtualMachine().withId( - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1") - .withPorts(Arrays.asList(new JitNetworkAccessPolicyInitiatePort().withNumber(3389) - .withAllowedSourceAddressPrefix("192.127.0.2"))))) - .withJustification("testing a new version of the product"), com.azure.core.util.Context.NONE); - } -} -``` - -### JitNetworkAccessPolicies_List - -```java -/** - * Samples for JitNetworkAccessPolicies List. - */ -public final class JitNetworkAccessPoliciesListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getJITNetworkAccessPoliciesOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies().list(com.azure.core.util.Context.NONE); - } -} -``` - -### JitNetworkAccessPolicies_ListByRegion - -```java -/** - * Samples for JitNetworkAccessPolicies ListByRegion. - */ -public final class JitNetworkAccessPoliciesListByRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getJITNetworkAccessPoliciesOnASubscriptionFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies().listByRegion("westeurope", com.azure.core.util.Context.NONE); - } -} -``` - -### JitNetworkAccessPolicies_ListByResourceGroup - -```java -/** - * Samples for JitNetworkAccessPolicies ListByResourceGroup. - */ -public final class JitNetworkAccessPoliciesListByResourceGroupSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getJITNetworkAccessPoliciesOnAResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies().listByResourceGroup("myRg1", com.azure.core.util.Context.NONE); - } -} -``` - -### JitNetworkAccessPolicies_ListByResourceGroupAndRegion - -```java -/** - * Samples for JitNetworkAccessPolicies ListByResourceGroupAndRegion. - */ -public final class JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getJITNetworkAccessPoliciesOnAResourceGroupFromASecurityDataLocation( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.jitNetworkAccessPolicies() - .listByResourceGroupAndRegion("myRg1", "westeurope", com.azure.core.util.Context.NONE); - } -} -``` - -### Pricings_Delete - -```java -/** - * Samples for Pricings Delete. - */ -public final class PricingsDeleteSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void deleteAPricingOnResource(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .deleteByResourceGroupWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", - "VirtualMachines", com.azure.core.util.Context.NONE); - } -} -``` - -### Pricings_Get - -```java -/** - * Samples for Pricings Get. - */ -public final class PricingsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getPricingsOnResourceVirtualMachinesPlan(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .getWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", - "VirtualMachines", com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getPricingsOnSubscriptionCloudPosturePlan(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "CloudPosture", - com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getPricingsOnSubscriptionDnsPlan(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "Dns", - com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getPricingsOnSubscriptionContainersPlan(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "Containers", - com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getPricingsOnSubscriptionStorageAccountsPlan(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "StorageAccounts", - com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getPricingsOnSubscriptionVirtualMachinesPlan(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "VirtualMachines", - com.azure.core.util.Context.NONE); - } -} -``` - -### Pricings_List - -```java -/** - * Samples for Pricings List. - */ -public final class PricingsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getPricingsOnSubscriptionWithPlansFilter(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .listWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "name in (VirtualMachines,KeyVaults)", com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getPricingsOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .listWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", null, - com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getPricingsOnResource(com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .listWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", - null, com.azure.core.util.Context.NONE); - } -} -``` - -### Pricings_Update - -```java -import com.azure.resourcemanager.security.fluent.models.PricingInner; -import com.azure.resourcemanager.security.models.Enforce; -import com.azure.resourcemanager.security.models.PricingTier; - -/** - * Samples for Pricings Update. - */ -public final class PricingsUpdateSamples { - /* - * 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). - * - * @param manager Entry point to SecurityManager. - */ - public static void updatePricingOnSubscriptionExampleForCloudPosturePlan( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .updateWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "CloudPosture", - new PricingInner().withPricingTier(PricingTier.STANDARD), com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updatePricingOnSubscriptionExampleForCloudPosturePlanPartialSuccess( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .updateWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "CloudPosture", - new PricingInner().withPricingTier(PricingTier.STANDARD), com.azure.core.util.Context.NONE); - } - - /* - * 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). - * - * @param manager Entry point to SecurityManager. - */ - public static void updatePricingOnSubscriptionExampleForVirtualMachinesPlan( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .updateWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "VirtualMachines", - new PricingInner().withPricingTier(PricingTier.STANDARD).withSubPlan("P2").withEnforce(Enforce.TRUE), - com.azure.core.util.Context.NONE); - } - - /* - * 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). - * - * @param manager Entry point to SecurityManager. - */ - public static void updatePricingOnResourceExampleForVirtualMachinesPlan( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.pricings() - .updateWithResponse( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/DEMO/providers/Microsoft.Compute/virtualMachines/VM-1", - "virtualMachines", new PricingInner().withPricingTier(PricingTier.STANDARD).withSubPlan("P1"), - com.azure.core.util.Context.NONE); - } -} -``` - -### SecureScoreControlDefinitions_List - -```java -/** - * Samples for SecureScoreControlDefinitions List. - */ -public final class SecureScoreControlDefinitionsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void listSecurityControlsDefinition(com.azure.resourcemanager.security.SecurityManager manager) { - manager.secureScoreControlDefinitions().list(com.azure.core.util.Context.NONE); - } -} -``` - -### SecureScoreControlDefinitions_ListBySubscription - -```java -/** - * Samples for SecureScoreControlDefinitions ListBySubscription. - */ -public final class SecureScoreControlDefinitionsListBySubscriptionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - listSecurityControlsDefinitionBySubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.secureScoreControlDefinitions().listBySubscription(com.azure.core.util.Context.NONE); - } -} -``` - -### SecureScoreControls_List - -```java - -/** - * Samples for SecureScoreControls List. - */ -public final class SecureScoreControlsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void listAllSecureScoresControls(com.azure.resourcemanager.security.SecurityManager manager) { - manager.secureScoreControls().list(null, com.azure.core.util.Context.NONE); - } -} -``` - -### SecureScoreControls_ListBySecureScore - -```java -import com.azure.resourcemanager.security.models.ExpandControlsEnum; - -/** - * Samples for SecureScoreControls ListBySecureScore. - */ -public final class SecureScoreControlsListBySecureScoreSamples { - /* - * 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 - * parameter. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiativeWithTheExpandParameter( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.secureScoreControls() - .listBySecureScore("ascScore", ExpandControlsEnum.DEFINITION, com.azure.core.util.Context.NONE); - } - - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiative( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.secureScoreControls().listBySecureScore("ascScore", null, com.azure.core.util.Context.NONE); - } -} -``` - -### SecureScores_Get - -```java -/** - * Samples for SecureScores Get. - */ -public final class SecureScoresGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSingleSecureScore(com.azure.resourcemanager.security.SecurityManager manager) { - manager.secureScores().getWithResponse("ascScore", com.azure.core.util.Context.NONE); - } -} -``` - -### SecureScores_List - -```java -/** - * Samples for SecureScores List. - */ -public final class SecureScoresListSamples { - /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ - * ListSecureScores_example.json - */ - /** - * Sample code: List secure scores. - * - * @param manager Entry point to SecurityManager. - */ - public static void listSecureScores(com.azure.resourcemanager.security.SecurityManager manager) { - manager.secureScores().list(com.azure.core.util.Context.NONE); - } -} -``` - -### SecuritySolutions_Get - -```java -/** - * Samples for SecuritySolutions Get. - */ -public final class SecuritySolutionsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getASecuritySolutionFromASecurityDataLocation(com.azure.resourcemanager.security.SecurityManager manager) { - manager.securitySolutions() - .getWithResponse("myRg2", "centralus", "paloalto7", com.azure.core.util.Context.NONE); - } -} -``` - -### SecuritySolutions_List - -```java -/** - * Samples for SecuritySolutions List. - */ -public final class SecuritySolutionsListSamples { - /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/ - * GetSecuritySolutionsSubscription_example.json - */ - /** - * Sample code: Get security solutions. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecuritySolutions(com.azure.resourcemanager.security.SecurityManager manager) { - manager.securitySolutions().list(com.azure.core.util.Context.NONE); - } -} -``` - -### SecuritySolutionsReferenceData_List - -```java -/** - * Samples for SecuritySolutionsReferenceData List. - */ -public final class SecuritySolutionsReferenceDataListSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscription_example.json - */ - /** - * Sample code: Get security solutions. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSecuritySolutions(com.azure.resourcemanager.security.SecurityManager manager) { - manager.securitySolutionsReferenceDatas().listWithResponse(com.azure.core.util.Context.NONE); - } -} -``` - -### SecuritySolutionsReferenceData_ListByHomeRegion - -```java -/** - * Samples for SecuritySolutionsReferenceData ListByHomeRegion. - */ -public final class SecuritySolutionsReferenceDataListByHomeRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getSecuritySolutionsFromASecurityDataLocation(com.azure.resourcemanager.security.SecurityManager manager) { - manager.securitySolutionsReferenceDatas() - .listByHomeRegionWithResponse("westcentralus", com.azure.core.util.Context.NONE); - } -} -``` - -### 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); - } -} -``` - -### ServerVulnerabilityAssessment_CreateOrUpdate - -```java -/** - * Samples for ServerVulnerabilityAssessment CreateOrUpdate. - */ -public final class ServerVulnerabilityAssessmentCreateOrUpdateSamples { - /* - * 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 - * creating the resource, the server will be onboarded to vulnerability assessment by Microsoft.Security. - * - * @param manager Entry point to SecurityManager. - */ - public static void - createAServerVulnerabilityAssessmentsOnAResourceOnlyDefaultResourceIsSupportedOnceCreatingTheResourceTheServerWillBeOnboardedToVulnerabilityAssessmentByMicrosoftSecurity( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessments() - .createOrUpdateWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", - com.azure.core.util.Context.NONE); - } -} -``` - -### ServerVulnerabilityAssessment_Delete - -```java -/** - * Samples for ServerVulnerabilityAssessment Delete. - */ -public final class ServerVulnerabilityAssessmentDeleteSamples { - /* - * 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 - * deleting, Microsoft.Security will not provide vulnerability assessment findings on the resource. - * - * @param manager Entry point to SecurityManager. - */ - public static void - deleteAServerVulnerabilityAssessmentsOnAResourceOnlyDefaultResourceIsSupportedOnceDeletingMicrosoftSecurityWillNotProvideVulnerabilityAssessmentFindingsOnTheResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessments() - .delete("rg1", "Microsoft.Compute", "virtualMachines", "vm1", com.azure.core.util.Context.NONE); - } -} -``` - -### ServerVulnerabilityAssessment_Get - -```java -/** - * Samples for ServerVulnerabilityAssessment Get. - */ -public final class ServerVulnerabilityAssessmentGetSamples { - /* - * 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 - * only supports the single 'default' resource. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getAServerVulnerabilityAssessmentsOnboardingStatusOnAResourceCurrentlyMicrosoftSecurityOnlySupportsTheSingleDefaultResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessments() - .getWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", com.azure.core.util.Context.NONE); - } -} -``` - -### ServerVulnerabilityAssessment_ListByExtendedResource - -```java -/** - * Samples for ServerVulnerabilityAssessment ListByExtendedResource. - */ -public final class ServerVulnerabilityAssessmentListByExtendedResourceSamples { - /* - * 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, - * Currently Microsoft.Security only supports a single default type of server vulnerability assessment. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getAListOfServerVulnerabilityAssessmentsOnAResourceThoughThisAPIReturnsAListCurrentlyMicrosoftSecurityOnlySupportsASingleDefaultTypeOfServerVulnerabilityAssessment( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessments() - .listByExtendedResourceWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", - com.azure.core.util.Context.NONE); - } -} -``` - -### ServerVulnerabilityAssessmentsSettings_CreateOrUpdate - -```java -import com.azure.resourcemanager.security.models.AzureServersSetting; -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsAzureSettingSelectedProvider; -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; - -/** - * Samples for ServerVulnerabilityAssessmentsSettings CreateOrUpdate. - */ -public final class ServerVulnerabilityAssessmentsSettingsCreateOrUpdateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void setAServerVulnerabilityAssessmentsSettingOfTheKindSettingKindOnTheSubscription( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessmentsSettings() - .createOrUpdateWithResponse(ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, - new AzureServersSetting() - .withSelectedProvider(ServerVulnerabilityAssessmentsAzureSettingSelectedProvider.MDE_TVM), - com.azure.core.util.Context.NONE); - } -} -``` - -### ServerVulnerabilityAssessmentsSettings_Delete - -```java -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; - -/** - * Samples for ServerVulnerabilityAssessmentsSettings Delete. - */ -public final class ServerVulnerabilityAssessmentsSettingsDeleteSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void deleteTheServerVulnerabilityAssessmentsSettingOfTheKindSettingKindFromTheSubscription( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessmentsSettings() - .deleteWithResponse(ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, - com.azure.core.util.Context.NONE); - } -} -``` - -### ServerVulnerabilityAssessmentsSettings_Get - -```java -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; - -/** - * Samples for ServerVulnerabilityAssessmentsSettings Get. - */ -public final class ServerVulnerabilityAssessmentsSettingsGetSamples { - /* - * 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 - * subscription. - * - * @param manager Entry point to SecurityManager. - */ - public static void getTheServerVulnerabilityAssessmentsSettingOfTheKindSettingKindThatIsSetOnTheSubscription( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessmentsSettings() - .getWithResponse(ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, - com.azure.core.util.Context.NONE); - } -} -``` - -### ServerVulnerabilityAssessmentsSettings_List - -```java -/** - * Samples for ServerVulnerabilityAssessmentsSettings List. - */ -public final class ServerVulnerabilityAssessmentsSettingsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void listTheServerVulnerabilityAssessmentsSettingsSetOnTheSubscription( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessmentsSettings().list(com.azure.core.util.Context.NONE); - } -} -``` - -### Settings_Get - -```java -import com.azure.resourcemanager.security.models.SettingName; - -/** - * Samples for Settings Get. - */ -public final class SettingsGetSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getASettingOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.settings().getWithResponse(SettingName.WDATP, com.azure.core.util.Context.NONE); - } -} -``` - -### Settings_List - -```java -/** - * Samples for Settings List. - */ -public final class SettingsListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getSettingsOfSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.settings().list(com.azure.core.util.Context.NONE); - } -} -``` - -### Settings_Update - -```java -import com.azure.resourcemanager.security.models.DataExportSettings; -import com.azure.resourcemanager.security.models.SettingName; - -/** - * Samples for Settings Update. - */ -public final class SettingsUpdateSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateASettingForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.settings() - .updateWithResponse(SettingName.WDATP, new DataExportSettings().withEnabled(true), - com.azure.core.util.Context.NONE); - } -} -``` - -### 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); - } -} -``` - -### Topology_Get - -```java -/** - * Samples for Topology Get. - */ -public final class TopologyGetSamples { - /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/ - * GetTopology_example.json - */ - /** - * Sample code: Get topology. - * - * @param manager Entry point to SecurityManager. - */ - public static void getTopology(com.azure.resourcemanager.security.SecurityManager manager) { - manager.topologies().getWithResponse("myservers", "centralus", "vnets", com.azure.core.util.Context.NONE); - } -} -``` - -### Topology_List - -```java -/** - * Samples for Topology List. - */ -public final class TopologyListSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void getTopologyOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.topologies().list(com.azure.core.util.Context.NONE); - } -} -``` - -### Topology_ListByHomeRegion - -```java -/** - * Samples for Topology ListByHomeRegion. - */ -public final class TopologyListByHomeRegionSamples { - /* - * 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. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getTopologyOnASubscriptionFromSecurityDataLocation(com.azure.resourcemanager.security.SecurityManager manager) { - manager.topologies().listByHomeRegion("centralus", com.azure.core.util.Context.NONE); - } -} -``` - diff --git a/sdk/security/azure-resourcemanager-security/pom.xml b/sdk/security/azure-resourcemanager-security/pom.xml index 7397ab81463a..00f2368ac368 100644 --- a/sdk/security/azure-resourcemanager-security/pom.xml +++ b/sdk/security/azure-resourcemanager-security/pom.xml @@ -1,9 +1,9 @@ - + 4.0.0 com.azure @@ -18,7 +18,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. jar Microsoft Azure SDK for Security Management - This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3. + This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) alerts resource provider. Package api-version AlertsAPI: 2022-01-01, AlertsSuppressionRulesAPI: 2019-01-01-preview, ApiCollectionsAPI: 2023-11-15, ApplicationsAPI: 2022-07-01-preview, AssessmentAPI: 2025-05-04, ATPSettingsAPI: 2019-01-01, AutomationsAPI: 2023-12-01-preview, ComplianceResultsAPI: 2017-08-01, DefenderForStorageAPI: 2025-09-01-preview, GovernanceAPI: 2022-01-01-preview, HealthReportsAPI: 2023-05-01-preview, IoTSecurityAPI: 2019-08-01, LegacySettingsAPI: 2017-08-01-preview, LocationsAPI: 2015-06-01-preview, MdeOnboardingAPI: 2021-10-01-preview, OperationsAPI: 2025-10-01-preview, PricingsAPI: 2024-01-01, PrivateLinksAPI: 2026-01-01, RegulatoryComplianceAPI: 2019-01-01-preview, SecureScoreAPI: 2020-01-01, SecurityConnectorsAPI: 2024-08-01-preview, SecurityConnectorsDevOpsAPI: 2025-11-01-preview, SecurityOperatorsAPI: 2023-01-01-preview, SecuritySolutionsAPI: 2020-01-01, SecurityStandardsAPI: 2024-08-01, SensitivitySettingsAPI: 2023-02-15-preview, ServerVulnerabilityAssessmentsSettingsAPI: 2023-05-01, SettingsAPI: 2022-05-01, SqlVulnerabilityAssessmentsAPI: 2026-04-01-preview, StandardsAPI: 2021-08-01-preview, SubAssessmentsAPI: 2019-01-01-preview, TasksAPI: 2015-06-01-preview. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. UTF-8 0 0 - false + true 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 789920837802..ed3f01dc243e 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security; @@ -22,92 +22,234 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecurityCenter; import com.azure.resourcemanager.security.implementation.AdvancedThreatProtectionsImpl; import com.azure.resourcemanager.security.implementation.AlertsImpl; +import com.azure.resourcemanager.security.implementation.AlertsSuppressionRulesImpl; import com.azure.resourcemanager.security.implementation.AllowedConnectionsImpl; import com.azure.resourcemanager.security.implementation.ApiCollectionsImpl; +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.AssignmentsImpl; +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; import com.azure.resourcemanager.security.implementation.ComplianceResultsImpl; +import com.azure.resourcemanager.security.implementation.CompliancesImpl; import com.azure.resourcemanager.security.implementation.CustomRecommendationsImpl; +import com.azure.resourcemanager.security.implementation.DefenderForStoragesImpl; +import com.azure.resourcemanager.security.implementation.DevOpsConfigurationsImpl; +import com.azure.resourcemanager.security.implementation.DevOpsOperationResultsImpl; 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.GitHubIssuesImpl; +import com.azure.resourcemanager.security.implementation.GitHubOwnersImpl; +import com.azure.resourcemanager.security.implementation.GitHubReposImpl; +import com.azure.resourcemanager.security.implementation.GitLabGroupsImpl; +import com.azure.resourcemanager.security.implementation.GitLabProjectsImpl; +import com.azure.resourcemanager.security.implementation.GitLabSubgroupsImpl; +import com.azure.resourcemanager.security.implementation.GovernanceAssignmentsImpl; +import com.azure.resourcemanager.security.implementation.GovernanceRulesImpl; +import com.azure.resourcemanager.security.implementation.HealthReportsImpl; +import com.azure.resourcemanager.security.implementation.InformationProtectionPoliciesImpl; import com.azure.resourcemanager.security.implementation.IotSecuritySolutionAnalyticsImpl; import com.azure.resourcemanager.security.implementation.IotSecuritySolutionsAnalyticsAggregatedAlertsImpl; import com.azure.resourcemanager.security.implementation.IotSecuritySolutionsAnalyticsRecommendationsImpl; import com.azure.resourcemanager.security.implementation.IotSecuritySolutionsImpl; import com.azure.resourcemanager.security.implementation.JitNetworkAccessPoliciesImpl; +import com.azure.resourcemanager.security.implementation.LocationsImpl; +import com.azure.resourcemanager.security.implementation.MdeOnboardingsImpl; +import com.azure.resourcemanager.security.implementation.OperationResultsImpl; +import com.azure.resourcemanager.security.implementation.OperationStatusesImpl; +import com.azure.resourcemanager.security.implementation.OperationsImpl; import com.azure.resourcemanager.security.implementation.PricingsImpl; +import com.azure.resourcemanager.security.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.security.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.security.implementation.PrivateLinksImpl; +import com.azure.resourcemanager.security.implementation.RegulatoryComplianceAssessmentsImpl; +import com.azure.resourcemanager.security.implementation.RegulatoryComplianceControlsImpl; +import com.azure.resourcemanager.security.implementation.RegulatoryComplianceStandardsImpl; import com.azure.resourcemanager.security.implementation.SecureScoreControlDefinitionsImpl; import com.azure.resourcemanager.security.implementation.SecureScoreControlsImpl; import com.azure.resourcemanager.security.implementation.SecureScoresImpl; import com.azure.resourcemanager.security.implementation.SecurityCenterBuilder; +import com.azure.resourcemanager.security.implementation.SecurityConnectorApplicationsImpl; +import com.azure.resourcemanager.security.implementation.SecurityConnectorsImpl; +import com.azure.resourcemanager.security.implementation.SecurityContactsImpl; +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; import com.azure.resourcemanager.security.implementation.SettingsImpl; +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.SqlVulnerabilityAssessmentSettingsOperationsImpl; import com.azure.resourcemanager.security.implementation.StandardAssignmentsImpl; +import com.azure.resourcemanager.security.implementation.StandardsImpl; +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.AdvancedThreatProtections; import com.azure.resourcemanager.security.models.Alerts; +import com.azure.resourcemanager.security.models.AlertsSuppressionRules; import com.azure.resourcemanager.security.models.AllowedConnections; import com.azure.resourcemanager.security.models.ApiCollections; +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.Assignments; +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; import com.azure.resourcemanager.security.models.ComplianceResults; +import com.azure.resourcemanager.security.models.Compliances; import com.azure.resourcemanager.security.models.CustomRecommendations; +import com.azure.resourcemanager.security.models.DefenderForStorages; +import com.azure.resourcemanager.security.models.DevOpsConfigurations; +import com.azure.resourcemanager.security.models.DevOpsOperationResults; 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.GitHubIssues; +import com.azure.resourcemanager.security.models.GitHubOwners; +import com.azure.resourcemanager.security.models.GitHubRepos; +import com.azure.resourcemanager.security.models.GitLabGroups; +import com.azure.resourcemanager.security.models.GitLabProjects; +import com.azure.resourcemanager.security.models.GitLabSubgroups; +import com.azure.resourcemanager.security.models.GovernanceAssignments; +import com.azure.resourcemanager.security.models.GovernanceRules; +import com.azure.resourcemanager.security.models.HealthReports; +import com.azure.resourcemanager.security.models.InformationProtectionPolicies; import com.azure.resourcemanager.security.models.IotSecuritySolutionAnalytics; import com.azure.resourcemanager.security.models.IotSecuritySolutions; import com.azure.resourcemanager.security.models.IotSecuritySolutionsAnalyticsAggregatedAlerts; import com.azure.resourcemanager.security.models.IotSecuritySolutionsAnalyticsRecommendations; import com.azure.resourcemanager.security.models.JitNetworkAccessPolicies; +import com.azure.resourcemanager.security.models.Locations; +import com.azure.resourcemanager.security.models.MdeOnboardings; +import com.azure.resourcemanager.security.models.OperationResults; +import com.azure.resourcemanager.security.models.OperationStatuses; +import com.azure.resourcemanager.security.models.Operations; import com.azure.resourcemanager.security.models.Pricings; +import com.azure.resourcemanager.security.models.PrivateEndpointConnections; +import com.azure.resourcemanager.security.models.PrivateLinkResources; +import com.azure.resourcemanager.security.models.PrivateLinks; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessments; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControls; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandards; import com.azure.resourcemanager.security.models.SecureScoreControlDefinitions; import com.azure.resourcemanager.security.models.SecureScoreControls; import com.azure.resourcemanager.security.models.SecureScores; +import com.azure.resourcemanager.security.models.SecurityConnectorApplications; +import com.azure.resourcemanager.security.models.SecurityConnectors; +import com.azure.resourcemanager.security.models.SecurityContacts; +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; import com.azure.resourcemanager.security.models.Settings; +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.SqlVulnerabilityAssessmentSettingsOperations; import com.azure.resourcemanager.security.models.StandardAssignments; +import com.azure.resourcemanager.security.models.Standards; +import com.azure.resourcemanager.security.models.SubAssessments; +import com.azure.resourcemanager.security.models.Tasks; import com.azure.resourcemanager.security.models.Topologies; +import com.azure.resourcemanager.security.models.WorkspaceSettings; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; /** * Entry point to SecurityManager. - * API spec for Microsoft.Security (Azure Security Center) resource provider. + * API spec for Microsoft.Security (Azure Security Center) alerts resource provider. */ public final class SecurityManager { + private Alerts alerts; + + private AlertsSuppressionRules alertsSuppressionRules; + + private ApiCollections apiCollections; + + private Applications applications; + + private AssessmentsMetadatas assessmentsMetadatas; + + private Automations automations; + + private SecurityContacts securityContacts; + private ComplianceResults complianceResults; - private AdvancedThreatProtections advancedThreatProtections; + private GovernanceAssignments governanceAssignments; + + private GovernanceRules governanceRules; + + private HealthReports healthReports; private DeviceSecurityGroups deviceSecurityGroups; - private IotSecuritySolutionAnalytics iotSecuritySolutionAnalytics; + private AutoProvisioningSettings autoProvisioningSettings; - private IotSecuritySolutionsAnalyticsAggregatedAlerts iotSecuritySolutionsAnalyticsAggregatedAlerts; + private Compliances compliances; - private IotSecuritySolutionsAnalyticsRecommendations iotSecuritySolutionsAnalyticsRecommendations; + private InformationProtectionPolicies informationProtectionPolicies; - private IotSecuritySolutions iotSecuritySolutions; + private WorkspaceSettings workspaceSettings; - private AllowedConnections allowedConnections; + private MdeOnboardings mdeOnboardings; + + private Operations operations; + + private Pricings pricings; + + private PrivateLinkResources privateLinkResources; + + private PrivateEndpointConnections privateEndpointConnections; + + private RegulatoryComplianceStandards regulatoryComplianceStandards; + + private RegulatoryComplianceControls regulatoryComplianceControls; + + private RegulatoryComplianceAssessments regulatoryComplianceAssessments; + + private SecurityConnectors securityConnectors; + + private AzureDevOpsOrgs azureDevOpsOrgs; + + private GitHubOwners gitHubOwners; + + private GitLabGroups gitLabGroups; + + private DevOpsConfigurations devOpsConfigurations; + + private AzureDevOpsProjects azureDevOpsProjects; + + private GitLabProjects gitLabProjects; + + private SecurityOperators securityOperators; private DiscoveredSecuritySolutions discoveredSecuritySolutions; @@ -115,39 +257,83 @@ public final class SecurityManager { private JitNetworkAccessPolicies jitNetworkAccessPolicies; + private SecuritySolutions securitySolutions; + + private SecurityStandards securityStandards; + + private StandardAssignments standardAssignments; + + private CustomRecommendations customRecommendations; + + private ServerVulnerabilityAssessmentsSettings serverVulnerabilityAssessmentsSettings; + + private Settings settings; + + private SqlVulnerabilityAssessmentBaselineRules sqlVulnerabilityAssessmentBaselineRules; + + private SqlVulnerabilityAssessmentScanResults sqlVulnerabilityAssessmentScanResults; + + private Standards standards; + + private Assignments assignments; + + private Tasks tasks; + + private SecurityConnectorApplications securityConnectorApplications; + + private Assessments assessments; + + private AdvancedThreatProtections advancedThreatProtections; + + private DefenderForStorages defenderForStorages; + + private IotSecuritySolutionAnalytics iotSecuritySolutionAnalytics; + + private IotSecuritySolutions iotSecuritySolutions; + + private IotSecuritySolutionsAnalyticsAggregatedAlerts iotSecuritySolutionsAnalyticsAggregatedAlerts; + + private IotSecuritySolutionsAnalyticsRecommendations iotSecuritySolutionsAnalyticsRecommendations; + + private Locations locations; + + private OperationResults operationResults; + + private OperationStatuses operationStatuses; + + private PrivateLinks privateLinks; + private SecureScores secureScores; private SecureScoreControls secureScoreControls; private SecureScoreControlDefinitions secureScoreControlDefinitions; - private SecuritySolutions securitySolutions; - - private SecuritySolutionsReferenceDatas securitySolutionsReferenceDatas; + private GitLabSubgroups gitLabSubgroups; - private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + private DevOpsOperationResults devOpsOperationResults; - private Topologies topologies; + private AzureDevOpsRepos azureDevOpsRepos; - private AssessmentsMetadatas assessmentsMetadatas; + private GitHubRepos gitHubRepos; - private Assessments assessments; + private GitHubIssues gitHubIssues; - private Alerts alerts; + private AllowedConnections allowedConnections; - private Settings settings; + private ServerVulnerabilityAssessments serverVulnerabilityAssessments; - private ServerVulnerabilityAssessmentsSettings serverVulnerabilityAssessmentsSettings; + private Topologies topologies; - private ApiCollections apiCollections; + private SecuritySolutionsReferenceDatas securitySolutionsReferenceDatas; - private Pricings pricings; + private SensitivitySettings sensitivitySettings; - private SecurityStandards securityStandards; + private SqlVulnerabilityAssessmentSettingsOperations sqlVulnerabilityAssessmentSettingsOperations; - private StandardAssignments standardAssignments; + private SqlVulnerabilityAssessmentScans sqlVulnerabilityAssessmentScans; - private CustomRecommendations customRecommendations; + private SubAssessments subAssessments; private final SecurityCenter clientObject; @@ -201,6 +387,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-security.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -308,12 +497,14 @@ public SecurityManager authenticate(TokenCredential credential, AzureProfile pro Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.security") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -360,314 +551,445 @@ public SecurityManager authenticate(TokenCredential credential, AzureProfile pro } /** - * Gets the resource collection API of ComplianceResults. + * Gets the resource collection API of Alerts. * - * @return Resource collection API of ComplianceResults. + * @return Resource collection API of Alerts. */ - public ComplianceResults complianceResults() { - if (this.complianceResults == null) { - this.complianceResults = new ComplianceResultsImpl(clientObject.getComplianceResults(), this); + public Alerts alerts() { + if (this.alerts == null) { + this.alerts = new AlertsImpl(clientObject.getAlerts(), this); } - return complianceResults; + return alerts; } /** - * Gets the resource collection API of AdvancedThreatProtections. It manages AdvancedThreatProtectionSetting. + * Gets the resource collection API of AlertsSuppressionRules. * - * @return Resource collection API of AdvancedThreatProtections. + * @return Resource collection API of AlertsSuppressionRules. */ - public AdvancedThreatProtections advancedThreatProtections() { - if (this.advancedThreatProtections == null) { - this.advancedThreatProtections - = new AdvancedThreatProtectionsImpl(clientObject.getAdvancedThreatProtections(), this); + public AlertsSuppressionRules alertsSuppressionRules() { + if (this.alertsSuppressionRules == null) { + this.alertsSuppressionRules + = new AlertsSuppressionRulesImpl(clientObject.getAlertsSuppressionRules(), this); } - return advancedThreatProtections; + return alertsSuppressionRules; } /** - * Gets the resource collection API of DeviceSecurityGroups. It manages DeviceSecurityGroup. + * Gets the resource collection API of ApiCollections. * - * @return Resource collection API of DeviceSecurityGroups. + * @return Resource collection API of ApiCollections. */ - public DeviceSecurityGroups deviceSecurityGroups() { - if (this.deviceSecurityGroups == null) { - this.deviceSecurityGroups = new DeviceSecurityGroupsImpl(clientObject.getDeviceSecurityGroups(), this); + public ApiCollections apiCollections() { + if (this.apiCollections == null) { + this.apiCollections = new ApiCollectionsImpl(clientObject.getApiCollections(), this); } - return deviceSecurityGroups; + return apiCollections; } /** - * Gets the resource collection API of IotSecuritySolutionAnalytics. + * Gets the resource collection API of Applications. It manages Application. * - * @return Resource collection API of IotSecuritySolutionAnalytics. + * @return Resource collection API of Applications. */ - public IotSecuritySolutionAnalytics iotSecuritySolutionAnalytics() { - if (this.iotSecuritySolutionAnalytics == null) { - this.iotSecuritySolutionAnalytics - = new IotSecuritySolutionAnalyticsImpl(clientObject.getIotSecuritySolutionAnalytics(), this); + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); } - return iotSecuritySolutionAnalytics; + return applications; } /** - * Gets the resource collection API of IotSecuritySolutionsAnalyticsAggregatedAlerts. + * Gets the resource collection API of AssessmentsMetadatas. It manages SecurityAssessmentMetadataResponse. * - * @return Resource collection API of IotSecuritySolutionsAnalyticsAggregatedAlerts. + * @return Resource collection API of AssessmentsMetadatas. */ - public IotSecuritySolutionsAnalyticsAggregatedAlerts iotSecuritySolutionsAnalyticsAggregatedAlerts() { - if (this.iotSecuritySolutionsAnalyticsAggregatedAlerts == null) { - this.iotSecuritySolutionsAnalyticsAggregatedAlerts = new IotSecuritySolutionsAnalyticsAggregatedAlertsImpl( - clientObject.getIotSecuritySolutionsAnalyticsAggregatedAlerts(), this); + public AssessmentsMetadatas assessmentsMetadatas() { + if (this.assessmentsMetadatas == null) { + this.assessmentsMetadatas = new AssessmentsMetadatasImpl(clientObject.getAssessmentsMetadatas(), this); } - return iotSecuritySolutionsAnalyticsAggregatedAlerts; + return assessmentsMetadatas; } /** - * Gets the resource collection API of IotSecuritySolutionsAnalyticsRecommendations. + * Gets the resource collection API of Automations. It manages Automation. * - * @return Resource collection API of IotSecuritySolutionsAnalyticsRecommendations. + * @return Resource collection API of Automations. */ - public IotSecuritySolutionsAnalyticsRecommendations iotSecuritySolutionsAnalyticsRecommendations() { - if (this.iotSecuritySolutionsAnalyticsRecommendations == null) { - this.iotSecuritySolutionsAnalyticsRecommendations = new IotSecuritySolutionsAnalyticsRecommendationsImpl( - clientObject.getIotSecuritySolutionsAnalyticsRecommendations(), this); + public Automations automations() { + if (this.automations == null) { + this.automations = new AutomationsImpl(clientObject.getAutomations(), this); } - return iotSecuritySolutionsAnalyticsRecommendations; + return automations; } /** - * Gets the resource collection API of IotSecuritySolutions. It manages IoTSecuritySolutionModel. + * Gets the resource collection API of SecurityContacts. It manages SecurityContact. * - * @return Resource collection API of IotSecuritySolutions. + * @return Resource collection API of SecurityContacts. */ - public IotSecuritySolutions iotSecuritySolutions() { - if (this.iotSecuritySolutions == null) { - this.iotSecuritySolutions = new IotSecuritySolutionsImpl(clientObject.getIotSecuritySolutions(), this); + public SecurityContacts securityContacts() { + if (this.securityContacts == null) { + this.securityContacts = new SecurityContactsImpl(clientObject.getSecurityContacts(), this); } - return iotSecuritySolutions; + return securityContacts; } /** - * Gets the resource collection API of AllowedConnections. + * Gets the resource collection API of ComplianceResults. * - * @return Resource collection API of AllowedConnections. + * @return Resource collection API of ComplianceResults. */ - public AllowedConnections allowedConnections() { - if (this.allowedConnections == null) { - this.allowedConnections = new AllowedConnectionsImpl(clientObject.getAllowedConnections(), this); + public ComplianceResults complianceResults() { + if (this.complianceResults == null) { + this.complianceResults = new ComplianceResultsImpl(clientObject.getComplianceResults(), this); } - return allowedConnections; + return complianceResults; } /** - * Gets the resource collection API of DiscoveredSecuritySolutions. + * Gets the resource collection API of GovernanceAssignments. It manages GovernanceAssignment. * - * @return Resource collection API of DiscoveredSecuritySolutions. + * @return Resource collection API of GovernanceAssignments. */ - public DiscoveredSecuritySolutions discoveredSecuritySolutions() { - if (this.discoveredSecuritySolutions == null) { - this.discoveredSecuritySolutions - = new DiscoveredSecuritySolutionsImpl(clientObject.getDiscoveredSecuritySolutions(), this); + public GovernanceAssignments governanceAssignments() { + if (this.governanceAssignments == null) { + this.governanceAssignments = new GovernanceAssignmentsImpl(clientObject.getGovernanceAssignments(), this); } - return discoveredSecuritySolutions; + return governanceAssignments; } /** - * Gets the resource collection API of ExternalSecuritySolutions. + * Gets the resource collection API of GovernanceRules. It manages GovernanceRule. * - * @return Resource collection API of ExternalSecuritySolutions. + * @return Resource collection API of GovernanceRules. */ - public ExternalSecuritySolutions externalSecuritySolutions() { - if (this.externalSecuritySolutions == null) { - this.externalSecuritySolutions - = new ExternalSecuritySolutionsImpl(clientObject.getExternalSecuritySolutions(), this); + public GovernanceRules governanceRules() { + if (this.governanceRules == null) { + this.governanceRules = new GovernanceRulesImpl(clientObject.getGovernanceRules(), this); } - return externalSecuritySolutions; + return governanceRules; } /** - * Gets the resource collection API of JitNetworkAccessPolicies. It manages JitNetworkAccessPolicy. + * Gets the resource collection API of HealthReports. * - * @return Resource collection API of JitNetworkAccessPolicies. + * @return Resource collection API of HealthReports. */ - public JitNetworkAccessPolicies jitNetworkAccessPolicies() { - if (this.jitNetworkAccessPolicies == null) { - this.jitNetworkAccessPolicies - = new JitNetworkAccessPoliciesImpl(clientObject.getJitNetworkAccessPolicies(), this); + public HealthReports healthReports() { + if (this.healthReports == null) { + this.healthReports = new HealthReportsImpl(clientObject.getHealthReports(), this); } - return jitNetworkAccessPolicies; + return healthReports; } /** - * Gets the resource collection API of SecureScores. + * Gets the resource collection API of DeviceSecurityGroups. It manages DeviceSecurityGroup. * - * @return Resource collection API of SecureScores. + * @return Resource collection API of DeviceSecurityGroups. */ - public SecureScores secureScores() { - if (this.secureScores == null) { - this.secureScores = new SecureScoresImpl(clientObject.getSecureScores(), this); + public DeviceSecurityGroups deviceSecurityGroups() { + if (this.deviceSecurityGroups == null) { + this.deviceSecurityGroups = new DeviceSecurityGroupsImpl(clientObject.getDeviceSecurityGroups(), this); } - return secureScores; + return deviceSecurityGroups; } /** - * Gets the resource collection API of SecureScoreControls. + * Gets the resource collection API of AutoProvisioningSettings. It manages AutoProvisioningSetting. * - * @return Resource collection API of SecureScoreControls. + * @return Resource collection API of AutoProvisioningSettings. */ - public SecureScoreControls secureScoreControls() { - if (this.secureScoreControls == null) { - this.secureScoreControls = new SecureScoreControlsImpl(clientObject.getSecureScoreControls(), this); + public AutoProvisioningSettings autoProvisioningSettings() { + if (this.autoProvisioningSettings == null) { + this.autoProvisioningSettings + = new AutoProvisioningSettingsImpl(clientObject.getAutoProvisioningSettings(), this); } - return secureScoreControls; + return autoProvisioningSettings; } /** - * Gets the resource collection API of SecureScoreControlDefinitions. + * Gets the resource collection API of Compliances. * - * @return Resource collection API of SecureScoreControlDefinitions. + * @return Resource collection API of Compliances. */ - public SecureScoreControlDefinitions secureScoreControlDefinitions() { - if (this.secureScoreControlDefinitions == null) { - this.secureScoreControlDefinitions - = new SecureScoreControlDefinitionsImpl(clientObject.getSecureScoreControlDefinitions(), this); + public Compliances compliances() { + if (this.compliances == null) { + this.compliances = new CompliancesImpl(clientObject.getCompliances(), this); } - return secureScoreControlDefinitions; + return compliances; } /** - * Gets the resource collection API of SecuritySolutions. + * Gets the resource collection API of InformationProtectionPolicies. It manages InformationProtectionPolicy. * - * @return Resource collection API of SecuritySolutions. + * @return Resource collection API of InformationProtectionPolicies. */ - public SecuritySolutions securitySolutions() { - if (this.securitySolutions == null) { - this.securitySolutions = new SecuritySolutionsImpl(clientObject.getSecuritySolutions(), this); + public InformationProtectionPolicies informationProtectionPolicies() { + if (this.informationProtectionPolicies == null) { + this.informationProtectionPolicies + = new InformationProtectionPoliciesImpl(clientObject.getInformationProtectionPolicies(), this); } - return securitySolutions; + return informationProtectionPolicies; } /** - * Gets the resource collection API of SecuritySolutionsReferenceDatas. + * Gets the resource collection API of WorkspaceSettings. It manages WorkspaceSetting. * - * @return Resource collection API of SecuritySolutionsReferenceDatas. + * @return Resource collection API of WorkspaceSettings. */ - public SecuritySolutionsReferenceDatas securitySolutionsReferenceDatas() { - if (this.securitySolutionsReferenceDatas == null) { - this.securitySolutionsReferenceDatas - = new SecuritySolutionsReferenceDatasImpl(clientObject.getSecuritySolutionsReferenceDatas(), this); + public WorkspaceSettings workspaceSettings() { + if (this.workspaceSettings == null) { + this.workspaceSettings = new WorkspaceSettingsImpl(clientObject.getWorkspaceSettings(), this); } - return securitySolutionsReferenceDatas; + return workspaceSettings; } /** - * Gets the resource collection API of ServerVulnerabilityAssessments. + * Gets the resource collection API of MdeOnboardings. * - * @return Resource collection API of ServerVulnerabilityAssessments. + * @return Resource collection API of MdeOnboardings. */ - public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { - if (this.serverVulnerabilityAssessments == null) { - this.serverVulnerabilityAssessments - = new ServerVulnerabilityAssessmentsImpl(clientObject.getServerVulnerabilityAssessments(), this); + public MdeOnboardings mdeOnboardings() { + if (this.mdeOnboardings == null) { + this.mdeOnboardings = new MdeOnboardingsImpl(clientObject.getMdeOnboardings(), this); } - return serverVulnerabilityAssessments; + return mdeOnboardings; } /** - * Gets the resource collection API of Topologies. + * Gets the resource collection API of Operations. * - * @return Resource collection API of Topologies. + * @return Resource collection API of Operations. */ - public Topologies topologies() { - if (this.topologies == null) { - this.topologies = new TopologiesImpl(clientObject.getTopologies(), this); + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); } - return topologies; + return operations; } /** - * Gets the resource collection API of AssessmentsMetadatas. It manages SecurityAssessmentMetadataResponse. + * Gets the resource collection API of Pricings. * - * @return Resource collection API of AssessmentsMetadatas. + * @return Resource collection API of Pricings. */ - public AssessmentsMetadatas assessmentsMetadatas() { - if (this.assessmentsMetadatas == null) { - this.assessmentsMetadatas = new AssessmentsMetadatasImpl(clientObject.getAssessmentsMetadatas(), this); + public Pricings pricings() { + if (this.pricings == null) { + this.pricings = new PricingsImpl(clientObject.getPricings(), this); } - return assessmentsMetadatas; + return pricings; } /** - * Gets the resource collection API of Assessments. It manages SecurityAssessmentResponse. + * Gets the resource collection API of PrivateLinkResources. * - * @return Resource collection API of Assessments. + * @return Resource collection API of PrivateLinkResources. */ - public Assessments assessments() { - if (this.assessments == null) { - this.assessments = new AssessmentsImpl(clientObject.getAssessments(), this); + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); } - return assessments; + return privateLinkResources; } /** - * Gets the resource collection API of Alerts. + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection. * - * @return Resource collection API of Alerts. + * @return Resource collection API of PrivateEndpointConnections. */ - public Alerts alerts() { - if (this.alerts == null) { - this.alerts = new AlertsImpl(clientObject.getAlerts(), this); + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections + = new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); } - return alerts; + return privateEndpointConnections; } /** - * Gets the resource collection API of Settings. + * Gets the resource collection API of RegulatoryComplianceStandards. * - * @return Resource collection API of Settings. + * @return Resource collection API of RegulatoryComplianceStandards. */ - public Settings settings() { - if (this.settings == null) { - this.settings = new SettingsImpl(clientObject.getSettings(), this); + public RegulatoryComplianceStandards regulatoryComplianceStandards() { + if (this.regulatoryComplianceStandards == null) { + this.regulatoryComplianceStandards + = new RegulatoryComplianceStandardsImpl(clientObject.getRegulatoryComplianceStandards(), this); } - return settings; + return regulatoryComplianceStandards; } /** - * Gets the resource collection API of ServerVulnerabilityAssessmentsSettings. + * Gets the resource collection API of RegulatoryComplianceControls. * - * @return Resource collection API of ServerVulnerabilityAssessmentsSettings. + * @return Resource collection API of RegulatoryComplianceControls. */ - public ServerVulnerabilityAssessmentsSettings serverVulnerabilityAssessmentsSettings() { - if (this.serverVulnerabilityAssessmentsSettings == null) { - this.serverVulnerabilityAssessmentsSettings = new ServerVulnerabilityAssessmentsSettingsImpl( - clientObject.getServerVulnerabilityAssessmentsSettings(), this); + public RegulatoryComplianceControls regulatoryComplianceControls() { + if (this.regulatoryComplianceControls == null) { + this.regulatoryComplianceControls + = new RegulatoryComplianceControlsImpl(clientObject.getRegulatoryComplianceControls(), this); } - return serverVulnerabilityAssessmentsSettings; + return regulatoryComplianceControls; } /** - * Gets the resource collection API of ApiCollections. + * Gets the resource collection API of RegulatoryComplianceAssessments. * - * @return Resource collection API of ApiCollections. + * @return Resource collection API of RegulatoryComplianceAssessments. */ - public ApiCollections apiCollections() { - if (this.apiCollections == null) { - this.apiCollections = new ApiCollectionsImpl(clientObject.getApiCollections(), this); + public RegulatoryComplianceAssessments regulatoryComplianceAssessments() { + if (this.regulatoryComplianceAssessments == null) { + this.regulatoryComplianceAssessments + = new RegulatoryComplianceAssessmentsImpl(clientObject.getRegulatoryComplianceAssessments(), this); } - return apiCollections; + return regulatoryComplianceAssessments; } /** - * Gets the resource collection API of Pricings. + * Gets the resource collection API of SecurityConnectors. It manages SecurityConnector. * - * @return Resource collection API of Pricings. + * @return Resource collection API of SecurityConnectors. */ - public Pricings pricings() { - if (this.pricings == null) { - this.pricings = new PricingsImpl(clientObject.getPricings(), this); + public SecurityConnectors securityConnectors() { + if (this.securityConnectors == null) { + this.securityConnectors = new SecurityConnectorsImpl(clientObject.getSecurityConnectors(), this); } - return pricings; + 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 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 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 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 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 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 SecurityOperators. + * + * @return Resource collection API of SecurityOperators. + */ + public SecurityOperators securityOperators() { + if (this.securityOperators == null) { + this.securityOperators = new SecurityOperatorsImpl(clientObject.getSecurityOperators(), this); + } + return securityOperators; + } + + /** + * Gets the resource collection API of DiscoveredSecuritySolutions. + * + * @return Resource collection API of DiscoveredSecuritySolutions. + */ + public DiscoveredSecuritySolutions discoveredSecuritySolutions() { + if (this.discoveredSecuritySolutions == null) { + this.discoveredSecuritySolutions + = new DiscoveredSecuritySolutionsImpl(clientObject.getDiscoveredSecuritySolutions(), this); + } + return discoveredSecuritySolutions; + } + + /** + * Gets the resource collection API of ExternalSecuritySolutions. + * + * @return Resource collection API of ExternalSecuritySolutions. + */ + public ExternalSecuritySolutions externalSecuritySolutions() { + if (this.externalSecuritySolutions == null) { + this.externalSecuritySolutions + = new ExternalSecuritySolutionsImpl(clientObject.getExternalSecuritySolutions(), this); + } + return externalSecuritySolutions; + } + + /** + * Gets the resource collection API of JitNetworkAccessPolicies. It manages JitNetworkAccessPolicy. + * + * @return Resource collection API of JitNetworkAccessPolicies. + */ + public JitNetworkAccessPolicies jitNetworkAccessPolicies() { + if (this.jitNetworkAccessPolicies == null) { + this.jitNetworkAccessPolicies + = new JitNetworkAccessPoliciesImpl(clientObject.getJitNetworkAccessPolicies(), this); + } + return jitNetworkAccessPolicies; + } + + /** + * Gets the resource collection API of SecuritySolutions. + * + * @return Resource collection API of SecuritySolutions. + */ + public SecuritySolutions securitySolutions() { + if (this.securitySolutions == null) { + this.securitySolutions = new SecuritySolutionsImpl(clientObject.getSecuritySolutions(), this); + } + return securitySolutions; } /** @@ -706,6 +1028,440 @@ public CustomRecommendations customRecommendations() { return customRecommendations; } + /** + * Gets the resource collection API of ServerVulnerabilityAssessmentsSettings. + * + * @return Resource collection API of ServerVulnerabilityAssessmentsSettings. + */ + public ServerVulnerabilityAssessmentsSettings serverVulnerabilityAssessmentsSettings() { + if (this.serverVulnerabilityAssessmentsSettings == null) { + this.serverVulnerabilityAssessmentsSettings = new ServerVulnerabilityAssessmentsSettingsImpl( + clientObject.getServerVulnerabilityAssessmentsSettings(), this); + } + return serverVulnerabilityAssessmentsSettings; + } + + /** + * Gets the resource collection API of Settings. + * + * @return Resource collection API of Settings. + */ + public Settings settings() { + if (this.settings == null) { + this.settings = new SettingsImpl(clientObject.getSettings(), this); + } + return settings; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentBaselineRules. It manages RuleResults. + * + * @return Resource collection API of SqlVulnerabilityAssessmentBaselineRules. + */ + public SqlVulnerabilityAssessmentBaselineRules sqlVulnerabilityAssessmentBaselineRules() { + if (this.sqlVulnerabilityAssessmentBaselineRules == null) { + this.sqlVulnerabilityAssessmentBaselineRules = new SqlVulnerabilityAssessmentBaselineRulesImpl( + clientObject.getSqlVulnerabilityAssessmentBaselineRules(), this); + } + return sqlVulnerabilityAssessmentBaselineRules; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentScanResults. + * + * @return Resource collection API of SqlVulnerabilityAssessmentScanResults. + */ + public SqlVulnerabilityAssessmentScanResults sqlVulnerabilityAssessmentScanResults() { + if (this.sqlVulnerabilityAssessmentScanResults == null) { + this.sqlVulnerabilityAssessmentScanResults = new SqlVulnerabilityAssessmentScanResultsImpl( + clientObject.getSqlVulnerabilityAssessmentScanResults(), this); + } + return sqlVulnerabilityAssessmentScanResults; + } + + /** + * Gets the resource collection API of Standards. It manages Standard. + * + * @return Resource collection API of Standards. + */ + public Standards standards() { + if (this.standards == null) { + this.standards = new StandardsImpl(clientObject.getStandards(), this); + } + return standards; + } + + /** + * Gets the resource collection API of Assignments. It manages Assignment. + * + * @return Resource collection API of Assignments. + */ + public Assignments assignments() { + if (this.assignments == null) { + this.assignments = new AssignmentsImpl(clientObject.getAssignments(), this); + } + return assignments; + } + + /** + * Gets the resource collection API of Tasks. + * + * @return Resource collection API of Tasks. + */ + public Tasks tasks() { + if (this.tasks == null) { + this.tasks = new TasksImpl(clientObject.getTasks(), this); + } + return tasks; + } + + /** + * Gets the resource collection API of SecurityConnectorApplications. + * + * @return Resource collection API of SecurityConnectorApplications. + */ + public SecurityConnectorApplications securityConnectorApplications() { + if (this.securityConnectorApplications == null) { + this.securityConnectorApplications + = new SecurityConnectorApplicationsImpl(clientObject.getSecurityConnectorApplications(), this); + } + return securityConnectorApplications; + } + + /** + * Gets the resource collection API of Assessments. It manages SecurityAssessmentResponse. + * + * @return Resource collection API of Assessments. + */ + public Assessments assessments() { + if (this.assessments == null) { + this.assessments = new AssessmentsImpl(clientObject.getAssessments(), this); + } + return assessments; + } + + /** + * Gets the resource collection API of AdvancedThreatProtections. It manages AdvancedThreatProtectionSetting. + * + * @return Resource collection API of AdvancedThreatProtections. + */ + public AdvancedThreatProtections advancedThreatProtections() { + if (this.advancedThreatProtections == null) { + this.advancedThreatProtections + = new AdvancedThreatProtectionsImpl(clientObject.getAdvancedThreatProtections(), this); + } + return advancedThreatProtections; + } + + /** + * Gets the resource collection API of DefenderForStorages. It manages DefenderForStorageSetting. + * + * @return Resource collection API of DefenderForStorages. + */ + public DefenderForStorages defenderForStorages() { + if (this.defenderForStorages == null) { + this.defenderForStorages = new DefenderForStoragesImpl(clientObject.getDefenderForStorages(), this); + } + return defenderForStorages; + } + + /** + * Gets the resource collection API of IotSecuritySolutionAnalytics. + * + * @return Resource collection API of IotSecuritySolutionAnalytics. + */ + public IotSecuritySolutionAnalytics iotSecuritySolutionAnalytics() { + if (this.iotSecuritySolutionAnalytics == null) { + this.iotSecuritySolutionAnalytics + = new IotSecuritySolutionAnalyticsImpl(clientObject.getIotSecuritySolutionAnalytics(), this); + } + return iotSecuritySolutionAnalytics; + } + + /** + * Gets the resource collection API of IotSecuritySolutions. It manages IoTSecuritySolutionModel. + * + * @return Resource collection API of IotSecuritySolutions. + */ + public IotSecuritySolutions iotSecuritySolutions() { + if (this.iotSecuritySolutions == null) { + this.iotSecuritySolutions = new IotSecuritySolutionsImpl(clientObject.getIotSecuritySolutions(), this); + } + return iotSecuritySolutions; + } + + /** + * Gets the resource collection API of IotSecuritySolutionsAnalyticsAggregatedAlerts. + * + * @return Resource collection API of IotSecuritySolutionsAnalyticsAggregatedAlerts. + */ + public IotSecuritySolutionsAnalyticsAggregatedAlerts iotSecuritySolutionsAnalyticsAggregatedAlerts() { + if (this.iotSecuritySolutionsAnalyticsAggregatedAlerts == null) { + this.iotSecuritySolutionsAnalyticsAggregatedAlerts = new IotSecuritySolutionsAnalyticsAggregatedAlertsImpl( + clientObject.getIotSecuritySolutionsAnalyticsAggregatedAlerts(), this); + } + return iotSecuritySolutionsAnalyticsAggregatedAlerts; + } + + /** + * Gets the resource collection API of IotSecuritySolutionsAnalyticsRecommendations. + * + * @return Resource collection API of IotSecuritySolutionsAnalyticsRecommendations. + */ + public IotSecuritySolutionsAnalyticsRecommendations iotSecuritySolutionsAnalyticsRecommendations() { + if (this.iotSecuritySolutionsAnalyticsRecommendations == null) { + this.iotSecuritySolutionsAnalyticsRecommendations = new IotSecuritySolutionsAnalyticsRecommendationsImpl( + clientObject.getIotSecuritySolutionsAnalyticsRecommendations(), this); + } + return iotSecuritySolutionsAnalyticsRecommendations; + } + + /** + * Gets the resource collection API of Locations. + * + * @return Resource collection API of Locations. + */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(clientObject.getLocations(), this); + } + return locations; + } + + /** + * Gets the resource collection API of OperationResults. + * + * @return Resource collection API of OperationResults. + */ + public OperationResults operationResults() { + if (this.operationResults == null) { + this.operationResults = new OperationResultsImpl(clientObject.getOperationResults(), this); + } + return operationResults; + } + + /** + * Gets the resource collection API of OperationStatuses. + * + * @return Resource collection API of OperationStatuses. + */ + public OperationStatuses operationStatuses() { + if (this.operationStatuses == null) { + this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); + } + return operationStatuses; + } + + /** + * Gets the resource collection API of PrivateLinks. It manages PrivateLinkResource. + * + * @return Resource collection API of PrivateLinks. + */ + public PrivateLinks privateLinks() { + if (this.privateLinks == null) { + this.privateLinks = new PrivateLinksImpl(clientObject.getPrivateLinks(), this); + } + return privateLinks; + } + + /** + * Gets the resource collection API of SecureScores. + * + * @return Resource collection API of SecureScores. + */ + public SecureScores secureScores() { + if (this.secureScores == null) { + this.secureScores = new SecureScoresImpl(clientObject.getSecureScores(), this); + } + return secureScores; + } + + /** + * Gets the resource collection API of SecureScoreControls. + * + * @return Resource collection API of SecureScoreControls. + */ + public SecureScoreControls secureScoreControls() { + if (this.secureScoreControls == null) { + this.secureScoreControls = new SecureScoreControlsImpl(clientObject.getSecureScoreControls(), this); + } + return secureScoreControls; + } + + /** + * Gets the resource collection API of SecureScoreControlDefinitions. + * + * @return Resource collection API of SecureScoreControlDefinitions. + */ + public SecureScoreControlDefinitions secureScoreControlDefinitions() { + if (this.secureScoreControlDefinitions == null) { + this.secureScoreControlDefinitions + = new SecureScoreControlDefinitionsImpl(clientObject.getSecureScoreControlDefinitions(), this); + } + return secureScoreControlDefinitions; + } + + /** + * 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 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 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 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 GitHubIssues. + * + * @return Resource collection API of GitHubIssues. + */ + public GitHubIssues gitHubIssues() { + if (this.gitHubIssues == null) { + this.gitHubIssues = new GitHubIssuesImpl(clientObject.getGitHubIssues(), this); + } + return gitHubIssues; + } + + /** + * Gets the resource collection API of AllowedConnections. + * + * @return Resource collection API of AllowedConnections. + */ + public AllowedConnections allowedConnections() { + if (this.allowedConnections == null) { + this.allowedConnections = new AllowedConnectionsImpl(clientObject.getAllowedConnections(), this); + } + return allowedConnections; + } + + /** + * Gets the resource collection API of ServerVulnerabilityAssessments. + * + * @return Resource collection API of ServerVulnerabilityAssessments. + */ + public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { + if (this.serverVulnerabilityAssessments == null) { + this.serverVulnerabilityAssessments + = new ServerVulnerabilityAssessmentsImpl(clientObject.getServerVulnerabilityAssessments(), this); + } + return serverVulnerabilityAssessments; + } + + /** + * Gets the resource collection API of Topologies. + * + * @return Resource collection API of Topologies. + */ + public Topologies topologies() { + if (this.topologies == null) { + this.topologies = new TopologiesImpl(clientObject.getTopologies(), this); + } + return topologies; + } + + /** + * Gets the resource collection API of SecuritySolutionsReferenceDatas. + * + * @return Resource collection API of SecuritySolutionsReferenceDatas. + */ + public SecuritySolutionsReferenceDatas securitySolutionsReferenceDatas() { + if (this.securitySolutionsReferenceDatas == null) { + this.securitySolutionsReferenceDatas + = new SecuritySolutionsReferenceDatasImpl(clientObject.getSecuritySolutionsReferenceDatas(), this); + } + return securitySolutionsReferenceDatas; + } + + /** + * Gets the resource collection API of SensitivitySettings. + * + * @return Resource collection API of SensitivitySettings. + */ + public SensitivitySettings sensitivitySettings() { + if (this.sensitivitySettings == null) { + this.sensitivitySettings = new SensitivitySettingsImpl(clientObject.getSensitivitySettings(), this); + } + return sensitivitySettings; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentSettingsOperations. + * + * @return Resource collection API of SqlVulnerabilityAssessmentSettingsOperations. + */ + public SqlVulnerabilityAssessmentSettingsOperations sqlVulnerabilityAssessmentSettingsOperations() { + if (this.sqlVulnerabilityAssessmentSettingsOperations == null) { + this.sqlVulnerabilityAssessmentSettingsOperations = new SqlVulnerabilityAssessmentSettingsOperationsImpl( + clientObject.getSqlVulnerabilityAssessmentSettingsOperations(), this); + } + return sqlVulnerabilityAssessmentSettingsOperations; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentScans. + * + * @return Resource collection API of SqlVulnerabilityAssessmentScans. + */ + public SqlVulnerabilityAssessmentScans sqlVulnerabilityAssessmentScans() { + if (this.sqlVulnerabilityAssessmentScans == null) { + this.sqlVulnerabilityAssessmentScans + = new SqlVulnerabilityAssessmentScansImpl(clientObject.getSqlVulnerabilityAssessmentScans(), this); + } + return sqlVulnerabilityAssessmentScans; + } + + /** + * Gets the resource collection API of SubAssessments. + * + * @return Resource collection API of SubAssessments. + */ + public SubAssessments subAssessments() { + if (this.subAssessments == null) { + this.subAssessments = new SubAssessmentsImpl(clientObject.getSubAssessments(), this); + } + return subAssessments; + } + /** * Gets wrapped service client SecurityCenter providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdvancedThreatProtectionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdvancedThreatProtectionsClient.java index 923759f73f94..2e7ed0ac78ce 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdvancedThreatProtectionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdvancedThreatProtectionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -17,7 +17,7 @@ public interface AdvancedThreatProtectionsClient { /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -30,7 +30,7 @@ public interface AdvancedThreatProtectionsClient { /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -42,7 +42,7 @@ public interface AdvancedThreatProtectionsClient { /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -57,7 +57,7 @@ Response createWithResponse(String resourc /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsClient.java index 198c8dcd1e90..a5cb3bfc0457 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -19,53 +19,33 @@ */ public interface AlertsClient { /** - * List all the alerts that are associated with 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 list of security alerts as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List all the alerts that are associated with the subscription. + * Get an alert that is associated with a subscription. * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. * @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 security alerts as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - - /** - * List all the alerts that are associated with the resource group. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @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 security alerts as paginated response with {@link PagedIterable}. + * @return an alert that is associated with a subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context); /** - * List all the alerts that are associated with the resource group. + * Get an alert that is associated with a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param context The context to associate with this operation. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. * @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 security alerts as paginated response with {@link PagedIterable}. + * @return an alert that is associated with a subscription. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + AlertInner getSubscriptionLevel(String ascLocation, String alertName); /** * List all the alerts that are associated with the subscription that are stored in a specific location. @@ -95,39 +75,7 @@ public interface AlertsClient { PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context); /** - * List all the alerts that are associated with the resource group that are stored in a specific location. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @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 security alerts as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName); - - /** - * List all the alerts that are associated with the resource group that are stored in a specific location. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @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 security alerts as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, - Context context); - - /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -136,13 +84,14 @@ PagedIterable listResourceGroupLevelByRegion(String ascLocation, Str * @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 alert that is associated with a subscription along with {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context); + Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, + Context context); /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -150,16 +99,13 @@ PagedIterable listResourceGroupLevelByRegion(String ascLocation, Str * @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 alert that is associated with a subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - AlertInner getSubscriptionLevel(String ascLocation, String alertName); + void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName); /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -167,28 +113,24 @@ PagedIterable listResourceGroupLevelByRegion(String ascLocation, Str * @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 alert that is associated a resource group or a resource in a resource group along with - * {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, - String alertName, Context context); + Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocation, String alertName, + Context context); /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @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 alert that is associated a resource group or a resource in a resource group. */ @ServiceMethod(returns = ReturnType.SINGLE) - AlertInner getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName); + void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName); /** * Update the alert's state. @@ -203,7 +145,7 @@ Response getResourceGroupLevelWithResponse(String resourceGroupName, * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, + Response updateSubscriptionLevelStateToActivateWithResponse(String ascLocation, String alertName, Context context); /** @@ -217,7 +159,7 @@ Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocat * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName); + void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName); /** * Update the alert's state. @@ -232,7 +174,7 @@ Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocat * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocation, String alertName, + Response updateSubscriptionLevelStateToInProgressWithResponse(String ascLocation, String alertName, Context context); /** @@ -246,11 +188,12 @@ Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocat * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName); + void updateSubscriptionLevelStateToInProgress(String ascLocation, String alertName); /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -258,59 +201,62 @@ Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocat * @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}. + * @return an alert that is associated a resource group or a resource in a resource group along with + * {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateSubscriptionLevelStateToActivateWithResponse(String ascLocation, String alertName, - Context context); + Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, + String alertName, Context context); /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @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 alert that is associated a resource group or a resource in a resource group. */ @ServiceMethod(returns = ReturnType.SINGLE) - void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName); + AlertInner getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName); /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return list of security alerts as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateSubscriptionLevelStateToInProgressWithResponse(String ascLocation, String alertName, - Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName); /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - void updateSubscriptionLevelStateToInProgress(String ascLocation, String alertName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, + Context context); /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -327,8 +273,7 @@ Response updateResourceGroupLevelStateToResolveWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -342,8 +287,7 @@ Response updateResourceGroupLevelStateToResolveWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -360,8 +304,7 @@ Response updateResourceGroupLevelStateToDismissWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -375,8 +318,7 @@ Response updateResourceGroupLevelStateToDismissWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -393,8 +335,7 @@ Response updateResourceGroupLevelStateToActivateWithResponse(String resour /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -408,8 +349,7 @@ Response updateResourceGroupLevelStateToActivateWithResponse(String resour /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -426,8 +366,7 @@ Response updateResourceGroupLevelStateToInProgressWithResponse(String reso /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -438,12 +377,59 @@ Response updateResourceGroupLevelStateToInProgressWithResponse(String reso @ServiceMethod(returns = ReturnType.SINGLE) void updateResourceGroupLevelStateToInProgress(String resourceGroupName, String ascLocation, String alertName); + /** + * List all the alerts that are associated with 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 list of security alerts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the alerts that are associated with the subscription. + * + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + /** * Simulate security alerts. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -458,7 +444,7 @@ SyncPoller, Void> beginSimulate(String ascLocation, * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -474,7 +460,7 @@ SyncPoller, Void> beginSimulate(String ascLocation, * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -487,7 +473,7 @@ SyncPoller, Void> beginSimulate(String ascLocation, * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsSuppressionRulesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsSuppressionRulesClient.java new file mode 100644 index 000000000000..75405a26ddce --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsSuppressionRulesClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AlertsSuppressionRuleInner; + +/** + * An instance of this class provides access to all the operations defined in AlertsSuppressionRulesClient. + */ +public interface AlertsSuppressionRulesClient { + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String alertsSuppressionRuleName, Context context); + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertsSuppressionRuleInner get(String alertsSuppressionRuleName); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @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 suppression rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule, Context context); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @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 suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertsSuppressionRuleInner update(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 alertsSuppressionRuleName, Context context); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 alertsSuppressionRuleName); + + /** + * List of all the dismiss rules for the given 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 suppression rules list for subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @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 suppression rules list for subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String alertType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AllowedConnectionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AllowedConnectionsClient.java index 2f0fa1c92398..6587b086fcf1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AllowedConnectionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AllowedConnectionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -17,28 +17,40 @@ */ public interface AllowedConnectionsClient { /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @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 list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedIterable}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String ascLocation, + ConnectionType connectionType, Context context); /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). * @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 list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedIterable}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + AllowedConnectionsResourceInner get(String resourceGroupName, String ascLocation, ConnectionType connectionType); /** * Gets the list of all possible traffic between resources for the subscription and location. @@ -70,40 +82,26 @@ public interface AllowedConnectionsClient { PagedIterable listByHomeRegion(String ascLocation, Context context); /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). - * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type along with {@link Response}. + * @return the list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String ascLocation, - ConnectionType connectionType, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). + * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type. + * @return the list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - AllowedConnectionsResourceInner get(String resourceGroupName, String ascLocation, ConnectionType connectionType); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApiCollectionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApiCollectionsClient.java index be7da87c723d..275880127541 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApiCollectionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApiCollectionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -17,103 +17,6 @@ * An instance of this class provides access to all the operations defined in ApiCollectionsClient. */ public interface ApiCollectionsClient { - /** - * Gets a list of API collections within a subscription - * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. - * - * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * Gets a list of API collections within a subscription - * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. - * - * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - - /** - * Gets a list of API collections within a resource group - * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * Gets a list of API collections within a resource group - * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * Gets a list of onboarded Azure API Management APIs - * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName); - - /** - * Gets a list of onboarded Azure API Management APIs - * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName, - Context context); - /** * Gets an onboarded Azure API Management API * @@ -129,7 +32,9 @@ PagedIterable listByAzureApiManagementService(String resourc * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with * {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -150,7 +55,9 @@ Response getByAzureApiManagementServiceWithResponse(String r * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs. + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. */ @ServiceMethod(returns = ReturnType.SINGLE) ApiCollectionInner getByAzureApiManagementService(String resourceGroupName, String serviceName, String apiId); @@ -272,4 +179,113 @@ Response offboardAzureApiManagementApiWithResponse(String resourceGroupNam */ @ServiceMethod(returns = ReturnType.SINGLE) void offboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId); + + /** + * Gets a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @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 onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName); + + /** + * Gets a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @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 onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName, + Context context); + + /** + * Gets a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * + * @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 API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * + * @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 API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApplicationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApplicationsClient.java new file mode 100644 index 000000000000..0ee1e316226a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApplicationsClient.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ApplicationInner; + +/** + * An instance of this class provides access to all the operations defined in ApplicationsClient. + */ +public interface ApplicationsClient { + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String applicationId, Context context); + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner get(String applicationId); + + /** + * Creates or update a security application on the given subscription. + * + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String applicationId, ApplicationInner application, + Context context); + + /** + * Creates or update a security application on the given subscription. + * + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner createOrUpdate(String applicationId, ApplicationInner application); + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 applicationId, Context context); + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 applicationId); + + /** + * Get a list of all relevant applications over a subscription level scope. + * + * @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 applications over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all relevant applications over a subscription level 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 a list of all relevant applications over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsClient.java index 5c702d11ef8b..d63f757bcfdd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -17,39 +17,10 @@ * An instance of this class provides access to all the operations defined in AssessmentsClient. */ public interface AssessmentsClient { - /** - * Get security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 assessments on all your scanned resources inside a scope as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String scope); - - /** - * Get security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 assessments on all your scanned resources inside a scope as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String scope, Context context); - /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param expand OData expand. Optional. * @param context The context to associate with this operation. @@ -65,7 +36,7 @@ Response getWithResponse(String resourceId, Str /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -79,7 +50,7 @@ Response getWithResponse(String resourceId, Str * Create a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param assessment Calculated assessment on a pre-defined assessment metadata. * @param context The context to associate with this operation. @@ -96,7 +67,7 @@ Response createOrUpdateWithResponse(String reso * Create a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param assessment Calculated assessment on a pre-defined assessment metadata. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -112,7 +83,7 @@ SecurityAssessmentResponseInner createOrUpdate(String resourceId, String assessm * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -127,7 +98,7 @@ SecurityAssessmentResponseInner createOrUpdate(String resourceId, String assessm * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -135,4 +106,31 @@ SecurityAssessmentResponseInner createOrUpdate(String resourceId, String assessm */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceId, String assessmentName); + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside 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/AssessmentsMetadatasClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsMetadatasClient.java index 112d254fa3fb..1159e30637fc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsMetadatasClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssessmentsMetadatasClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,154 +16,154 @@ */ public interface AssessmentsMetadatasClient { /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedIterable}. + * @return metadata information on an assessment type in a specific subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInSubscriptionWithResponse(String assessmentMetadataName, + Context context); /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * - * @param context The context to associate with this operation. + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedIterable}. + * @return metadata information on an assessment type in a specific subscription. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityAssessmentMetadataResponseInner getInSubscription(String assessmentMetadataName); /** - * Get metadata information on an assessment type. + * Create metadata information on an assessment type in a specific subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. * @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 metadata information on an assessment type along with {@link Response}. + * @return security assessment metadata response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String assessmentMetadataName, Context context); + Response createInSubscriptionWithResponse(String assessmentMetadataName, + SecurityAssessmentMetadataResponseInner assessmentMetadata, Context context); /** - * Get metadata information on an assessment type. + * Create metadata information on an assessment type in a specific subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. * @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 metadata information on an assessment type. + * @return security assessment metadata response. */ @ServiceMethod(returns = ReturnType.SINGLE) - SecurityAssessmentMetadataResponseInner get(String assessmentMetadataName); + SecurityAssessmentMetadataResponseInner createInSubscription(String assessmentMetadataName, + SecurityAssessmentMetadataResponseInner assessmentMetadata); /** - * Get metadata information on all assessment types in a specific subscription. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types in a specific subscription as paginated response with - * {@link PagedIterable}. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listBySubscription(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context); /** - * Get metadata information on all assessment types in a specific subscription. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * - * @param context The context to associate with this operation. + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types in a specific subscription as paginated response with - * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listBySubscription(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteInSubscription(String assessmentMetadataName); /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on all assessment types in a specific subscription. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription along with {@link Response}. + * @return metadata information on all assessment types in a specific subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getInSubscriptionWithResponse(String assessmentMetadataName, - Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(); /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on all assessment types in a specific subscription. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription. + * @return metadata information on all assessment types in a specific subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - SecurityAssessmentMetadataResponseInner getInSubscription(String assessmentMetadataName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(Context context); /** - * Create metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. - * @param assessmentMetadata AssessmentMetadata object. * @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 assessment metadata response along with {@link Response}. + * @return metadata information on an assessment type along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createInSubscriptionWithResponse(String assessmentMetadataName, - SecurityAssessmentMetadataResponseInner assessmentMetadata, Context context); + Response getWithResponse(String assessmentMetadataName, Context context); /** - * Create metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. - * @param assessmentMetadata AssessmentMetadata object. * @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 assessment metadata response. + * @return metadata information on an assessment type. */ @ServiceMethod(returns = ReturnType.SINGLE) - SecurityAssessmentMetadataResponseInner createInSubscription(String assessmentMetadataName, - SecurityAssessmentMetadataResponseInner assessmentMetadata); + SecurityAssessmentMetadataResponseInner get(String assessmentMetadataName); /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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}. + * @return metadata information on all assessment types as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - void deleteInSubscription(String assessmentMetadataName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssignmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssignmentsClient.java new file mode 100644 index 000000000000..ffdf62721e17 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AssignmentsClient.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AssignmentInner; + +/** + * An instance of this class provides access to all the operations defined in AssignmentsClient. + */ +public interface AssignmentsClient { + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 a specific standard assignment for the requested scope by resourceId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String assignmentId, + Context context); + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 a specific standard assignment for the requested scope by resourceId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AssignmentInner getByResourceGroup(String resourceGroupName, String assignmentId); + + /** + * Create a security assignment on the given scope. Will create/update the required standard assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security assignment key - unique key for the standard assignment. + * @param assignment 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 createOrUpdateWithResponse(String resourceGroupName, String assignmentId, + AssignmentInner assignment, Context context); + + /** + * Create a security assignment on the given scope. Will create/update the required standard assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security assignment key - unique key for the standard assignment. + * @param assignment 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) + AssignmentInner createOrUpdate(String resourceGroupName, String assignmentId, AssignmentInner assignment); + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 resourceGroupName, String assignmentId, Context context); + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 resourceGroupName, String assignmentId); + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a list of all relevant standardAssignments over a subscription level scope. + * + * @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 standardAssignments over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all relevant standardAssignments over a subscription level 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 a list of all relevant standardAssignments over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutoProvisioningSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutoProvisioningSettingsClient.java new file mode 100644 index 000000000000..c4d690d3fe83 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutoProvisioningSettingsClient.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutoProvisioningSettingInner; + +/** + * An instance of this class provides access to all the operations defined in AutoProvisioningSettingsClient. + */ +public interface AutoProvisioningSettingsClient { + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @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 auto provisioning setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String settingName, Context context); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @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 auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutoProvisioningSettingInner get(String settingName); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @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 auto provisioning setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String settingName, AutoProvisioningSettingInner setting, + Context context); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @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 auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutoProvisioningSettingInner create(String settingName, AutoProvisioningSettingInner setting); + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutomationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutomationsClient.java new file mode 100644 index 000000000000..6552a1ecd0a9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutomationsClient.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutomationInner; +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; +import com.azure.resourcemanager.security.models.AutomationUpdateModel; + +/** + * An instance of this class provides access to all the operations defined in AutomationsClient. + */ +public interface AutomationsClient { + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String automationName, + Context context); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutomationInner getByResourceGroup(String resourceGroupName, String automationName); + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String automationName, + AutomationInner automation, Context context); + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutomationInner createOrUpdate(String resourceGroupName, String automationName, AutomationInner automation); + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The update model of security automation 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 the security automation resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String automationName, + AutomationUpdateModel automation, Context context); + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The update model of security automation 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 the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutomationInner update(String resourceGroupName, String automationName, AutomationUpdateModel automation); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String automationName, Context context); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String automationName); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified 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 list of security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateWithResponse(String resourceGroupName, String automationName, + AutomationInner automation, Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutomationValidationStatusInner validate(String resourceGroupName, String automationName, + AutomationInner automation); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsOrgsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsOrgsClient.java new file mode 100644 index 000000000000..781ba8c7b7a6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsOrgsClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsOrgInner; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgListResponseInner; + +/** + * An instance of this class provides access to all the operations defined in AzureDevOpsOrgsClient. + */ +public interface AzureDevOpsOrgsClient { + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, Context context); + + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsOrgInner get(String resourceGroupName, String securityConnectorName, String orgName); + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsOrgInner> beginCreateOrUpdate(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg); + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsOrgInner> beginCreateOrUpdate(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context); + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsOrgInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg); + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsOrgInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg, Context context); + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsOrgInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg); + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsOrgInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context); + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsOrgInner update(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg); + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsOrgInner update(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg, Context context); + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * @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 Azure DevOps organizations onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, Context context); + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context); + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsOrgListResponseInner listAvailable(String resourceGroupName, String securityConnectorName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsProjectsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsProjectsClient.java new file mode 100644 index 000000000000..05b386661ab1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsProjectsClient.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsProjectInner; + +/** + * An instance of this class provides access to all the operations defined in AzureDevOpsProjectsClient. + */ +public interface AzureDevOpsProjectsClient { + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, Context context); + + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsProjectInner get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName); + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsProjectInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject); + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsProjectInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject, Context context); + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsProjectInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, AzureDevOpsProjectInner azureDevOpsProject); + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsProjectInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context); + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsProjectInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject); + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsProjectInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, + Context context); + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsProjectInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, AzureDevOpsProjectInner azureDevOpsProject); + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsProjectInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context); + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, String orgName); + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, String orgName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsReposClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsReposClient.java new file mode 100644 index 000000000000..12552cf1cd6c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AzureDevOpsReposClient.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsRepositoryInner; + +/** + * An instance of this class provides access to all the operations defined in AzureDevOpsReposClient. + */ +public interface AzureDevOpsReposClient { + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, Context context); + + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsRepositoryInner get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName); + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsRepositoryInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository); + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsRepositoryInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, Context context); + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsRepositoryInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository); + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsRepositoryInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, Context context); + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsRepositoryInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository); + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureDevOpsRepositoryInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, Context context); + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsRepositoryInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository); + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureDevOpsRepositoryInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, Context context); + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, + String orgName, String projectName); + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ComplianceResultsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ComplianceResultsClient.java index 2f3bb8e37c72..7b223c4f8e94 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ComplianceResultsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ComplianceResultsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,56 +16,54 @@ */ public interface ComplianceResultsClient { /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. + * @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 compliance results response as paginated response with {@link PagedIterable}. + * @return a compliance result along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String scope); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, String complianceResultName, Context context); /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @param context The context to associate with this operation. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. * @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 compliance results response as paginated response with {@link PagedIterable}. + * @return a compliance result. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String scope, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + ComplianceResultInner get(String resourceId, String complianceResultName); /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. - * @param context The context to associate with this operation. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result along with {@link Response}. + * @return list of compliance results response as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceId, String complianceResultName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result. + * @return list of compliance results response as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ComplianceResultInner get(String resourceId, String complianceResultName); + @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/CompliancesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CompliancesClient.java new file mode 100644 index 000000000000..942f7e99b948 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CompliancesClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ComplianceInner; + +/** + * An instance of this class provides access to all the operations defined in CompliancesClient. + */ +public interface CompliancesClient { + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @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 compliance of a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String complianceName, Context context); + + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @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 compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ComplianceInner get(String scope, String complianceName); + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response 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/CustomRecommendationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomRecommendationsClient.java index 24c04431ddad..97e338bd16b8 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -15,46 +15,10 @@ * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -69,10 +33,7 @@ public interface CustomRecommendationsClient { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -85,10 +46,7 @@ public interface CustomRecommendationsClient { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param customRecommendationBody Custom Recommendation body. * @param context The context to associate with this operation. @@ -104,10 +62,7 @@ Response createOrUpdateWithResponse(String scope, Str /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param customRecommendationBody Custom Recommendation body. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -122,10 +77,7 @@ CustomRecommendationInner createOrUpdate(String scope, String customRecommendati /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -139,10 +91,7 @@ CustomRecommendationInner createOrUpdate(String scope, String customRecommendati /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -150,4 +99,31 @@ CustomRecommendationInner createOrUpdate(String scope, String customRecommendati */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String scope, String customRecommendationName); + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 all relevant custom recommendations 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/DefenderForStoragesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java new file mode 100644 index 000000000000..c94f7392e784 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.DefenderForStorageSettingInner; +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; +import com.azure.resourcemanager.security.models.SettingName; + +/** + * An instance of this class provides access to all the operations defined in DefenderForStoragesClient. + */ +public interface DefenderForStoragesClient { + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, SettingName settingName, + Context context); + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DefenderForStorageSettingInner get(String resourceId, SettingName settingName); + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The defender for storage setting name. + * @param defenderForStorageSetting Defender for Storage Settings. + * @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 resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceId, SettingName settingName, + DefenderForStorageSettingInner defenderForStorageSetting, Context context); + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The defender for storage setting name. + * @param defenderForStorageSetting Defender for Storage Settings. + * @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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DefenderForStorageSettingInner create(String resourceId, SettingName settingName, + DefenderForStorageSettingInner defenderForStorageSetting); + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId); + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId, Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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/DevOpsConfigurationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsConfigurationsClient.java new file mode 100644 index 000000000000..72dab439caf0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsConfigurationsClient.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.DevOpsConfigurationInner; + +/** + * An instance of this class provides access to all the operations defined in DevOpsConfigurationsClient. + */ +public interface DevOpsConfigurationsClient { + /** + * Gets a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a DevOps Configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + Context context); + + /** + * Gets a DevOps Configuration. + * + * @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 DevOps Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsConfigurationInner get(String resourceGroupName, String securityConnectorName); + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration); + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, + Context context); + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsConfigurationInner createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration); + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsConfigurationInner createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context); + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsConfigurationInner> beginUpdate(String resourceGroupName, + String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration); + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsConfigurationInner> beginUpdate(String resourceGroupName, + String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, Context context); + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsConfigurationInner update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration); + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsConfigurationInner update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context); + + /** + * Deletes a DevOps Connector. + * + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName); + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName, + Context context); + + /** + * Deletes a DevOps Connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String securityConnectorName); + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String securityConnectorName, Context context); + + /** + * List DevOps Configurations. + * + * @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); + + /** + * List DevOps Configurations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsOperationResultsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsOperationResultsClient.java new file mode 100644 index 000000000000..98da2518926b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsOperationResultsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.OperationStatusResultInner; + +/** + * An instance of this class provides access to all the operations defined in DevOpsOperationResultsClient. + */ +public interface DevOpsOperationResultsClient { + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String operationResultId, Context context); + + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResultInner get(String resourceGroupName, String securityConnectorName, String operationResultId); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DeviceSecurityGroupsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DeviceSecurityGroupsClient.java index 72dab9a527ea..a8dd8315efea 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DeviceSecurityGroupsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DeviceSecurityGroupsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -15,35 +15,10 @@ * An instance of this class provides access to all the operations defined in DeviceSecurityGroupsClient. */ public interface DeviceSecurityGroupsClient { - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceId); - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceId, Context context); - /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -59,7 +34,7 @@ Response getWithResponse(String resourceId, String dev /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -73,7 +48,7 @@ Response getWithResponse(String resourceId, String dev /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param deviceSecurityGroup Security group object. @@ -90,7 +65,7 @@ Response createOrUpdateWithResponse(String resourceId, /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param deviceSecurityGroup Security group object. @@ -106,7 +81,7 @@ DeviceSecurityGroupInner createOrUpdate(String resourceId, String deviceSecurity /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -121,7 +96,7 @@ DeviceSecurityGroupInner createOrUpdate(String resourceId, String deviceSecurity /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -130,4 +105,29 @@ DeviceSecurityGroupInner createOrUpdate(String resourceId, String deviceSecurity */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceId, String deviceSecurityGroupName); + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId); + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId, Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DiscoveredSecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DiscoveredSecuritySolutionsClient.java index 47c4eb45a523..f9a187b05598 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DiscoveredSecuritySolutionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DiscoveredSecuritySolutionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,28 +16,37 @@ */ public interface DiscoveredSecuritySolutionsClient { /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific discovered Security Solution along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName, Context context); /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. * @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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific discovered Security Solution. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredSecuritySolutionInner get(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName); /** * Gets a list of discovered Security Solutions for the subscription and location. @@ -69,37 +78,26 @@ public interface DiscoveredSecuritySolutionsClient { PagedIterable listByHomeRegion(String ascLocation, Context context); /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. - * @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 discovered Security Solution along with {@link Response}. + * @return a list of discovered Security Solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @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 discovered Security Solution. + * @return a list of discovered Security Solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - DiscoveredSecuritySolutionInner get(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ExternalSecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ExternalSecuritySolutionsClient.java index 1acdd16924f0..d430d56ac610 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ExternalSecuritySolutionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ExternalSecuritySolutionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,28 +16,37 @@ */ public interface ExternalSecuritySolutionsClient { /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @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 external security solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific external Security Solution along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName, Context context); /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. * @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 external security solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific external Security Solution. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + ExternalSecuritySolutionInner get(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName); /** * Gets a list of external Security Solutions for the subscription and location. @@ -69,37 +78,26 @@ public interface ExternalSecuritySolutionsClient { PagedIterable listByHomeRegion(String ascLocation, Context context); /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. - * @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 external Security Solution along with {@link Response}. + * @return a list of external security solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. + * @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 external Security Solution. + * @return a list of external security solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ExternalSecuritySolutionInner get(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubIssuesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubIssuesClient.java new file mode 100644 index 000000000000..c247ec34ae3d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubIssuesClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.models.IssueCreationRequest; + +/** + * An instance of this class provides access to all the operations defined in GitHubIssuesClient. + */ +public interface GitHubIssuesClient { + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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> beginCreate(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName); + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @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> beginCreate(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, IssueCreationRequest createIssueRequest, Context context); + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 create(String resourceGroupName, String securityConnectorName, String ownerName, String repoName); + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @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 create(String resourceGroupName, String securityConnectorName, String ownerName, String repoName, + IssueCreationRequest createIssueRequest, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubOwnersClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubOwnersClient.java new file mode 100644 index 000000000000..49a68617398b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubOwnersClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitHubOwnerInner; +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerListResponseInner; + +/** + * An instance of this class provides access to all the operations defined in GitHubOwnersClient. + */ +public interface GitHubOwnersClient { + /** + * Returns a monitored GitHub owner. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 gitHub Owner resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, String ownerName, + Context context); + + /** + * Returns a monitored GitHub owner. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 gitHub Owner resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitHubOwnerInner get(String resourceGroupName, String securityConnectorName, String ownerName); + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * @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 GitHub owners onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, Context context); + + /** + * Returns a list of all GitHub owners accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context); + + /** + * Returns a list of all GitHub owners accessible by the user token consumed by the connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitHubOwnerListResponseInner listAvailable(String resourceGroupName, String securityConnectorName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubReposClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubReposClient.java new file mode 100644 index 000000000000..4426f41d3cb9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubReposClient.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitHubRepositoryInner; + +/** + * An instance of this class provides access to all the operations defined in GitHubReposClient. + */ +public interface GitHubReposClient { + /** + * Returns a monitored GitHub repository. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 gitHub Repository resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, Context context); + + /** + * Returns a monitored GitHub repository. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 gitHub Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitHubRepositoryInner get(String resourceGroupName, String securityConnectorName, String ownerName, + String repoName); + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, String ownerName); + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, String ownerName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabGroupsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabGroupsClient.java new file mode 100644 index 000000000000..ae8ea63ddf5d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabGroupsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitLabGroupInner; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupListResponseInner; + +/** + * An instance of this class provides access to all the operations defined in GitLabGroupsClient. + */ +public interface GitLabGroupsClient { + /** + * Returns a monitored GitLab Group resource for a given fully-qualified name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 gitLab Group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context); + + /** + * Returns a monitored GitLab Group resource for a given fully-qualified name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 gitLab Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitLabGroupInner get(String resourceGroupName, String securityConnectorName, String groupFQName); + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * @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 GitLab groups onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, Context context); + + /** + * Returns a list of all GitLab groups accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context); + + /** + * Returns a list of all GitLab groups accessible by the user token consumed by the connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitLabGroupListResponseInner listAvailable(String resourceGroupName, String securityConnectorName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabProjectsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabProjectsClient.java new file mode 100644 index 000000000000..f219e7d35852 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabProjectsClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitLabProjectInner; + +/** + * An instance of this class provides access to all the operations defined in GitLabProjectsClient. + */ +public interface GitLabProjectsClient { + /** + * Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName parameter. + * @param projectName The projectName 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 gitLab Project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, String projectName, Context context); + + /** + * Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName parameter. + * @param projectName The projectName 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 gitLab Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitLabProjectInner get(String resourceGroupName, String securityConnectorName, String groupFQName, + String projectName); + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 a list of GitLab projects that are directly owned by given group and onboarded to the connector as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, String groupFQName); + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 a list of GitLab projects that are directly owned by given group and onboarded to the connector as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, String groupFQName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabSubgroupsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabSubgroupsClient.java new file mode 100644 index 000000000000..d8efd88e0eb9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitLabSubgroupsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitLabGroupListResponseInner; + +/** + * An instance of this class provides access to all the operations defined in GitLabSubgroupsClient. + */ +public interface GitLabSubgroupsClient { + /** + * Gets nested subgroups of given GitLab Group which are onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 nested subgroups of given GitLab Group which are onboarded to the connector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context); + + /** + * Gets nested subgroups of given GitLab Group which are onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 nested subgroups of given GitLab Group which are onboarded to the connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitLabGroupListResponseInner list(String resourceGroupName, String securityConnectorName, String groupFQName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceAssignmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceAssignmentsClient.java new file mode 100644 index 000000000000..e89bc5e4a516 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceAssignmentsClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceAssignmentInner; + +/** + * An instance of this class provides access to all the operations defined in GovernanceAssignmentsClient. + */ +public interface GovernanceAssignmentsClient { + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 governanceAssignment for the requested scope by AssignmentKey along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String assessmentName, String assignmentKey, + Context context); + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 governanceAssignment for the requested scope by AssignmentKey. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GovernanceAssignmentInner get(String scope, String assessmentName, String assignmentKey); + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @param governanceAssignment Governance assignment over a subscription 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 governance assignment over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String scope, String assessmentName, + String assignmentKey, GovernanceAssignmentInner governanceAssignment, Context context); + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @param governanceAssignment Governance assignment over a subscription 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 governance assignment over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GovernanceAssignmentInner createOrUpdate(String scope, String assessmentName, String assignmentKey, + GovernanceAssignmentInner governanceAssignment); + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 assessmentName, String assignmentKey, Context context); + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 assessmentName, String assignmentKey); + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String assessmentName); + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String assessmentName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceRulesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceRulesClient.java new file mode 100644 index 000000000000..622bab50c54d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceRulesClient.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceRuleInner; +import com.azure.resourcemanager.security.fluent.models.OperationResultInner; +import com.azure.resourcemanager.security.models.ExecuteGovernanceRuleParams; +import com.azure.resourcemanager.security.models.GovernanceRulesOperationResultsResponse; + +/** + * An instance of this class provides access to all the operations defined in GovernanceRulesClient. + */ +public interface GovernanceRulesClient { + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 a specific governance rule for the requested scope by ruleId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String ruleId, Context context); + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 a specific governance rule for the requested scope by ruleId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GovernanceRuleInner get(String scope, String ruleId); + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param governanceRule Governance rule over a given 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 governance rule over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String scope, String ruleId, + GovernanceRuleInner governanceRule, Context context); + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param governanceRule Governance rule over a given 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 governance rule over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GovernanceRuleInner createOrUpdate(String scope, String ruleId, GovernanceRuleInner governanceRule); + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String scope, String ruleId); + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String scope, String ruleId, Context context); + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String ruleId); + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String ruleId, Context context); + + /** + * Get a list of all relevant governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get a list of all relevant governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExecute(String scope, String ruleId); + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExecute(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context); + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String scope, String ruleId); + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String scope, String ruleId, ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context); + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the governance rule. + * @param ruleId The governance rule key. + * @param operationId The governance rule long running operation unique key. + * @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 governance rules long run operation result for the requested scope by ruleId and operationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GovernanceRulesOperationResultsResponse operationResultsWithResponse(String scope, String ruleId, + String operationId, Context context); + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the governance rule. + * @param ruleId The governance rule key. + * @param operationId The governance rule long running operation unique key. + * @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 governance rules long run operation result for the requested scope by ruleId and operationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationResultInner operationResults(String scope, String ruleId, String operationId); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/HealthReportsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/HealthReportsClient.java new file mode 100644 index 000000000000..e6a36e2283b0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/HealthReportsClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.HealthReportInner; + +/** + * An instance of this class provides access to all the operations defined in HealthReportsClient. + */ +public interface HealthReportsClient { + /** + * Get health report of resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param healthReportName The health report key. + * @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 health report of resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, String healthReportName, Context context); + + /** + * Get health report of resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param healthReportName The health report key. + * @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 health report of resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthReportInner get(String resourceId, String healthReportName); + + /** + * Get a list of all health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get a list of all health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside 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/InformationProtectionPoliciesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/InformationProtectionPoliciesClient.java new file mode 100644 index 000000000000..f5c4cf0e9dec --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/InformationProtectionPoliciesClient.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.models.InformationProtectionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in InformationProtectionPoliciesClient. + */ +public interface InformationProtectionPoliciesClient { + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @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 information protection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, Context context); + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @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 information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InformationProtectionPolicyInner get(String scope, InformationProtectionPolicyName informationProtectionPolicyName); + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @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 information protection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy, Context context); + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @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 information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InformationProtectionPolicyInner createOrUpdate(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy); + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response 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/IotSecuritySolutionAnalyticsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionAnalyticsClient.java index 9805485a48cf..9af38d9a26bc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionAnalyticsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionAnalyticsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,62 +16,58 @@ */ public interface IotSecuritySolutionAnalyticsClient { /** - * Use this method to get IoT security Analytics metrics in an array. + * Use this method to get IoT Security Analytics metrics. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 Security analytics of your IoT Security solution along with {@link Response}. + * @return security analytics of your IoT Security solution along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(String resourceGroupName, String solutionName, + Response getWithResponse(String resourceGroupName, String solutionName, Context context); /** - * Use this method to get IoT security Analytics metrics in an array. + * Use this method to get IoT Security Analytics metrics. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 Security analytics of your IoT Security solution. + * @return security analytics of your IoT Security solution. */ @ServiceMethod(returns = ReturnType.SINGLE) - IoTSecuritySolutionAnalyticsModelListInner list(String resourceGroupName, String solutionName); + IoTSecuritySolutionAnalyticsModelInner get(String resourceGroupName, String solutionName); /** - * Use this method to get IoT Security Analytics metrics. + * Use this method to get IoT security Analytics metrics in an array. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 analytics of your IoT Security solution along with {@link Response}. + * @return list of Security analytics of your IoT Security solution along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String solutionName, + Response listWithResponse(String resourceGroupName, String solutionName, Context context); /** - * Use this method to get IoT Security Analytics metrics. + * Use this method to get IoT security Analytics metrics in an array. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 analytics of your IoT Security solution. + * @return list of Security analytics of your IoT Security solution. */ @ServiceMethod(returns = ReturnType.SINGLE) - IoTSecuritySolutionAnalyticsModelInner get(String resourceGroupName, String solutionName); + IoTSecuritySolutionAnalyticsModelListInner list(String resourceGroupName, String solutionName); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsAggregatedAlertsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsAggregatedAlertsClient.java index 6f022394b02a..10c914f31d68 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsAggregatedAlertsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsAggregatedAlertsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -17,75 +17,70 @@ */ public interface IotSecuritySolutionsAnalyticsAggregatedAlertsClient { /** - * Use this method to get the aggregated alert list of yours IoT Security solution. + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. + * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. + * @return security Solution Aggregated Alert information along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceGroupName, String solutionName); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String solutionName, + String aggregatedAlertName, Context context); /** - * Use this method to get the aggregated alert list of yours IoT Security solution. + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param top Number of results to retrieve. - * @param context The context to associate with this operation. + * @param aggregatedAlertName Identifier of the aggregated alert. * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. + * @return security Solution Aggregated Alert information. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceGroupName, String solutionName, Integer top, - Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + IoTSecurityAggregatedAlertInner get(String resourceGroupName, String solutionName, String aggregatedAlertName); /** - * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is - * performed by alert name. + * Use this method to get the aggregated alert list of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param aggregatedAlertName Identifier of the aggregated alert. - * @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 Solution Aggregated Alert information along with {@link Response}. + * @return list of IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String solutionName, - String aggregatedAlertName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String solutionName); /** - * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is - * performed by alert name. + * Use this method to get the aggregated alert list of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param aggregatedAlertName Identifier of the aggregated alert. + * @param top Number of results to retrieve. + * @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 Solution Aggregated Alert information. + * @return list of IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - IoTSecurityAggregatedAlertInner get(String resourceGroupName, String solutionName, String aggregatedAlertName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String solutionName, Integer top, + Context context); /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedAlertName Identifier of the aggregated alert. * @param context The context to associate with this operation. @@ -101,8 +96,7 @@ Response dismissWithResponse(String resourceGroupName, String solutionName /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsRecommendationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsRecommendationsClient.java index 19cd3bba06d4..265ef8781489 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsRecommendationsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsAnalyticsRecommendationsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -20,8 +20,7 @@ public interface IotSecuritySolutionsAnalyticsRecommendationsClient { * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. * @param context The context to associate with this operation. @@ -38,8 +37,7 @@ Response getWithResponse(String resour * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -54,8 +52,7 @@ IoTSecurityAggregatedRecommendationInner get(String resourceGroupName, String so /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -69,8 +66,7 @@ IoTSecurityAggregatedRecommendationInner get(String resourceGroupName, String so /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param top Number of results to retrieve. * @param context The context to associate with this operation. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsClient.java index cdeb1394af30..b6da73b70b0d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/IotSecuritySolutionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,63 +16,10 @@ * An instance of this class provides access to all the operations defined in IotSecuritySolutionsClient. */ public interface IotSecuritySolutionsClient { - /** - * Use this method to get the list of IoT Security solutions by 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 list of IoT Security solutions as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * Use this method to get the list of IoT Security solutions by subscription. - * - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - * @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 IoT Security solutions as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String filter, Context context); - - /** - * Use this method to get the list IoT Security solutions organized by resource group. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @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 IoT Security solutions as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * Use this method to get the list IoT Security solutions organized by resource group. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - * @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 IoT Security solutions as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, String filter, - Context context); - /** * User this method to get details of a specific IoT Security solution based on solution name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -87,8 +34,7 @@ Response getByResourceGroupWithResponse(String re /** * User this method to get details of a specific IoT Security solution based on solution name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -101,8 +47,7 @@ Response getByResourceGroupWithResponse(String re /** * Use this method to create or update yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param iotSecuritySolutionData The security solution data. * @param context The context to associate with this operation. @@ -118,8 +63,7 @@ Response createOrUpdateWithResponse(String resour /** * Use this method to create or update yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param iotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -135,8 +79,7 @@ IoTSecuritySolutionModelInner createOrUpdate(String resourceGroupName, String so * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields * use the CreateOrUpdate method. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param updateIotSecuritySolutionData The security solution data. * @param context The context to associate with this operation. @@ -153,8 +96,7 @@ Response updateWithResponse(String resourceGroupN * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields * use the CreateOrUpdate method. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param updateIotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -169,8 +111,7 @@ IoTSecuritySolutionModelInner update(String resourceGroupName, String solutionNa /** * Use this method to delete yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -184,8 +125,7 @@ IoTSecuritySolutionModelInner update(String resourceGroupName, String solutionNa /** * Use this method to delete yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -193,4 +133,54 @@ IoTSecuritySolutionModelInner update(String resourceGroupName, String solutionNa */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String solutionName); + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 IoT Security solutions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @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 IoT Security solutions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String filter, + Context context); + + /** + * Use this method to get the list of IoT Security solutions by 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 list of IoT Security solutions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @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 IoT Security solutions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/JitNetworkAccessPoliciesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/JitNetworkAccessPoliciesClient.java index 9dc4892f7ed9..214cba037833 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/JitNetworkAccessPoliciesClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/JitNetworkAccessPoliciesClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -18,86 +18,109 @@ */ public interface JitNetworkAccessPoliciesClient { /** - * Policies for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedIterable}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, Context context); /** - * Policies for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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 paginated response with {@link PagedIterable}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Create a policy for protecting resources using Just-in-Time access control. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedIterable}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByRegion(String ascLocation); + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body, Context context); /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Create a policy for protecting resources using Just-in-Time access control. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param context The context to associate with this operation. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedIterable}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByRegion(String ascLocation, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + JitNetworkAccessPolicyInner createOrUpdate(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body); /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Delete a Just-in-Time access control policy. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedIterable}. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, + Context context); /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Delete a Just-in-Time access control policy. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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 paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -112,8 +135,7 @@ PagedIterable listByResourceGroupAndRegion(String r /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param context The context to associate with this operation. @@ -129,42 +151,34 @@ PagedIterable listByResourceGroupAndRegion(String r /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @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}. + * @return the paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRegion(String ascLocation); /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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. + * @return the paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRegion(String ascLocation, Context context); /** - * Create a policy for protecting resources using Just-in-Time access control. + * Initiate a JIT access from a specific Just-in-Time policy configuration. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. @@ -176,14 +190,13 @@ Response getWithResponse(String resourceGroupName, * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body, Context context); + Response initiateWithResponse(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, Context context); /** - * Create a policy for protecting resources using Just-in-Time access control. + * Initiate a JIT access from a specific Just-in-Time policy configuration. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. @@ -194,76 +207,53 @@ Response createOrUpdateWithResponse(String resource * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - JitNetworkAccessPolicyInner createOrUpdate(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body); + JitNetworkAccessRequestInner initiate(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body); /** - * Delete a Just-in-Time access control policy. + * Policies for protecting resources using Just-in-Time access control. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @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}. + * @return the paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, - Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** - * Delete a Just-in-Time access control policy. + * Policies for protecting resources using Just-in-Time access control. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); /** - * Initiate a JIT access from a specific Just-in-Time policy configuration. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @param body The body parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return the paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response initiateWithResponse(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); /** - * Initiate a JIT access from a specific Just-in-Time policy configuration. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @param body The body parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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. + * @return the paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - JitNetworkAccessRequestInner initiate(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/LocationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/LocationsClient.java new file mode 100644 index 000000000000..b075c19e083c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/LocationsClient.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AscLocationInner; + +/** + * An instance of this class provides access to all the operations defined in LocationsClient. + */ +public interface LocationsClient { + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @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 ASC location of the subscription is in the "name" field along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String ascLocation, Context context); + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @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 ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AscLocationInner get(String ascLocation); + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @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 locations where ASC saves your data as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their 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 list of locations where ASC saves your data as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/MdeOnboardingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/MdeOnboardingsClient.java new file mode 100644 index 000000000000..0844de706f7e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/MdeOnboardingsClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.MdeOnboardingDataInner; +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataListInner; + +/** + * An instance of this class provides access to all the operations defined in MdeOnboardingsClient. + */ +public interface MdeOnboardingsClient { + /** + * The default configuration or data needed to onboard the machine to MDE. + * + * @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 resource of the configuration or data needed to onboard the machine to MDE along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(Context context); + + /** + * The default configuration or data needed to onboard the machine to MDE. + * + * @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 resource of the configuration or data needed to onboard the machine to MDE. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MdeOnboardingDataInner get(); + + /** + * The configuration or data needed to onboard the machine to MDE. + * + * @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 all MDE onboarding data resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * The configuration or data needed to onboard the machine to MDE. + * + * @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 all MDE onboarding data resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MdeOnboardingDataListInner list(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationResultsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationResultsClient.java new file mode 100644 index 000000000000..2efc702e2356 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationResultsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.models.OperationResultsGetResponse; + +/** + * An instance of this class provides access to all the operations defined in OperationResultsClient. + */ +public interface OperationResultsClient { + /** + * Returns operation results for long running operations. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async operation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationResultsGetResponse getWithResponse(String location, String operationId, Context context); + + /** + * Returns operation results for long running operations. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 get(String location, String operationId); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationStatusesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationStatusesClient.java new file mode 100644 index 000000000000..ba8619cec69a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationStatusesClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.OperationStatusResultInner; + +/** + * An instance of this class provides access to all the operations defined in OperationStatusesClient. + */ +public interface OperationStatusesClient { + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 status of a long running azure asynchronous operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String operationId, Context context); + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResultInner get(String location, String operationId); +} 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 new file mode 100644 index 000000000000..100216b0c110 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.util.Context; +import com.azure.resourcemanager.security.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PricingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PricingsClient.java index 5c660d85ed98..ec7dceb3b774 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PricingsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PricingsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -19,10 +19,7 @@ public interface PricingsClient { * Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a * subscription id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -38,10 +35,7 @@ public interface PricingsClient { * Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a * subscription id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -57,10 +51,7 @@ public interface PricingsClient { * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and * only for plan='VirtualMachines' and subPlan='P1'). * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param pricing Pricing object. * @param context The context to associate with this operation. @@ -79,10 +70,7 @@ Response updateWithResponse(String scopeId, String pricingName, Pr * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and * only for plan='VirtualMachines' and subPlan='P1'). * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param pricing Pricing object. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -95,10 +83,9 @@ Response updateWithResponse(String scopeId, String pricingName, Pr /** * Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for - * resource scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). + * resource scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -111,10 +98,9 @@ Response updateWithResponse(String scopeId, String pricingName, Pr /** * Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for - * resource scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). + * resource scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -130,10 +116,7 @@ Response updateWithResponse(String scopeId, String pricingName, Pr * unfiltered list will be returned. If '$filter=name in (planName1,planName2)' is provided, the returned list * includes the pricings set for 'planName1' and 'planName2' only. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param filter OData filter. Optional. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -151,10 +134,7 @@ Response updateWithResponse(String scopeId, String pricingName, Pr * unfiltered list will be returned. If '$filter=name in (planName1,planName2)' is provided, the returned list * includes the pricings set for 'planName1' and 'planName2' only. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier 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. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateEndpointConnectionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..3af2407cff47 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets the specified private endpoint connection associated with the private link. Returns the connection details, + * status, and configuration for a specific private endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the private link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the private link. Returns the connection details, + * status, and configuration for a specific private endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the private link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName); + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, Context context); + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + Context context); + + /** + * Gets all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 all private endpoint connections for a private link as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String privateLinkName); + + /** + * Gets all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 all private endpoint connections for a private link as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String privateLinkName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateLinkResourcesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..1be91aa6e4c5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateLinkGroupResourceInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public interface PrivateLinkResourcesClient { + /** + * Get the specified private link resource associated with the private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param groupId The group ID of the private link 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 the specified private link resource associated with the private link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String privateLinkName, + String groupId, Context context); + + /** + * Get the specified private link resource associated with the private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param groupId The group ID of the private link 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 the specified private link resource associated with the private link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkGroupResourceInner get(String resourceGroupName, String privateLinkName, String groupId); + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 of a PrivateLinkGroupResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String privateLinkName); + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 of a PrivateLinkGroupResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String privateLinkName, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateLinksClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateLinksClient.java new file mode 100644 index 000000000000..eafaa67dddd8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/PrivateLinksClient.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateLinkResourceInner; +import com.azure.resourcemanager.security.models.PrivateLinkUpdate; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinksClient. + */ +public interface PrivateLinksClient { + /** + * Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft + * Defender for Cloud services in the specified region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 private link resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String privateLinkName, + Context context); + + /** + * Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft + * Defender for Cloud services in the specified region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner getByResourceGroup(String resourceGroupName, String privateLinkName); + + /** + * Checks whether private link exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 headWithResponse(String resourceGroupName, String privateLinkName, Context context); + + /** + * Checks whether private link exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 head(String resourceGroupName, String privateLinkName); + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 a private link resource that enables secure, private connectivity + * to Microsoft Defender for Cloud services. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateLinkResourceInner> beginCreate(String resourceGroupName, + String privateLinkName, PrivateLinkResourceInner privateLink); + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 a private link resource that enables secure, private connectivity + * to Microsoft Defender for Cloud services. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateLinkResourceInner> beginCreate(String resourceGroupName, + String privateLinkName, PrivateLinkResourceInner privateLink, Context context); + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner create(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink); + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner create(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink, Context context); + + /** + * Update specific properties of a private link resource. Use this operation to update mutable properties like tags + * without affecting the entire resource configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink private link update payload containing only the properties to be updated. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String privateLinkName, + PrivateLinkUpdate privateLink, Context context); + + /** + * Update specific properties of a private link resource. Use this operation to update mutable properties like tags + * without affecting the entire resource configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink private link update payload containing only the properties to be updated. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner update(String resourceGroupName, String privateLinkName, PrivateLinkUpdate privateLink); + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName); + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName, Context context); + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName); + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName, Context context); + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified 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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified subscription. + * + * @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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceAssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceAssessmentsClient.java new file mode 100644 index 000000000000..90ef406aa303 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceAssessmentsClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceAssessmentInner; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceAssessmentsClient. + */ +public interface RegulatoryComplianceAssessmentsClient { + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @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 regulatory compliance assessment details and state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName, Context context); + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @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 regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegulatoryComplianceAssessmentInner get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName); + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @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 regulatory compliance assessment response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName); + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @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 regulatory compliance assessment response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceControlsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceControlsClient.java new file mode 100644 index 000000000000..9d3450780b99 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceControlsClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceControlInner; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceControlsClient. + */ +public interface RegulatoryComplianceControlsClient { + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @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 regulatory compliance control details and state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, Context context); + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @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 regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegulatoryComplianceControlInner get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName); + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @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 regulatory compliance controls response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String regulatoryComplianceStandardName); + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @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 regulatory compliance controls response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String regulatoryComplianceStandardName, String filter, + Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceStandardsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceStandardsClient.java new file mode 100644 index 000000000000..4b43e864806f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceStandardsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceStandardInner; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceStandardsClient. + */ +public interface RegulatoryComplianceStandardsClient { + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @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 regulatory compliance standard details and state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String regulatoryComplianceStandardName, + Context context); + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @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 regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegulatoryComplianceStandardInner get(String regulatoryComplianceStandardName); + + /** + * Supported regulatory compliance standards details and state. + * + * @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 regulatory compliance standards response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @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 regulatory compliance standards response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlDefinitionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlDefinitionsClient.java index 3997565dc2f1..5a5e4458f29b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlDefinitionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlDefinitionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlsClient.java index feb333230160..2cb1b125b276 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoreControlsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoresClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoresClient.java index 6ae5d40458ad..4522116e871d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoresClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecureScoresClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -15,28 +15,6 @@ * An instance of this class provides access to all the operations defined in SecureScoresClient. */ public interface SecureScoresClient { - /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. - * - * @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 secure scores as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current 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 list of secure scores as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - /** * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC * Default initiative, use 'ascScore'. @@ -66,4 +44,26 @@ public interface SecureScoresClient { */ @ServiceMethod(returns = ReturnType.SINGLE) SecureScoreItemInner get(String secureScoreName); + + /** + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. + * + * @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 secure scores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current 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 list of secure scores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } 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 0b1eac75a862..cf6094bb591f 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -12,18 +12,18 @@ */ public interface SecurityCenter { /** - * Gets Azure subscription ID. + * Gets Service host. * - * @return the subscriptionId value. + * @return the endpoint value. */ - String getSubscriptionId(); + String getEndpoint(); /** - * Gets server parameter. + * Gets The ID of the target subscription. The value must be an UUID. * - * @return the endpoint value. + * @return the subscriptionId value. */ - String getEndpoint(); + String getSubscriptionId(); /** * Gets The HTTP pipeline to send requests through. @@ -39,6 +39,55 @@ public interface SecurityCenter { */ Duration getDefaultPollInterval(); + /** + * Gets the AlertsClient object to access its operations. + * + * @return the AlertsClient object. + */ + AlertsClient getAlerts(); + + /** + * Gets the AlertsSuppressionRulesClient object to access its operations. + * + * @return the AlertsSuppressionRulesClient object. + */ + AlertsSuppressionRulesClient getAlertsSuppressionRules(); + + /** + * Gets the ApiCollectionsClient object to access its operations. + * + * @return the ApiCollectionsClient object. + */ + ApiCollectionsClient getApiCollections(); + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + ApplicationsClient getApplications(); + + /** + * Gets the AssessmentsMetadatasClient object to access its operations. + * + * @return the AssessmentsMetadatasClient object. + */ + AssessmentsMetadatasClient getAssessmentsMetadatas(); + + /** + * Gets the AutomationsClient object to access its operations. + * + * @return the AutomationsClient object. + */ + AutomationsClient getAutomations(); + + /** + * Gets the SecurityContactsClient object to access its operations. + * + * @return the SecurityContactsClient object. + */ + SecurityContactsClient getSecurityContacts(); + /** * Gets the ComplianceResultsClient object to access its operations. * @@ -47,11 +96,25 @@ public interface SecurityCenter { ComplianceResultsClient getComplianceResults(); /** - * Gets the AdvancedThreatProtectionsClient object to access its operations. + * Gets the GovernanceAssignmentsClient object to access its operations. * - * @return the AdvancedThreatProtectionsClient object. + * @return the GovernanceAssignmentsClient object. */ - AdvancedThreatProtectionsClient getAdvancedThreatProtections(); + GovernanceAssignmentsClient getGovernanceAssignments(); + + /** + * Gets the GovernanceRulesClient object to access its operations. + * + * @return the GovernanceRulesClient object. + */ + GovernanceRulesClient getGovernanceRules(); + + /** + * Gets the HealthReportsClient object to access its operations. + * + * @return the HealthReportsClient object. + */ + HealthReportsClient getHealthReports(); /** * Gets the DeviceSecurityGroupsClient object to access its operations. @@ -61,39 +124,144 @@ public interface SecurityCenter { DeviceSecurityGroupsClient getDeviceSecurityGroups(); /** - * Gets the IotSecuritySolutionAnalyticsClient object to access its operations. + * Gets the AutoProvisioningSettingsClient object to access its operations. * - * @return the IotSecuritySolutionAnalyticsClient object. + * @return the AutoProvisioningSettingsClient object. */ - IotSecuritySolutionAnalyticsClient getIotSecuritySolutionAnalytics(); + AutoProvisioningSettingsClient getAutoProvisioningSettings(); /** - * Gets the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object to access its operations. + * Gets the CompliancesClient object to access its operations. * - * @return the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object. + * @return the CompliancesClient object. */ - IotSecuritySolutionsAnalyticsAggregatedAlertsClient getIotSecuritySolutionsAnalyticsAggregatedAlerts(); + CompliancesClient getCompliances(); /** - * Gets the IotSecuritySolutionsAnalyticsRecommendationsClient object to access its operations. + * Gets the InformationProtectionPoliciesClient object to access its operations. * - * @return the IotSecuritySolutionsAnalyticsRecommendationsClient object. + * @return the InformationProtectionPoliciesClient object. */ - IotSecuritySolutionsAnalyticsRecommendationsClient getIotSecuritySolutionsAnalyticsRecommendations(); + InformationProtectionPoliciesClient getInformationProtectionPolicies(); /** - * Gets the IotSecuritySolutionsClient object to access its operations. + * Gets the WorkspaceSettingsClient object to access its operations. * - * @return the IotSecuritySolutionsClient object. + * @return the WorkspaceSettingsClient object. */ - IotSecuritySolutionsClient getIotSecuritySolutions(); + WorkspaceSettingsClient getWorkspaceSettings(); /** - * Gets the AllowedConnectionsClient object to access its operations. + * Gets the MdeOnboardingsClient object to access its operations. * - * @return the AllowedConnectionsClient object. + * @return the MdeOnboardingsClient object. */ - AllowedConnectionsClient getAllowedConnections(); + MdeOnboardingsClient getMdeOnboardings(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PricingsClient object to access its operations. + * + * @return the PricingsClient object. + */ + PricingsClient getPricings(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the RegulatoryComplianceStandardsClient object to access its operations. + * + * @return the RegulatoryComplianceStandardsClient object. + */ + RegulatoryComplianceStandardsClient getRegulatoryComplianceStandards(); + + /** + * Gets the RegulatoryComplianceControlsClient object to access its operations. + * + * @return the RegulatoryComplianceControlsClient object. + */ + RegulatoryComplianceControlsClient getRegulatoryComplianceControls(); + + /** + * Gets the RegulatoryComplianceAssessmentsClient object to access its operations. + * + * @return the RegulatoryComplianceAssessmentsClient object. + */ + RegulatoryComplianceAssessmentsClient getRegulatoryComplianceAssessments(); + + /** + * Gets the SecurityConnectorsClient object to access its operations. + * + * @return the SecurityConnectorsClient object. + */ + SecurityConnectorsClient getSecurityConnectors(); + + /** + * Gets the AzureDevOpsOrgsClient object to access its operations. + * + * @return the AzureDevOpsOrgsClient object. + */ + AzureDevOpsOrgsClient getAzureDevOpsOrgs(); + + /** + * Gets the GitHubOwnersClient object to access its operations. + * + * @return the GitHubOwnersClient object. + */ + GitHubOwnersClient getGitHubOwners(); + + /** + * Gets the GitLabGroupsClient object to access its operations. + * + * @return the GitLabGroupsClient object. + */ + GitLabGroupsClient getGitLabGroups(); + + /** + * Gets the DevOpsConfigurationsClient object to access its operations. + * + * @return the DevOpsConfigurationsClient object. + */ + DevOpsConfigurationsClient getDevOpsConfigurations(); + + /** + * Gets the AzureDevOpsProjectsClient object to access its operations. + * + * @return the AzureDevOpsProjectsClient object. + */ + AzureDevOpsProjectsClient getAzureDevOpsProjects(); + + /** + * Gets the GitLabProjectsClient object to access its operations. + * + * @return the GitLabProjectsClient object. + */ + GitLabProjectsClient getGitLabProjects(); + + /** + * Gets the SecurityOperatorsClient object to access its operations. + * + * @return the SecurityOperatorsClient object. + */ + SecurityOperatorsClient getSecurityOperators(); /** * Gets the DiscoveredSecuritySolutionsClient object to access its operations. @@ -116,6 +284,167 @@ public interface SecurityCenter { */ JitNetworkAccessPoliciesClient getJitNetworkAccessPolicies(); + /** + * Gets the SecuritySolutionsClient object to access its operations. + * + * @return the SecuritySolutionsClient object. + */ + SecuritySolutionsClient getSecuritySolutions(); + + /** + * Gets the SecurityStandardsClient object to access its operations. + * + * @return the SecurityStandardsClient object. + */ + SecurityStandardsClient getSecurityStandards(); + + /** + * Gets the StandardAssignmentsClient object to access its operations. + * + * @return the StandardAssignmentsClient object. + */ + StandardAssignmentsClient getStandardAssignments(); + + /** + * Gets the CustomRecommendationsClient object to access its operations. + * + * @return the CustomRecommendationsClient object. + */ + CustomRecommendationsClient getCustomRecommendations(); + + /** + * Gets the ServerVulnerabilityAssessmentsSettingsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsSettingsClient object. + */ + ServerVulnerabilityAssessmentsSettingsClient getServerVulnerabilityAssessmentsSettings(); + + /** + * Gets the SettingsClient object to access its operations. + * + * @return the SettingsClient object. + */ + SettingsClient getSettings(); + + /** + * Gets the SqlVulnerabilityAssessmentBaselineRulesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselineRulesClient object. + */ + SqlVulnerabilityAssessmentBaselineRulesClient getSqlVulnerabilityAssessmentBaselineRules(); + + /** + * Gets the SqlVulnerabilityAssessmentScanResultsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScanResultsClient object. + */ + SqlVulnerabilityAssessmentScanResultsClient getSqlVulnerabilityAssessmentScanResults(); + + /** + * Gets the StandardsClient object to access its operations. + * + * @return the StandardsClient object. + */ + StandardsClient getStandards(); + + /** + * Gets the AssignmentsClient object to access its operations. + * + * @return the AssignmentsClient object. + */ + AssignmentsClient getAssignments(); + + /** + * Gets the TasksClient object to access its operations. + * + * @return the TasksClient object. + */ + TasksClient getTasks(); + + /** + * Gets the SecurityConnectorApplicationsClient object to access its operations. + * + * @return the SecurityConnectorApplicationsClient object. + */ + SecurityConnectorApplicationsClient getSecurityConnectorApplications(); + + /** + * Gets the AssessmentsClient object to access its operations. + * + * @return the AssessmentsClient object. + */ + AssessmentsClient getAssessments(); + + /** + * Gets the AdvancedThreatProtectionsClient object to access its operations. + * + * @return the AdvancedThreatProtectionsClient object. + */ + AdvancedThreatProtectionsClient getAdvancedThreatProtections(); + + /** + * Gets the DefenderForStoragesClient object to access its operations. + * + * @return the DefenderForStoragesClient object. + */ + DefenderForStoragesClient getDefenderForStorages(); + + /** + * Gets the IotSecuritySolutionAnalyticsClient object to access its operations. + * + * @return the IotSecuritySolutionAnalyticsClient object. + */ + IotSecuritySolutionAnalyticsClient getIotSecuritySolutionAnalytics(); + + /** + * Gets the IotSecuritySolutionsClient object to access its operations. + * + * @return the IotSecuritySolutionsClient object. + */ + IotSecuritySolutionsClient getIotSecuritySolutions(); + + /** + * Gets the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object to access its operations. + * + * @return the IotSecuritySolutionsAnalyticsAggregatedAlertsClient object. + */ + IotSecuritySolutionsAnalyticsAggregatedAlertsClient getIotSecuritySolutionsAnalyticsAggregatedAlerts(); + + /** + * Gets the IotSecuritySolutionsAnalyticsRecommendationsClient object to access its operations. + * + * @return the IotSecuritySolutionsAnalyticsRecommendationsClient object. + */ + IotSecuritySolutionsAnalyticsRecommendationsClient getIotSecuritySolutionsAnalyticsRecommendations(); + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * Gets the OperationResultsClient object to access its operations. + * + * @return the OperationResultsClient object. + */ + OperationResultsClient getOperationResults(); + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + OperationStatusesClient getOperationStatuses(); + + /** + * Gets the PrivateLinksClient object to access its operations. + * + * @return the PrivateLinksClient object. + */ + PrivateLinksClient getPrivateLinks(); + /** * Gets the SecureScoresClient object to access its operations. * @@ -138,100 +467,93 @@ public interface SecurityCenter { SecureScoreControlDefinitionsClient getSecureScoreControlDefinitions(); /** - * Gets the SecuritySolutionsClient object to access its operations. - * - * @return the SecuritySolutionsClient object. - */ - SecuritySolutionsClient getSecuritySolutions(); - - /** - * Gets the SecuritySolutionsReferenceDatasClient object to access its operations. + * Gets the GitLabSubgroupsClient object to access its operations. * - * @return the SecuritySolutionsReferenceDatasClient object. + * @return the GitLabSubgroupsClient object. */ - SecuritySolutionsReferenceDatasClient getSecuritySolutionsReferenceDatas(); + GitLabSubgroupsClient getGitLabSubgroups(); /** - * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * Gets the DevOpsOperationResultsClient object to access its operations. * - * @return the ServerVulnerabilityAssessmentsClient object. + * @return the DevOpsOperationResultsClient object. */ - ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments(); + DevOpsOperationResultsClient getDevOpsOperationResults(); /** - * Gets the TopologiesClient object to access its operations. + * Gets the AzureDevOpsReposClient object to access its operations. * - * @return the TopologiesClient object. + * @return the AzureDevOpsReposClient object. */ - TopologiesClient getTopologies(); + AzureDevOpsReposClient getAzureDevOpsRepos(); /** - * Gets the AssessmentsMetadatasClient object to access its operations. + * Gets the GitHubReposClient object to access its operations. * - * @return the AssessmentsMetadatasClient object. + * @return the GitHubReposClient object. */ - AssessmentsMetadatasClient getAssessmentsMetadatas(); + GitHubReposClient getGitHubRepos(); /** - * Gets the AssessmentsClient object to access its operations. + * Gets the GitHubIssuesClient object to access its operations. * - * @return the AssessmentsClient object. + * @return the GitHubIssuesClient object. */ - AssessmentsClient getAssessments(); + GitHubIssuesClient getGitHubIssues(); /** - * Gets the AlertsClient object to access its operations. + * Gets the AllowedConnectionsClient object to access its operations. * - * @return the AlertsClient object. + * @return the AllowedConnectionsClient object. */ - AlertsClient getAlerts(); + AllowedConnectionsClient getAllowedConnections(); /** - * Gets the SettingsClient object to access its operations. + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. * - * @return the SettingsClient object. + * @return the ServerVulnerabilityAssessmentsClient object. */ - SettingsClient getSettings(); + ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments(); /** - * Gets the ServerVulnerabilityAssessmentsSettingsClient object to access its operations. + * Gets the TopologiesClient object to access its operations. * - * @return the ServerVulnerabilityAssessmentsSettingsClient object. + * @return the TopologiesClient object. */ - ServerVulnerabilityAssessmentsSettingsClient getServerVulnerabilityAssessmentsSettings(); + TopologiesClient getTopologies(); /** - * Gets the ApiCollectionsClient object to access its operations. + * Gets the SecuritySolutionsReferenceDatasClient object to access its operations. * - * @return the ApiCollectionsClient object. + * @return the SecuritySolutionsReferenceDatasClient object. */ - ApiCollectionsClient getApiCollections(); + SecuritySolutionsReferenceDatasClient getSecuritySolutionsReferenceDatas(); /** - * Gets the PricingsClient object to access its operations. + * Gets the SensitivitySettingsClient object to access its operations. * - * @return the PricingsClient object. + * @return the SensitivitySettingsClient object. */ - PricingsClient getPricings(); + SensitivitySettingsClient getSensitivitySettings(); /** - * Gets the SecurityStandardsClient object to access its operations. + * Gets the SqlVulnerabilityAssessmentSettingsOperationsClient object to access its operations. * - * @return the SecurityStandardsClient object. + * @return the SqlVulnerabilityAssessmentSettingsOperationsClient object. */ - SecurityStandardsClient getSecurityStandards(); + SqlVulnerabilityAssessmentSettingsOperationsClient getSqlVulnerabilityAssessmentSettingsOperations(); /** - * Gets the StandardAssignmentsClient object to access its operations. + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. * - * @return the StandardAssignmentsClient object. + * @return the SqlVulnerabilityAssessmentScansClient object. */ - StandardAssignmentsClient getStandardAssignments(); + SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans(); /** - * Gets the CustomRecommendationsClient object to access its operations. + * Gets the SubAssessmentsClient object to access its operations. * - * @return the CustomRecommendationsClient object. + * @return the SubAssessmentsClient object. */ - CustomRecommendationsClient getCustomRecommendations(); + SubAssessmentsClient getSubAssessments(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorApplicationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorApplicationsClient.java new file mode 100644 index 000000000000..8e184d066732 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorApplicationsClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ApplicationInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityConnectorApplicationsClient. + */ +public interface SecurityConnectorApplicationsClient { + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String applicationId, Context context); + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner get(String resourceGroupName, String securityConnectorName, String applicationId); + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String applicationId, ApplicationInner application, Context context); + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner createOrUpdate(String resourceGroupName, String securityConnectorName, String applicationId, + ApplicationInner application); + + /** + * Delete an Application over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 resourceGroupName, String securityConnectorName, String applicationId, + Context context); + + /** + * Delete an Application over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 applicationId); + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @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 all relevant applications over a security connector level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName); + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a list of all relevant applications over a security connector level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorsClient.java new file mode 100644 index 000000000000..262d6dc26057 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorsClient.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityConnectorInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityConnectorsClient. + */ +public interface SecurityConnectorsClient { + /** + * Retrieves details of a specific security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the security connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String securityConnectorName, Context context); + + /** + * Retrieves details of a specific security connector. + * + * @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 the security connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityConnectorInner getByResourceGroup(String resourceGroupName, String securityConnectorName); + + /** + * Creates or updates a security connector. If a security connector is already created and a subsequent request is + * issued for the same security connector id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector, Context context); + + /** + * Creates or updates a security connector. If a security connector is already created and a subsequent request is + * issued for the same security connector id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityConnectorInner createOrUpdate(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector); + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector, Context context); + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityConnectorInner update(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector); + + /** + * Deletes a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String securityConnectorName, Context context); + + /** + * Deletes a security connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String securityConnectorName); + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified 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 list of security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified subscription. + * + * @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 security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityContactsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityContactsClient.java new file mode 100644 index 000000000000..ad1f8728847d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityContactsClient.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityContactInner; +import com.azure.resourcemanager.security.models.SecurityContactName; + +/** + * An instance of this class provides access to all the operations defined in SecurityContactsClient. + */ +public interface SecurityContactsClient { + /** + * Get Default Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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 default Security contact configurations for the subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(SecurityContactName securityContactName, Context context); + + /** + * Get Default Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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 default Security contact configurations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityContactInner get(SecurityContactName securityContactName); + + /** + * Create security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @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 contact details and configurations for notifications coming from Microsoft Defender for Cloud along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(SecurityContactName securityContactName, + SecurityContactInner securityContact, Context context); + + /** + * Create security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @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 contact details and configurations for notifications coming from Microsoft Defender for Cloud. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityContactInner create(SecurityContactName securityContactName, SecurityContactInner securityContact); + + /** + * Delete security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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(SecurityContactName securityContactName, Context context); + + /** + * Delete security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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(SecurityContactName securityContactName); + + /** + * List all security contact configurations 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 list of security contacts response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all security contact configurations for the subscription. + * + * @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 security contacts response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityOperatorsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityOperatorsClient.java new file mode 100644 index 000000000000..b89649fd489f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityOperatorsClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityOperatorInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityOperatorsClient. + */ +public interface SecurityOperatorsClient { + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator for the requested scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String pricingName, String securityOperatorName, Context context); + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator for the requested scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityOperatorInner get(String pricingName, String securityOperatorName); + + /** + * Creates Microsoft Defender for Cloud security operator on the given scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator under a given subscription and pricing along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String pricingName, String securityOperatorName, + Context context); + + /** + * Creates Microsoft Defender for Cloud security operator on the given scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator under a given subscription and pricing. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityOperatorInner createOrUpdate(String pricingName, String securityOperatorName); + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 pricingName, String securityOperatorName, Context context); + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 pricingName, String securityOperatorName); + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @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 SecurityOperator response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String pricingName); + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @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 SecurityOperator response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String pricingName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsClient.java index f922c9711f74..fbd3b240d99c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -15,33 +15,10 @@ * An instance of this class provides access to all the operations defined in SecuritySolutionsClient. */ public interface SecuritySolutionsClient { - /** - * Gets a list of Security Solutions 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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * Gets a list of Security Solutions for the subscription. - * - * @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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - /** * Gets a specific Security Solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param securitySolutionName Name of security solution. @@ -58,8 +35,7 @@ Response getWithResponse(String resourceGroupName, String /** * Gets a specific Security Solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param securitySolutionName Name of security solution. @@ -70,4 +46,26 @@ Response getWithResponse(String resourceGroupName, String */ @ServiceMethod(returns = ReturnType.SINGLE) SecuritySolutionInner get(String resourceGroupName, String ascLocation, String securitySolutionName); + + /** + * Gets a list of Security Solutions 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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of Security Solutions for the subscription. + * + * @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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsReferenceDatasClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsReferenceDatasClient.java index a9a8c60b23a6..421d962f4d85 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsReferenceDatasClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecuritySolutionsReferenceDatasClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; 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 index 9122c8b4d7bd..94fbf1ca19cb 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -15,44 +15,10 @@ * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -66,10 +32,7 @@ public interface SecurityStandardsClient { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -82,10 +45,7 @@ public interface SecurityStandardsClient { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -101,10 +61,7 @@ Response createOrUpdateWithResponse(String scope, String /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -118,10 +75,7 @@ Response createOrUpdateWithResponse(String scope, String /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -135,10 +89,7 @@ Response createOrUpdateWithResponse(String scope, String /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -146,4 +97,29 @@ Response createOrUpdateWithResponse(String scope, String */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String scope, String standardId); + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 all relevant security standards 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/SensitivitySettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SensitivitySettingsClient.java new file mode 100644 index 000000000000..94976bca99c7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SensitivitySettingsClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GetSensitivitySettingsListResponseInner; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner; +import com.azure.resourcemanager.security.models.UpdateSensitivitySettingsRequest; + +/** + * An instance of this class provides access to all the operations defined in SensitivitySettingsClient. + */ +public interface SensitivitySettingsClient { + /** + * Gets data sensitivity settings for sensitive data discovery. + * + * @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 data sensitivity settings for sensitive data discovery along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(Context context); + + /** + * Gets data sensitivity settings for sensitive data discovery. + * + * @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 data sensitivity settings for sensitive data discovery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GetSensitivitySettingsResponseInner get(); + + /** + * Create or update data sensitivity settings for sensitive data discovery. + * + * @param sensitivitySettings The data sensitivity settings to update. + * @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 data sensitivity settings for sensitive data discovery along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response + createOrUpdateWithResponse(UpdateSensitivitySettingsRequest sensitivitySettings, Context context); + + /** + * Create or update data sensitivity settings for sensitive data discovery. + * + * @param sensitivitySettings The data sensitivity settings to update. + * @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 data sensitivity settings for sensitive data discovery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GetSensitivitySettingsResponseInner createOrUpdate(UpdateSensitivitySettingsRequest sensitivitySettings); + + /** + * Gets a list with a single sensitivity settings 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 with a single sensitivity settings resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Gets a list with a single sensitivity settings resource. + * + * @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 with a single sensitivity settings resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GetSensitivitySettingsListResponseInner list(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsClient.java index 375d8f3879e3..8902d250a647 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -17,50 +17,13 @@ * An instance of this class provides access to all the operations defined in ServerVulnerabilityAssessmentsClient. */ public interface ServerVulnerabilityAssessmentsClient { - /** - * Gets a list of server vulnerability assessment onboarding statuses on a given 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 server vulnerability assessment onboarding statuses on a given resource along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listByExtendedResourceWithResponse(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, Context context); - - /** - * Gets a list of server vulnerability assessment onboarding statuses on a given 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 server vulnerability assessment onboarding statuses on a given resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ServerVulnerabilityAssessmentsListInner listByExtendedResource(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName); - /** * Gets a server vulnerability assessment onboarding statuses on a given 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -74,11 +37,10 @@ Response getWithResponse(String resourceGrou /** * Gets a server vulnerability assessment onboarding statuses on a given 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -92,11 +54,10 @@ ServerVulnerabilityAssessmentInner get(String resourceGroupName, String resource * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. * - * @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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -111,11 +72,10 @@ Response createOrUpdateWithResponse(String r * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. * - * @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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -128,11 +88,10 @@ ServerVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, Stri /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -145,11 +104,10 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -163,11 +121,10 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -178,11 +135,10 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -191,4 +147,38 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. + * @param resourceType The type of the resource. + * @param resourceName The 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 server vulnerability assessment onboarding statuses on a given resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByExtendedResourceWithResponse(String resourceGroupName, + String resourceNamespace, String resourceType, String resourceName, Context context); + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. + * @param resourceType The type of the resource. + * @param resourceName The 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 server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentsListInner listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsSettingsClient.java index 10e3f00b359f..d0b45782635a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsSettingsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ServerVulnerabilityAssessmentsSettingsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -17,30 +17,6 @@ * ServerVulnerabilityAssessmentsSettingsClient. */ public interface ServerVulnerabilityAssessmentsSettingsClient { - /** - * Get a list of all the server vulnerability assessments settings over a subscription level scope. - * - * @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 the server vulnerability assessments settings over a subscription level scope as paginated - * response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * Get a list of all the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope as paginated - * response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - /** * Get a server vulnerability assessments setting of the requested kind, that is set on the subscription. * @@ -121,4 +97,28 @@ ServerVulnerabilityAssessmentsSettingInner createOrUpdate(ServerVulnerabilityAss */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind); + + /** + * Get a list of all the server vulnerability assessments settings over a subscription level scope. + * + * @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 the server vulnerability assessments settings over a subscription level scope as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SettingsClient.java index f1bb9a7bd740..2e77c78a0245 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SettingsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SettingsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,28 +16,6 @@ * An instance of this class provides access to all the operations defined in SettingsClient. */ public interface SettingsClient { - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - /** * Settings of different configurations in Microsoft Defender for Cloud. * @@ -89,4 +67,26 @@ public interface SettingsClient { */ @ServiceMethod(returns = ReturnType.SINGLE) SettingInner update(SettingName settingName, SettingInner setting); + + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentBaselineRulesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentBaselineRulesClient.java new file mode 100644 index 000000000000..f65e4bbdaf68 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentBaselineRulesClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResultsInput; +import com.azure.resourcemanager.security.models.RulesResultsInput; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentBaselineRulesClient. + */ +public interface SqlVulnerabilityAssessmentBaselineRulesClient { + /** + * Gets the results for a given rule in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 results for a given rule in the Baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, String ruleId, String databaseName, Context context); + + /** + * Gets the results for a given rule in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RuleResultsInner get(String resourceId, String ruleId); + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The baseline results for this rule. + * @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 rule results along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceId, String ruleId, String databaseName, + RuleResultsInput body, Context context); + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RuleResultsInner createOrUpdate(String resourceId, String ruleId); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 ruleId, String databaseName, Context context); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 resourceId, String ruleId); + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the results for all rules in the Baseline as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId); + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 results for all rules in the Baseline as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId, String databaseName, Context context); + + /** + * Set a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The content of the action request. + * @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 rules results along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addWithResponse(String resourceId, String databaseName, RulesResultsInput body, + Context context); + + /** + * Set a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RulesResultsInner add(String resourceId); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScanResultsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScanResultsClient.java new file mode 100644 index 000000000000..579fb4d61cfc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScanResultsClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ScanResultInner; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentScanResultsClient. + */ +public interface SqlVulnerabilityAssessmentScanResultsClient { + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. + * @param scanResultId The rule Id of the results. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan results of a single rule in a scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scanId, String scanResultId, String resourceId, + String databaseName, Context context); + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. + * @param scanResultId The rule Id of the results. + * @param resourceId The fully qualified Azure Resource manager identifier 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 the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanResultInner get(String scanId, String scanResultId, String resourceId); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier 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 scan results for a single scan record as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scanId, String resourceId); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan results for a single scan record as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scanId, String resourceId, String databaseName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScansClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScansClient.java new file mode 100644 index 000000000000..c1044336d4a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScansClient.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ScanV2Inner; +import com.azure.resourcemanager.security.fluent.models.SqlVulnerabilityAssessmentScanOperationResultInner; + +/** + * An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentScansClient. + */ +public interface SqlVulnerabilityAssessmentScansClient { + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId 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, SqlVulnerabilityAssessmentScanOperationResultInner> + beginInitiateScan(String resourceId); + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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, SqlVulnerabilityAssessmentScanOperationResultInner> + beginInitiateScan(String resourceId, String databaseName, Context context); + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId 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) + SqlVulnerabilityAssessmentScanOperationResultInner initiateScan(String resourceId); + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentScanOperationResultInner initiateScan(String resourceId, String databaseName, + Context context); + + /** + * Gets the result of a scan operation initiated by the InitiateScan action. + * + * @param resourceId The resourceId parameter. + * @param operationId The operationId parameter. + * @param databaseName The databaseName 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 result of a scan operation initiated by the InitiateScan action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getScanOperationResultWithResponse(String resourceId, + String operationId, String databaseName, Context context); + + /** + * Gets the result of a scan operation initiated by the InitiateScan action. + * + * @param resourceId The resourceId parameter. + * @param operationId The operationId 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 result of a scan operation initiated by the InitiateScan action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentScanOperationResultInner getScanOperationResult(String resourceId, String operationId); + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan details of a single scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scanId, String resourceId, String databaseName, Context context); + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param resourceId The fully qualified Azure Resource manager identifier 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 the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanV2Inner get(String scanId, String resourceId); + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId); + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId, String databaseName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentSettingsOperationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentSettingsOperationsClient.java new file mode 100644 index 000000000000..d87cb09d7407 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentSettingsOperationsClient.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentSettingsInner; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentSettingsOperationsClient. + */ +public interface SqlVulnerabilityAssessmentSettingsOperationsClient { + /** + * Gets the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the SQL Vulnerability Assessment settings along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, Context context); + + /** + * Gets the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the SQL Vulnerability Assessment settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentSettingsInner get(String resourceId); + + /** + * Creates or updates the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param body The SQL Vulnerability Assessment settings. + * @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 sQL Vulnerability Assessment settings resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceId, + SqlVulnerabilityAssessmentSettingsInner body, Context context); + + /** + * Creates or updates the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 sQL Vulnerability Assessment settings resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentSettingsInner createOrUpdate(String resourceId); + + /** + * Deletes the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceId, Context context); + + /** + * Deletes the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceId); +} 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 index 1580cf4fab6a..6562d47a8384 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -20,7 +20,7 @@ public interface StandardAssignmentsClient { * * 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 resourceId The fully qualified Azure Resource manager 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. @@ -37,7 +37,7 @@ Response getWithResponse(String resourceId, String stan * * 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 resourceId The fully qualified Azure Resource manager 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. @@ -54,7 +54,7 @@ Response getWithResponse(String resourceId, String stan * 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 resourceId The fully qualified Azure Resource manager 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. @@ -74,7 +74,7 @@ Response createWithResponse(String resourceId, String s * 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 resourceId The fully qualified Azure Resource manager 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. @@ -93,7 +93,7 @@ StandardAssignmentInner create(String resourceId, String standardAssignmentName, * standard assignment is the part of its ID preceding * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager 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. @@ -111,7 +111,7 @@ StandardAssignmentInner create(String resourceId, String standardAssignmentName, * standard assignment is the part of its ID preceding * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager 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. @@ -123,10 +123,7 @@ StandardAssignmentInner create(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})'. + * @param scope The fully qualified Azure Resource manager identifier 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. @@ -139,10 +136,7 @@ StandardAssignmentInner create(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})'. + * @param scope The fully qualified Azure Resource manager identifier 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. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/StandardsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/StandardsClient.java new file mode 100644 index 000000000000..aceb75912ff8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/StandardsClient.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.StandardInner; + +/** + * An instance of this class provides access to all the operations defined in StandardsClient. + */ +public interface StandardsClient { + /** + * Get a specific security standard for the requested scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String standardId, + Context context); + + /** + * Get a specific security standard for the requested scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StandardInner getByResourceGroup(String resourceGroupName, String standardId); + + /** + * Create a security standard on the given scope. Available only for custom standards. Will create/update the + * required standard definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId, + StandardInner standard, Context context); + + /** + * Create a security standard on the given scope. Available only for custom standards. Will create/update the + * required standard definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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) + StandardInner createOrUpdate(String resourceGroupName, String standardId, StandardInner standard); + + /** + * Delete a security standard on a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId, Context context); + + /** + * Delete a security standard on a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId); + + /** + * Get security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standards on all your resources inside a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standards on all your resources inside a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a list of all relevant security standards over a subscription level scope. + * + * @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 subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all relevant security standards over a subscription level 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 a list of all relevant security standards over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SubAssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SubAssessmentsClient.java new file mode 100644 index 000000000000..f2008a31ffa7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SubAssessmentsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecuritySubAssessmentInner; + +/** + * An instance of this class provides access to all the operations defined in SubAssessmentsClient. + */ +public interface SubAssessmentsClient { + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment 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 security sub-assessment on your scanned resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String assessmentName, String subAssessmentName, + Context context); + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment 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 security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecuritySubAssessmentInner get(String scope, String assessmentName, String subAssessmentName); + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String assessmentName); + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String assessmentName, Context context); + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(String scope); + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(String scope, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TasksClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TasksClient.java new file mode 100644 index 000000000000..a93955836a33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TasksClient.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityTaskInner; +import com.azure.resourcemanager.security.models.TaskUpdateActionType; + +/** + * An instance of this class provides access to all the operations defined in TasksClient. + */ +public interface TasksClient { + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getResourceGroupLevelTaskWithResponse(String resourceGroupName, String ascLocation, + String taskName, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityTaskInner getResourceGroupLevelTask(String resourceGroupName, String ascLocation, String taskName); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation, String filter, + Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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 updateResourceGroupLevelTaskStateWithResponse(String resourceGroupName, String ascLocation, + String taskName, TaskUpdateActionType taskUpdateActionType, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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 updateResourceGroupLevelTaskState(String resourceGroupName, String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSubscriptionLevelTaskWithResponse(String ascLocation, String taskName, + Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityTaskInner getSubscriptionLevelTask(String ascLocation, String taskName); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHomeRegion(String ascLocation, String filter, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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 updateSubscriptionLevelTaskStateWithResponse(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType, Context context); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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 updateSubscriptionLevelTaskState(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TopologiesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TopologiesClient.java index b0568bbfcf13..581f9d902f74 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TopologiesClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TopologiesClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent; @@ -16,28 +16,36 @@ */ public interface TopologiesClient { /** - * Gets a list that allows to build a topology view of a subscription. + * Gets a specific topology component. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @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 that allows to build a topology view of a subscription as paginated response with - * {@link PagedIterable}. + * @return a specific topology component along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String ascLocation, + String topologyResourceName, Context context); /** - * Gets a list that allows to build a topology view of a subscription. + * Gets a specific topology component. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. * @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 that allows to build a topology view of a subscription as paginated response with - * {@link PagedIterable}. + * @return a specific topology component. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + TopologyResourceInner get(String resourceGroupName, String ascLocation, String topologyResourceName); /** * Gets a list that allows to build a topology view of a subscription and location. @@ -69,36 +77,26 @@ public interface TopologiesClient { PagedIterable listByHomeRegion(String ascLocation, Context context); /** - * Gets a specific topology component. + * Gets a list that allows to build a topology view of a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param topologyResourceName Name of a topology resources collection. - * @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 topology component along with {@link Response}. + * @return a list that allows to build a topology view of a subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String ascLocation, - String topologyResourceName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** - * Gets a specific topology component. + * Gets a list that allows to build a topology view of a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param topologyResourceName Name of a topology resources collection. + * @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 topology component. + * @return a list that allows to build a topology view of a subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopologyResourceInner get(String resourceGroupName, String ascLocation, String topologyResourceName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/WorkspaceSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/WorkspaceSettingsClient.java new file mode 100644 index 000000000000..c1658efd4e42 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/WorkspaceSettingsClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.WorkspaceSettingInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceSettingsClient. + */ +public interface WorkspaceSettingsClient { + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String workspaceSettingName, Context context); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @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 configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceSettingInner get(String workspaceSettingName); + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting, Context context); + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceSettingInner create(String workspaceSettingName, WorkspaceSettingInner workspaceSetting); + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting, Context context); + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceSettingInner update(String workspaceSettingName, WorkspaceSettingInner workspaceSetting); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @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 workspaceSettingName, Context context); + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @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 workspaceSettingName); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} 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 ac862963f537..88c03ecfacd0 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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 decd1c4a3528..50237dd19c50 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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; @@ -21,6 +22,11 @@ public final class AdvancedThreatProtectionSettingInner extends ProxyResource { */ private AdvancedThreatProtectionProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -51,6 +57,15 @@ private AdvancedThreatProtectionProperties 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. * @@ -151,6 +166,8 @@ public static AdvancedThreatProtectionSettingInner fromJson(JsonReader jsonReade } else if ("properties".equals(fieldName)) { deserializedAdvancedThreatProtectionSettingInner.innerProperties = AdvancedThreatProtectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAdvancedThreatProtectionSettingInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 aeaef63006ef..e4600834dfcc 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +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; @@ -23,13 +24,18 @@ /** * Security alert. */ -@Fluent +@Immutable public final class AlertInner extends ProxyResource { /* * describes security alert properties. */ private AlertProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -48,7 +54,7 @@ public final class AlertInner extends ProxyResource { /** * Creates an instance of AlertInner class. */ - public AlertInner() { + private AlertInner() { } /** @@ -60,6 +66,15 @@ private AlertProperties 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. * @@ -308,20 +323,6 @@ public Map extendedProperties() { return this.innerProperties() == null ? null : this.innerProperties().extendedProperties(); } - /** - * Set the extendedProperties property: Custom properties for the alert. - * - * @param extendedProperties the extendedProperties value to set. - * @return the AlertInner object itself. - */ - public AlertInner withExtendedProperties(Map extendedProperties) { - if (this.innerProperties() == null) { - this.innerProperties = new AlertProperties(); - } - this.innerProperties().withExtendedProperties(extendedProperties); - return this; - } - /** * Get the compromisedEntity property: The display name of the resource most related to this alert. * @@ -358,20 +359,6 @@ public AlertPropertiesSupportingEvidence supportingEvidence() { return this.innerProperties() == null ? null : this.innerProperties().supportingEvidence(); } - /** - * Set the supportingEvidence property: Changing set of properties depending on the supportingEvidence type. - * - * @param supportingEvidence the supportingEvidence value to set. - * @return the AlertInner object itself. - */ - public AlertInner withSupportingEvidence(AlertPropertiesSupportingEvidence supportingEvidence) { - if (this.innerProperties() == null) { - this.innerProperties = new AlertProperties(); - } - this.innerProperties().withSupportingEvidence(supportingEvidence); - return this; - } - /** * Validates the instance. * @@ -417,6 +404,8 @@ public static AlertInner fromJson(JsonReader jsonReader) throws IOException { deserializedAlertInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedAlertInner.innerProperties = AlertProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAlertInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 292faba35f83..002eb72c8e96 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.CoreUtils; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -24,7 +24,7 @@ /** * describes security alert properties. */ -@Fluent +@Immutable public final class AlertProperties implements JsonSerializable { /* * Schema version. @@ -170,7 +170,7 @@ public final class AlertProperties implements JsonSerializable /** * Creates an instance of AlertProperties class. */ - public AlertProperties() { + private AlertProperties() { } /** @@ -391,17 +391,6 @@ public Map extendedProperties() { return this.extendedProperties; } - /** - * Set the extendedProperties property: Custom properties for the alert. - * - * @param extendedProperties the extendedProperties value to set. - * @return the AlertProperties object itself. - */ - public AlertProperties withExtendedProperties(Map extendedProperties) { - this.extendedProperties = extendedProperties; - return this; - } - /** * Get the compromisedEntity property: The display name of the resource most related to this alert. * @@ -438,17 +427,6 @@ public AlertPropertiesSupportingEvidence supportingEvidence() { return this.supportingEvidence; } - /** - * Set the supportingEvidence property: Changing set of properties depending on the supportingEvidence type. - * - * @param supportingEvidence the supportingEvidence value to set. - * @return the AlertProperties object itself. - */ - public AlertProperties withSupportingEvidence(AlertPropertiesSupportingEvidence supportingEvidence) { - this.supportingEvidence = supportingEvidence; - return this; - } - /** * Validates the instance. * 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 cda34775e356..0bb0c578ccae 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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 new file mode 100644 index 000000000000..2c81cb1994b8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RuleState; +import com.azure.resourcemanager.security.models.SuppressionAlertsScope; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Describes the suppression rule. + */ +@Fluent +public final class AlertsSuppressionRuleInner extends ProxyResource { + /* + * describes AlertsSuppressionRule properties + */ + private AlertsSuppressionRuleProperties 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 AlertsSuppressionRuleInner class. + */ + public AlertsSuppressionRuleInner() { + } + + /** + * Get the innerProperties property: describes AlertsSuppressionRule properties. + * + * @return the innerProperties value. + */ + private AlertsSuppressionRuleProperties 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 alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @return the alertType value. + */ + public String alertType() { + return this.innerProperties() == null ? null : this.innerProperties().alertType(); + } + + /** + * Set the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @param alertType the alertType value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withAlertType(String alertType) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertsSuppressionRuleProperties(); + } + this.innerProperties().withAlertType(alertType); + return this; + } + + /** + * Get the lastModifiedUtc property: The last time this rule was modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc(); + } + + /** + * Get the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * there will no expiration at all. + * + * @return the expirationDateUtc value. + */ + public OffsetDateTime expirationDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().expirationDateUtc(); + } + + /** + * Set the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * there will no expiration at all. + * + * @param expirationDateUtc the expirationDateUtc value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withExpirationDateUtc(OffsetDateTime expirationDateUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertsSuppressionRuleProperties(); + } + this.innerProperties().withExpirationDateUtc(expirationDateUtc); + return this; + } + + /** + * Get the reason property: The reason for dismissing the alert. + * + * @return the reason value. + */ + public String reason() { + return this.innerProperties() == null ? null : this.innerProperties().reason(); + } + + /** + * Set the reason property: The reason for dismissing the alert. + * + * @param reason the reason value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withReason(String reason) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertsSuppressionRuleProperties(); + } + this.innerProperties().withReason(reason); + return this; + } + + /** + * Get the state property: Possible states of the rule. + * + * @return the state value. + */ + public RuleState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Possible states of the rule. + * + * @param state the state value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withState(RuleState state) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertsSuppressionRuleProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the comment property: Any comment regarding the rule. + * + * @return the comment value. + */ + public String comment() { + return this.innerProperties() == null ? null : this.innerProperties().comment(); + } + + /** + * Set the comment property: Any comment regarding the rule. + * + * @param comment the comment value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withComment(String comment) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertsSuppressionRuleProperties(); + } + this.innerProperties().withComment(comment); + return this; + } + + /** + * Get the suppressionAlertsScope property: The suppression conditions. + * + * @return the suppressionAlertsScope value. + */ + public SuppressionAlertsScope suppressionAlertsScope() { + return this.innerProperties() == null ? null : this.innerProperties().suppressionAlertsScope(); + } + + /** + * Set the suppressionAlertsScope property: The suppression conditions. + * + * @param suppressionAlertsScope the suppressionAlertsScope value to set. + * @return the AlertsSuppressionRuleInner object itself. + */ + public AlertsSuppressionRuleInner withSuppressionAlertsScope(SuppressionAlertsScope suppressionAlertsScope) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertsSuppressionRuleProperties(); + } + this.innerProperties().withSuppressionAlertsScope(suppressionAlertsScope); + 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 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 if ("systemData".equals(fieldName)) { + deserializedAlertsSuppressionRuleInner.systemData = SystemData.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 new file mode 100644 index 000000000000..826e9a821014 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleProperties.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * describes AlertsSuppressionRule properties. + */ +@Fluent +public final class AlertsSuppressionRuleProperties implements JsonSerializable { + /* + * Type of the alert to automatically suppress. For all alert types, use '*' + */ + private String alertType; + + /* + * The last time this rule was modified + */ + private OffsetDateTime lastModifiedUtc; + + /* + * Expiration date of the rule, if value is not provided or provided as null there will no expiration at all + */ + private OffsetDateTime expirationDateUtc; + + /* + * The reason for dismissing the alert + */ + private String reason; + + /* + * Possible states of the rule + */ + private RuleState state; + + /* + * Any comment regarding the rule + */ + private String comment; + + /* + * The suppression conditions + */ + private SuppressionAlertsScope suppressionAlertsScope; + + /** + * Creates an instance of AlertsSuppressionRuleProperties class. + */ + public AlertsSuppressionRuleProperties() { + } + + /** + * Get the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Set the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @param alertType the alertType value to set. + * @return the AlertsSuppressionRuleProperties object itself. + */ + public AlertsSuppressionRuleProperties withAlertType(String alertType) { + this.alertType = alertType; + return this; + } + + /** + * Get the lastModifiedUtc property: The last time this rule was modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Get the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * there will no expiration at all. + * + * @return the expirationDateUtc value. + */ + public OffsetDateTime expirationDateUtc() { + return this.expirationDateUtc; + } + + /** + * Set the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * there will no expiration at all. + * + * @param expirationDateUtc the expirationDateUtc value to set. + * @return the AlertsSuppressionRuleProperties object itself. + */ + public AlertsSuppressionRuleProperties withExpirationDateUtc(OffsetDateTime expirationDateUtc) { + this.expirationDateUtc = expirationDateUtc; + return this; + } + + /** + * Get the reason property: The reason for dismissing the alert. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for dismissing the alert. + * + * @param reason the reason value to set. + * @return the AlertsSuppressionRuleProperties object itself. + */ + public AlertsSuppressionRuleProperties withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the state property: Possible states of the rule. + * + * @return the state value. + */ + public RuleState state() { + return this.state; + } + + /** + * Set the state property: Possible states of the rule. + * + * @param state the state value to set. + * @return the AlertsSuppressionRuleProperties object itself. + */ + public AlertsSuppressionRuleProperties withState(RuleState state) { + this.state = state; + return this; + } + + /** + * Get the comment property: Any comment regarding the rule. + * + * @return the comment value. + */ + public String comment() { + return this.comment; + } + + /** + * Set the comment property: Any comment regarding the rule. + * + * @param comment the comment value to set. + * @return the AlertsSuppressionRuleProperties object itself. + */ + public AlertsSuppressionRuleProperties withComment(String comment) { + this.comment = comment; + return this; + } + + /** + * Get the suppressionAlertsScope property: The suppression conditions. + * + * @return the suppressionAlertsScope value. + */ + public SuppressionAlertsScope suppressionAlertsScope() { + return this.suppressionAlertsScope; + } + + /** + * Set the suppressionAlertsScope property: The suppression conditions. + * + * @param suppressionAlertsScope the suppressionAlertsScope value to set. + * @return the AlertsSuppressionRuleProperties object itself. + */ + public AlertsSuppressionRuleProperties withSuppressionAlertsScope(SuppressionAlertsScope suppressionAlertsScope) { + this.suppressionAlertsScope = suppressionAlertsScope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (alertType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property alertType in model AlertsSuppressionRuleProperties")); + } + if (reason() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property reason in model AlertsSuppressionRuleProperties")); + } + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model AlertsSuppressionRuleProperties")); + } + if (suppressionAlertsScope() != null) { + suppressionAlertsScope().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 afbc07bd351a..cf8392a51691 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -29,6 +30,11 @@ public final class AllowedConnectionsResourceInner extends ProxyResource { */ private String location; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -47,7 +53,7 @@ public final class AllowedConnectionsResourceInner extends ProxyResource { /** * Creates an instance of AllowedConnectionsResourceInner class. */ - public AllowedConnectionsResourceInner() { + private AllowedConnectionsResourceInner() { } /** @@ -68,6 +74,15 @@ public String location() { return this.location; } + /** + * 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. * @@ -159,11 +174,13 @@ public static AllowedConnectionsResourceInner fromJson(JsonReader jsonReader) th deserializedAllowedConnectionsResourceInner.name = reader.getString(); } else if ("type".equals(fieldName)) { deserializedAllowedConnectionsResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAllowedConnectionsResourceInner.location = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedAllowedConnectionsResourceInner.innerProperties = AllowedConnectionsResourceProperties.fromJson(reader); - } else if ("location".equals(fieldName)) { - deserializedAllowedConnectionsResourceInner.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAllowedConnectionsResourceInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 da1e8534ce59..4fa0d39449b5 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -34,7 +34,7 @@ public final class AllowedConnectionsResourceProperties /** * Creates an instance of AllowedConnectionsResourceProperties class. */ - public AllowedConnectionsResourceProperties() { + private AllowedConnectionsResourceProperties() { } /** 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 91caed5217f3..291e405353e8 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -22,6 +23,11 @@ public final class ApiCollectionInner extends ProxyResource { */ private ApiCollectionProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -40,7 +46,7 @@ public final class ApiCollectionInner extends ProxyResource { /** * Creates an instance of ApiCollectionInner class. */ - public ApiCollectionInner() { + private ApiCollectionInner() { } /** @@ -52,6 +58,15 @@ private ApiCollectionProperties 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. * @@ -225,6 +240,8 @@ public static ApiCollectionInner fromJson(JsonReader jsonReader) throws IOExcept deserializedApiCollectionInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedApiCollectionInner.innerProperties = ApiCollectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedApiCollectionInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 522b33f0b84b..22255a494063 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -71,7 +71,7 @@ public final class ApiCollectionProperties implements JsonSerializable conditionSets() { + return this.innerProperties() == null ? null : this.innerProperties().conditionSets(); + } + + /** + * Set the conditionSets property: The application conditionSets - see examples. + * + * @param conditionSets the conditionSets value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withConditionSets(List conditionSets) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withConditionSets(conditionSets); + 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 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 if ("systemData".equals(fieldName)) { + deserializedApplicationInner.systemData = SystemData.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 new file mode 100644 index 000000000000..56d65b4889fd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationProperties.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.ApplicationSourceResourceType; +import java.io.IOException; +import java.util.List; + +/** + * Describes properties of an application. + */ +@Fluent +public final class ApplicationProperties implements JsonSerializable { + /* + * display name of the application + */ + private String displayName; + + /* + * description of the application + */ + private String description; + + /* + * The application source, what it affects, e.g. Assessments + */ + private ApplicationSourceResourceType sourceResourceType; + + /* + * The application conditionSets - see examples + */ + private List conditionSets; + + /** + * Creates an instance of ApplicationProperties class. + */ + public ApplicationProperties() { + } + + /** + * Get the displayName property: display name of the application. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: display name of the application. + * + * @param displayName the displayName value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: description of the application. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: description of the application. + * + * @param description the description value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the sourceResourceType property: The application source, what it affects, e.g. Assessments. + * + * @return the sourceResourceType value. + */ + public ApplicationSourceResourceType sourceResourceType() { + return this.sourceResourceType; + } + + /** + * Set the sourceResourceType property: The application source, what it affects, e.g. Assessments. + * + * @param sourceResourceType the sourceResourceType value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withSourceResourceType(ApplicationSourceResourceType sourceResourceType) { + this.sourceResourceType = sourceResourceType; + return this; + } + + /** + * Get the conditionSets property: The application conditionSets - see examples. + * + * @return the conditionSets value. + */ + public List conditionSets() { + return this.conditionSets; + } + + /** + * Set the conditionSets property: The application conditionSets - see examples. + * + * @param conditionSets the conditionSets value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withConditionSets(List conditionSets) { + this.conditionSets = conditionSets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceResourceType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceResourceType in model ApplicationProperties")); + } + if (conditionSets() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property conditionSets in model ApplicationProperties")); + } + } + + 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 new file mode 100644 index 000000000000..f50f29f51148 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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 java.io.IOException; + +/** + * The ASC location of the subscription is in the "name" field. + */ +@Immutable +public final class AscLocationInner extends ProxyResource { + /* + * An empty set of properties + */ + private Object properties; + + /* + * 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 AscLocationInner class. + */ + private AscLocationInner() { + } + + /** + * Get the properties property: An empty set of properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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(); + if (this.properties != null) { + 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 if ("systemData".equals(fieldName)) { + deserializedAscLocationInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAscLocationInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AssignmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AssignmentInner.java new file mode 100644 index 000000000000..19c24c50f6e7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AssignmentInner.java @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AssignedComponentItem; +import com.azure.resourcemanager.security.models.AssignedStandardItem; +import com.azure.resourcemanager.security.models.AssignmentPropertiesAdditionalData; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Security Assignment on a resource group over a given scope. + */ +@Fluent +public final class AssignmentInner extends ProxyResource { + /* + * Properties of a security assignment + */ + private AssignmentProperties innerProperties; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * Kind of the resource + */ + private String kind; + + /* + * Entity tag is used for comparing two or more entities from the same requested resource. + */ + private String etag; + + /* + * 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 AssignmentInner class. + */ + public AssignmentInner() { + } + + /** + * Get the innerProperties property: Properties of a security assignment. + * + * @return the innerProperties value. + */ + private AssignmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the kind property: Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of the resource. + * + * @param kind the kind value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @param etag the etag value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * 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 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 AssignmentInner object itself. + */ + public AssignmentInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + 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 AssignmentInner object itself. + */ + public AssignmentInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + 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 AssignmentInner object itself. + */ + public AssignmentInner withAssignedStandard(AssignedStandardItem assignedStandard) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + this.innerProperties().withAssignedStandard(assignedStandard); + return this; + } + + /** + * Get the assignedComponent property: Component item with key as applied to this standard assignment over the given + * scope. + * + * @return the assignedComponent value. + */ + public AssignedComponentItem assignedComponent() { + return this.innerProperties() == null ? null : this.innerProperties().assignedComponent(); + } + + /** + * Set the assignedComponent property: Component item with key as applied to this standard assignment over the given + * scope. + * + * @param assignedComponent the assignedComponent value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withAssignedComponent(AssignedComponentItem assignedComponent) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + this.innerProperties().withAssignedComponent(assignedComponent); + return this; + } + + /** + * Get the scope property: Scope to which the standardAssignment applies - can be a subscription path or a resource + * group under that subscription. + * + * @return the scope value. + */ + public String scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: Scope to which the standardAssignment applies - can be a subscription path or a resource + * group under that subscription. + * + * @param scope the scope value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withScope(String scope) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + this.innerProperties().withScope(scope); + return this; + } + + /** + * Get the effect property: expected effect of this assignment (Disable/Exempt/etc). + * + * @return the effect value. + */ + public String effect() { + return this.innerProperties() == null ? null : this.innerProperties().effect(); + } + + /** + * Set the effect property: expected effect of this assignment (Disable/Exempt/etc). + * + * @param effect the effect value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withEffect(String effect) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + this.innerProperties().withEffect(effect); + 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 AssignmentInner object itself. + */ + public AssignmentInner withExpiresOn(OffsetDateTime expiresOn) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + this.innerProperties().withExpiresOn(expiresOn); + return this; + } + + /** + * Get the additionalData property: Additional data about the assignment. + * + * @return the additionalData value. + */ + public AssignmentPropertiesAdditionalData additionalData() { + return this.innerProperties() == null ? null : this.innerProperties().additionalData(); + } + + /** + * Set the additionalData property: Additional data about the assignment. + * + * @param additionalData the additionalData value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withAdditionalData(AssignmentPropertiesAdditionalData additionalData) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + this.innerProperties().withAdditionalData(additionalData); + return this; + } + + /** + * Get the metadata property: The assignment metadata. Metadata is an open ended object and is typically a + * collection of key value pairs. + * + * @return the metadata value. + */ + public Object metadata() { + return this.innerProperties() == null ? null : this.innerProperties().metadata(); + } + + /** + * Set the metadata property: The assignment metadata. Metadata is an open ended object and is typically a + * collection of key value pairs. + * + * @param metadata the metadata value to set. + * @return the AssignmentInner object itself. + */ + public AssignmentInner withMetadata(Object metadata) { + if (this.innerProperties() == null) { + this.innerProperties = new AssignmentProperties(); + } + 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); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignmentInner 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 AssignmentInner. + */ + public static AssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignmentInner deserializedAssignmentInner = new AssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAssignmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAssignmentInner.innerProperties = AssignmentProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAssignmentInner.tags = tags; + } else if ("location".equals(fieldName)) { + deserializedAssignmentInner.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAssignmentInner.kind = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedAssignmentInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAssignmentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignmentInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AssignmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AssignmentProperties.java new file mode 100644 index 000000000000..808f8ab8bd05 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AssignmentProperties.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AssignedComponentItem; +import com.azure.resourcemanager.security.models.AssignedStandardItem; +import com.azure.resourcemanager.security.models.AssignmentPropertiesAdditionalData; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Describes the properties of a standardAssignment. + */ +@Fluent +public final class AssignmentProperties 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; + + /* + * Component item with key as applied to this standard assignment over the given scope + */ + private AssignedComponentItem assignedComponent; + + /* + * Scope to which the standardAssignment applies - can be a subscription path or a resource group under that + * subscription + */ + private String scope; + + /* + * expected effect of this assignment (Disable/Exempt/etc) + */ + private String effect; + + /* + * Expiration date of this assignment as a full ISO date + */ + private OffsetDateTime expiresOn; + + /* + * Additional data about the assignment + */ + private AssignmentPropertiesAdditionalData additionalData; + + /* + * The assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs. + */ + private Object metadata; + + /** + * Creates an instance of AssignmentProperties class. + */ + public AssignmentProperties() { + } + + /** + * 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 AssignmentProperties object itself. + */ + public AssignmentProperties 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 AssignmentProperties object itself. + */ + public AssignmentProperties 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 AssignmentProperties object itself. + */ + public AssignmentProperties withAssignedStandard(AssignedStandardItem assignedStandard) { + this.assignedStandard = assignedStandard; + return this; + } + + /** + * Get the assignedComponent property: Component item with key as applied to this standard assignment over the given + * scope. + * + * @return the assignedComponent value. + */ + public AssignedComponentItem assignedComponent() { + return this.assignedComponent; + } + + /** + * Set the assignedComponent property: Component item with key as applied to this standard assignment over the given + * scope. + * + * @param assignedComponent the assignedComponent value to set. + * @return the AssignmentProperties object itself. + */ + public AssignmentProperties withAssignedComponent(AssignedComponentItem assignedComponent) { + this.assignedComponent = assignedComponent; + return this; + } + + /** + * Get the scope property: Scope to which the standardAssignment applies - can be a subscription path or a resource + * group under that subscription. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: Scope to which the standardAssignment applies - can be a subscription path or a resource + * group under that subscription. + * + * @param scope the scope value to set. + * @return the AssignmentProperties object itself. + */ + public AssignmentProperties withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the effect property: expected effect of this assignment (Disable/Exempt/etc). + * + * @return the effect value. + */ + public String effect() { + return this.effect; + } + + /** + * Set the effect property: expected effect of this assignment (Disable/Exempt/etc). + * + * @param effect the effect value to set. + * @return the AssignmentProperties object itself. + */ + public AssignmentProperties withEffect(String effect) { + this.effect = effect; + 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 AssignmentProperties object itself. + */ + public AssignmentProperties withExpiresOn(OffsetDateTime expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Get the additionalData property: Additional data about the assignment. + * + * @return the additionalData value. + */ + public AssignmentPropertiesAdditionalData additionalData() { + return this.additionalData; + } + + /** + * Set the additionalData property: Additional data about the assignment. + * + * @param additionalData the additionalData value to set. + * @return the AssignmentProperties object itself. + */ + public AssignmentProperties withAdditionalData(AssignmentPropertiesAdditionalData additionalData) { + this.additionalData = additionalData; + return this; + } + + /** + * Get the metadata property: The assignment metadata. Metadata is an open ended object and is typically a + * collection of key value pairs. + * + * @return the metadata value. + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The assignment metadata. Metadata is an open ended object and is typically a + * collection of key value pairs. + * + * @param metadata the metadata value to set. + * @return the AssignmentProperties object itself. + */ + public AssignmentProperties withMetadata(Object 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 (assignedComponent() != null) { + assignedComponent().validate(); + } + if (additionalData() != null) { + additionalData().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.writeJsonField("assignedComponent", this.assignedComponent); + jsonWriter.writeStringField("scope", this.scope); + jsonWriter.writeStringField("effect", this.effect); + jsonWriter.writeStringField("expiresOn", + this.expiresOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiresOn)); + jsonWriter.writeJsonField("additionalData", this.additionalData); + if (this.metadata != null) { + jsonWriter.writeUntypedField("metadata", this.metadata); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignmentProperties 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 AssignmentProperties. + */ + public static AssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignmentProperties deserializedAssignmentProperties = new AssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedAssignmentProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAssignmentProperties.description = reader.getString(); + } else if ("assignedStandard".equals(fieldName)) { + deserializedAssignmentProperties.assignedStandard = AssignedStandardItem.fromJson(reader); + } else if ("assignedComponent".equals(fieldName)) { + deserializedAssignmentProperties.assignedComponent = AssignedComponentItem.fromJson(reader); + } else if ("scope".equals(fieldName)) { + deserializedAssignmentProperties.scope = reader.getString(); + } else if ("effect".equals(fieldName)) { + deserializedAssignmentProperties.effect = reader.getString(); + } else if ("expiresOn".equals(fieldName)) { + deserializedAssignmentProperties.expiresOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("additionalData".equals(fieldName)) { + deserializedAssignmentProperties.additionalData + = AssignmentPropertiesAdditionalData.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + deserializedAssignmentProperties.metadata = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignmentProperties; + }); + } +} 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 new file mode 100644 index 000000000000..792c0b85896f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutoProvision; +import java.io.IOException; + +/** + * Auto provisioning setting. + */ +@Fluent +public final class AutoProvisioningSettingInner extends ProxyResource { + /* + * Auto provisioning setting data + */ + private AutoProvisioningSettingProperties 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 AutoProvisioningSettingInner class. + */ + public AutoProvisioningSettingInner() { + } + + /** + * Get the innerProperties property: Auto provisioning setting data. + * + * @return the innerProperties value. + */ + private AutoProvisioningSettingProperties 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 autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @return the autoProvision value. + */ + public AutoProvision autoProvision() { + return this.innerProperties() == null ? null : this.innerProperties().autoProvision(); + } + + /** + * Set the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @param autoProvision the autoProvision value to set. + * @return the AutoProvisioningSettingInner object itself. + */ + public AutoProvisioningSettingInner withAutoProvision(AutoProvision autoProvision) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoProvisioningSettingProperties(); + } + this.innerProperties().withAutoProvision(autoProvision); + 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 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 if ("systemData".equals(fieldName)) { + deserializedAutoProvisioningSettingInner.systemData = SystemData.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 new file mode 100644 index 000000000000..59d439d928b1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingProperties.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AutoProvision; +import java.io.IOException; + +/** + * describes properties of an auto provisioning setting. + */ +@Fluent +public final class AutoProvisioningSettingProperties implements JsonSerializable { + /* + * Describes what kind of security agent provisioning action to take + */ + private AutoProvision autoProvision; + + /** + * Creates an instance of AutoProvisioningSettingProperties class. + */ + public AutoProvisioningSettingProperties() { + } + + /** + * Get the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @return the autoProvision value. + */ + public AutoProvision autoProvision() { + return this.autoProvision; + } + + /** + * Set the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @param autoProvision the autoProvision value to set. + * @return the AutoProvisioningSettingProperties object itself. + */ + public AutoProvisioningSettingProperties withAutoProvision(AutoProvision autoProvision) { + this.autoProvision = autoProvision; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoProvision() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property autoProvision in model AutoProvisioningSettingProperties")); + } + } + + 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 new file mode 100644 index 000000000000..c7cdf2f6c46e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutomationAction; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The security automation resource. + */ +@Fluent +public final class AutomationInner extends ProxyResource { + /* + * Security automation data + */ + private AutomationProperties innerProperties; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * Kind of the resource + */ + private String kind; + + /* + * Entity tag is used for comparing two or more entities from the same requested resource. + */ + private String etag; + + /* + * 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 AutomationInner class. + */ + public AutomationInner() { + } + + /** + * Get the innerProperties property: Security automation data. + * + * @return the innerProperties value. + */ + private AutomationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the kind property: Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of the resource. + * + * @param kind the kind value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @param etag the etag value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * 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 description property: The security automation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The security automation description. + * + * @param description the description value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the isEnabled property: Indicates whether the security automation is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: Indicates whether the security automation is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withIsEnabled(Boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the scopes property: 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. + * + * @return the scopes value. + */ + public List scopes() { + return this.innerProperties() == null ? null : this.innerProperties().scopes(); + } + + /** + * Set the scopes property: 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. + * + * @param scopes the scopes value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withScopes(List scopes) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withScopes(scopes); + return this; + } + + /** + * Get the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @return the sources value. + */ + public List sources() { + return this.innerProperties() == null ? null : this.innerProperties().sources(); + } + + /** + * Set the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @param sources the sources value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withSources(List sources) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withSources(sources); + return this; + } + + /** + * Get the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @return the actions value. + */ + public List actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @param actions the actions value to set. + * @return the AutomationInner object itself. + */ + public AutomationInner withActions(List actions) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withActions(actions); + 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); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("etag", this.etag); + 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 ("properties".equals(fieldName)) { + deserializedAutomationInner.innerProperties = AutomationProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAutomationInner.tags = tags; + } else if ("location".equals(fieldName)) { + deserializedAutomationInner.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAutomationInner.kind = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedAutomationInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAutomationInner.systemData = SystemData.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 new file mode 100644 index 000000000000..ebe1ba3c1961 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationProperties.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutomationAction; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import java.io.IOException; +import java.util.List; + +/** + * A set of properties that defines the behavior of the automation configuration. To learn more about the supported + * security events data models schemas - please visit https://aka.ms/ASCAutomationSchemas. + */ +@Fluent +public final class AutomationProperties implements JsonSerializable { + /* + * The security automation description. + */ + private String description; + + /* + * Indicates whether the security automation is enabled. + */ + 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. + */ + private List scopes; + + /* + * A collection of the source event types which evaluate the security automation set of rules. + */ + 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. + */ + private List actions; + + /** + * Creates an instance of AutomationProperties class. + */ + public AutomationProperties() { + } + + /** + * Get the description property: The security automation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The security automation description. + * + * @param description the description value to set. + * @return the AutomationProperties object itself. + */ + public AutomationProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the isEnabled property: Indicates whether the security automation is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Indicates whether the security automation is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AutomationProperties object itself. + */ + public AutomationProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the scopes property: 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. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: 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. + * + * @param scopes the scopes value to set. + * @return the AutomationProperties object itself. + */ + public AutomationProperties withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @return the sources value. + */ + public List sources() { + return this.sources; + } + + /** + * Set the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @param sources the sources value to set. + * @return the AutomationProperties object itself. + */ + public AutomationProperties withSources(List sources) { + this.sources = sources; + return this; + } + + /** + * Get the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @param actions the actions value to set. + * @return the AutomationProperties object itself. + */ + public AutomationProperties withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scopes() != null) { + scopes().forEach(e -> e.validate()); + } + if (sources() != null) { + sources().forEach(e -> e.validate()); + } + if (actions() != null) { + 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 new file mode 100644 index 000000000000..ad0af56ac31b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; + +/** + * The security automation model state property bag. + */ +@Immutable +public final class AutomationValidationStatusInner implements JsonSerializable { + /* + * Indicates whether the model is valid or not. + */ + private Boolean isValid; + + /* + * The validation message. + */ + private String message; + + /** + * Creates an instance of AutomationValidationStatusInner class. + */ + private AutomationValidationStatusInner() { + } + + /** + * Get the isValid property: Indicates whether the model is valid or not. + * + * @return the isValid value. + */ + public Boolean isValid() { + return this.isValid; + } + + /** + * Get the message property: The validation message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * 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("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 new file mode 100644 index 000000000000..40ee763dcefb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsOrgProperties; +import java.io.IOException; + +/** + * Azure DevOps Organization resource. + */ +@Fluent +public final class AzureDevOpsOrgInner extends ProxyResource { + /* + * Azure DevOps Organization properties. + */ + private AzureDevOpsOrgProperties properties; + + /* + * 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 AzureDevOpsOrgInner class. + */ + public AzureDevOpsOrgInner() { + } + + /** + * Get the properties property: Azure DevOps Organization properties. + * + * @return the properties value. + */ + public AzureDevOpsOrgProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Azure DevOps Organization properties. + * + * @param properties the properties value to set. + * @return the AzureDevOpsOrgInner object itself. + */ + public AzureDevOpsOrgInner withProperties(AzureDevOpsOrgProperties properties) { + this.properties = properties; + return this; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.properties = AzureDevOpsOrgProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.systemData = SystemData.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 new file mode 100644 index 000000000000..2168e9d05d27 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class AzureDevOpsOrgListResponseInner implements JsonSerializable { + /* + * The AzureDevOpsOrg items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of AzureDevOpsOrgListResponseInner class. + */ + private AzureDevOpsOrgListResponseInner() { + } + + /** + * Get the value property: The AzureDevOpsOrg items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 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 new file mode 100644 index 000000000000..4d18aaae609f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsProjectInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsProjectProperties; +import java.io.IOException; + +/** + * Azure DevOps Project resource. + */ +@Fluent +public final class AzureDevOpsProjectInner extends ProxyResource { + /* + * Azure DevOps Project properties. + */ + private AzureDevOpsProjectProperties properties; + + /* + * 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 AzureDevOpsProjectInner class. + */ + public AzureDevOpsProjectInner() { + } + + /** + * Get the properties property: Azure DevOps Project properties. + * + * @return the properties value. + */ + public AzureDevOpsProjectProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Azure DevOps Project properties. + * + * @param properties the properties value to set. + * @return the AzureDevOpsProjectInner object itself. + */ + public AzureDevOpsProjectInner withProperties(AzureDevOpsProjectProperties properties) { + this.properties = properties; + return this; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.properties = AzureDevOpsProjectProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.systemData = SystemData.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 new file mode 100644 index 000000000000..4ce64bb6a26c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsRepositoryInner.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsRepositoryProperties; +import java.io.IOException; + +/** + * Azure DevOps Repository resource. + */ +@Fluent +public final class AzureDevOpsRepositoryInner extends ProxyResource { + /* + * Azure DevOps Repository properties. + */ + private AzureDevOpsRepositoryProperties properties; + + /* + * 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 AzureDevOpsRepositoryInner class. + */ + public AzureDevOpsRepositoryInner() { + } + + /** + * Get the properties property: Azure DevOps Repository properties. + * + * @return the properties value. + */ + public AzureDevOpsRepositoryProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Azure DevOps Repository properties. + * + * @param properties the properties value to set. + * @return the AzureDevOpsRepositoryInner object itself. + */ + public AzureDevOpsRepositoryInner withProperties(AzureDevOpsRepositoryProperties properties) { + this.properties = properties; + return this; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.properties + = AzureDevOpsRepositoryProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.systemData = SystemData.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 new file mode 100644 index 000000000000..96ac8be0163e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.ComplianceSegment; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Compliance of a scope. + */ +@Immutable +public final class ComplianceInner extends ProxyResource { + /* + * Compliance data + */ + private ComplianceProperties 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 ComplianceInner class. + */ + private ComplianceInner() { + } + + /** + * Get the innerProperties property: Compliance data. + * + * @return the innerProperties value. + */ + private ComplianceProperties 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 assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted. + * + * @return the assessmentTimestampUtcDate value. + */ + public OffsetDateTime assessmentTimestampUtcDate() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentTimestampUtcDate(); + } + + /** + * Get the resourceCount property: The resource count of the given subscription for which the Compliance calculation + * was conducted (needed for Management Group Compliance calculation). + * + * @return the resourceCount value. + */ + public Integer resourceCount() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCount(); + } + + /** + * Get the assessmentResult property: An array of segment, which is the actually the compliance assessment. + * + * @return the assessmentResult value. + */ + public List assessmentResult() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentResult(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedComplianceInner.systemData = SystemData.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 new file mode 100644 index 000000000000..2f1d1498feb0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The Compliance score (percentage) of a Subscription is a sum of all Resources' Compliances under the given + * Subscription. A Resource Compliance is defined as the compliant ('healthy') Policy Definitions out of all Policy + * Definitions applicable to a given resource. + */ +@Immutable +public final class ComplianceProperties implements JsonSerializable { + /* + * The timestamp when the Compliance calculation was conducted. + */ + private OffsetDateTime assessmentTimestampUtcDate; + + /* + * The resource count of the given subscription for which the Compliance calculation was conducted (needed for + * Management Group Compliance calculation). + */ + private Integer resourceCount; + + /* + * An array of segment, which is the actually the compliance assessment. + */ + private List assessmentResult; + + /** + * Creates an instance of ComplianceProperties class. + */ + private ComplianceProperties() { + } + + /** + * Get the assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted. + * + * @return the assessmentTimestampUtcDate value. + */ + public OffsetDateTime assessmentTimestampUtcDate() { + return this.assessmentTimestampUtcDate; + } + + /** + * Get the resourceCount property: The resource count of the given subscription for which the Compliance calculation + * was conducted (needed for Management Group Compliance calculation). + * + * @return the resourceCount value. + */ + public Integer resourceCount() { + return this.resourceCount; + } + + /** + * Get the assessmentResult property: An array of segment, which is the actually the compliance assessment. + * + * @return the assessmentResult value. + */ + public List assessmentResult() { + return this.assessmentResult; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (assessmentResult() != null) { + 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 c2f0b5b178fd..eaf829668cc0 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -22,6 +23,11 @@ public final class ComplianceResultInner extends ProxyResource { */ private ComplianceResultProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -40,7 +46,7 @@ public final class ComplianceResultInner extends ProxyResource { /** * Creates an instance of ComplianceResultInner class. */ - public ComplianceResultInner() { + private ComplianceResultInner() { } /** @@ -52,6 +58,15 @@ private ComplianceResultProperties 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. * @@ -136,6 +151,8 @@ public static ComplianceResultInner fromJson(JsonReader jsonReader) throws IOExc deserializedComplianceResultInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedComplianceResultInner.innerProperties = ComplianceResultProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedComplianceResultInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 ba3151e68485..1ffbe27cdd07 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -25,7 +25,7 @@ public final class ComplianceResultProperties implements JsonSerializable { + DefenderForStorageSettingInner deserializedDefenderForStorageSettingInner + = new DefenderForStorageSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + 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 if ("systemData".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForStorageSettingInner; + }); + } +} 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 new file mode 100644 index 000000000000..5909c6b6e068 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsConfigurationInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.DevOpsConfigurationProperties; +import java.io.IOException; + +/** + * DevOps Configuration resource. + */ +@Fluent +public final class DevOpsConfigurationInner extends ProxyResource { + /* + * DevOps Configuration properties. + */ + private DevOpsConfigurationProperties properties; + + /* + * 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 DevOpsConfigurationInner class. + */ + public DevOpsConfigurationInner() { + } + + /** + * Get the properties property: DevOps Configuration properties. + * + * @return the properties value. + */ + public DevOpsConfigurationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: DevOps Configuration properties. + * + * @param properties the properties value to set. + * @return the DevOpsConfigurationInner object itself. + */ + public DevOpsConfigurationInner withProperties(DevOpsConfigurationProperties properties) { + this.properties = properties; + return this; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedDevOpsConfigurationInner.properties = DevOpsConfigurationProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDevOpsConfigurationInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsConfigurationInner; + }); + } +} 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 8ae4b0c4c65b..5dd6a975bd79 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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; @@ -26,6 +27,11 @@ public final class DeviceSecurityGroupInner extends ProxyResource { */ private DeviceSecurityGroupProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -56,6 +62,15 @@ private DeviceSecurityGroupProperties 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. * @@ -224,6 +239,8 @@ public static DeviceSecurityGroupInner fromJson(JsonReader jsonReader) throws IO } else if ("properties".equals(fieldName)) { deserializedDeviceSecurityGroupInner.innerProperties = DeviceSecurityGroupProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDeviceSecurityGroupInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 0b47e4dcff06..cf1b8bf86d44 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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 1db9bbbc96cf..fcb129146d14 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; @@ -14,20 +15,25 @@ import java.io.IOException; /** - * The DiscoveredSecuritySolution model. + * Concrete proxy resource types can be created by aliasing this type using a specific property type. */ -@Fluent +@Immutable public final class DiscoveredSecuritySolutionInner extends ProxyResource { /* * The properties property. */ - private DiscoveredSecuritySolutionProperties innerProperties = new DiscoveredSecuritySolutionProperties(); + private DiscoveredSecuritySolutionProperties innerProperties; /* * Location where the resource is stored */ private String location; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -46,7 +52,7 @@ public final class DiscoveredSecuritySolutionInner extends ProxyResource { /** * Creates an instance of DiscoveredSecuritySolutionInner class. */ - public DiscoveredSecuritySolutionInner() { + private DiscoveredSecuritySolutionInner() { } /** @@ -67,6 +73,15 @@ public String location() { return this.location; } + /** + * 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. * @@ -106,20 +121,6 @@ public SecurityFamily securityFamily() { return this.innerProperties() == null ? null : this.innerProperties().securityFamily(); } - /** - * Set the securityFamily property: The security family of the discovered solution. - * - * @param securityFamily the securityFamily value to set. - * @return the DiscoveredSecuritySolutionInner object itself. - */ - public DiscoveredSecuritySolutionInner withSecurityFamily(SecurityFamily securityFamily) { - if (this.innerProperties() == null) { - this.innerProperties = new DiscoveredSecuritySolutionProperties(); - } - this.innerProperties().withSecurityFamily(securityFamily); - return this; - } - /** * Get the offer property: The security solutions' image offer. * @@ -129,20 +130,6 @@ public String offer() { return this.innerProperties() == null ? null : this.innerProperties().offer(); } - /** - * Set the offer property: The security solutions' image offer. - * - * @param offer the offer value to set. - * @return the DiscoveredSecuritySolutionInner object itself. - */ - public DiscoveredSecuritySolutionInner withOffer(String offer) { - if (this.innerProperties() == null) { - this.innerProperties = new DiscoveredSecuritySolutionProperties(); - } - this.innerProperties().withOffer(offer); - return this; - } - /** * Get the publisher property: The security solutions' image publisher. * @@ -152,20 +139,6 @@ public String publisher() { return this.innerProperties() == null ? null : this.innerProperties().publisher(); } - /** - * Set the publisher property: The security solutions' image publisher. - * - * @param publisher the publisher value to set. - * @return the DiscoveredSecuritySolutionInner object itself. - */ - public DiscoveredSecuritySolutionInner withPublisher(String publisher) { - if (this.innerProperties() == null) { - this.innerProperties = new DiscoveredSecuritySolutionProperties(); - } - this.innerProperties().withPublisher(publisher); - return this; - } - /** * Get the sku property: The security solutions' image sku. * @@ -175,20 +148,6 @@ public String sku() { return this.innerProperties() == null ? null : this.innerProperties().sku(); } - /** - * Set the sku property: The security solutions' image sku. - * - * @param sku the sku value to set. - * @return the DiscoveredSecuritySolutionInner object itself. - */ - public DiscoveredSecuritySolutionInner withSku(String sku) { - if (this.innerProperties() == null) { - this.innerProperties = new DiscoveredSecuritySolutionProperties(); - } - this.innerProperties().withSku(sku); - return this; - } - /** * Validates the instance. * @@ -244,6 +203,8 @@ public static DiscoveredSecuritySolutionInner fromJson(JsonReader jsonReader) th = DiscoveredSecuritySolutionProperties.fromJson(reader); } else if ("location".equals(fieldName)) { deserializedDiscoveredSecuritySolutionInner.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 22eda29f8b3e..61a47b7b197b 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -16,7 +16,7 @@ /** * The DiscoveredSecuritySolutionProperties model. */ -@Fluent +@Immutable public final class DiscoveredSecuritySolutionProperties implements JsonSerializable { /* @@ -42,7 +42,7 @@ public final class DiscoveredSecuritySolutionProperties /** * Creates an instance of DiscoveredSecuritySolutionProperties class. */ - public DiscoveredSecuritySolutionProperties() { + private DiscoveredSecuritySolutionProperties() { } /** @@ -54,17 +54,6 @@ public SecurityFamily securityFamily() { return this.securityFamily; } - /** - * Set the securityFamily property: The security family of the discovered solution. - * - * @param securityFamily the securityFamily value to set. - * @return the DiscoveredSecuritySolutionProperties object itself. - */ - public DiscoveredSecuritySolutionProperties withSecurityFamily(SecurityFamily securityFamily) { - this.securityFamily = securityFamily; - return this; - } - /** * Get the offer property: The security solutions' image offer. * @@ -74,17 +63,6 @@ public String offer() { return this.offer; } - /** - * Set the offer property: The security solutions' image offer. - * - * @param offer the offer value to set. - * @return the DiscoveredSecuritySolutionProperties object itself. - */ - public DiscoveredSecuritySolutionProperties withOffer(String offer) { - this.offer = offer; - return this; - } - /** * Get the publisher property: The security solutions' image publisher. * @@ -94,17 +72,6 @@ public String publisher() { return this.publisher; } - /** - * Set the publisher property: The security solutions' image publisher. - * - * @param publisher the publisher value to set. - * @return the DiscoveredSecuritySolutionProperties object itself. - */ - public DiscoveredSecuritySolutionProperties withPublisher(String publisher) { - this.publisher = publisher; - return this; - } - /** * Get the sku property: The security solutions' image sku. * @@ -114,17 +81,6 @@ public String sku() { return this.sku; } - /** - * Set the sku property: The security solutions' image sku. - * - * @param sku the sku value to set. - * @return the DiscoveredSecuritySolutionProperties object itself. - */ - public DiscoveredSecuritySolutionProperties withSku(String sku) { - this.sku = sku; - return this; - } - /** * Validates the instance. * 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 31a45b5549c0..2a409c9f4008 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -26,11 +27,21 @@ public class ExternalSecuritySolutionInner extends ProxyResource { */ private ExternalSecuritySolutionKind kind = ExternalSecuritySolutionKind.fromString("ExternalSecuritySolution"); + /* + * The resource-specific properties for this resource. + */ + private Object properties; + /* * Location where the resource is stored */ private String location; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -49,7 +60,7 @@ public class ExternalSecuritySolutionInner extends ProxyResource { /** * Creates an instance of ExternalSecuritySolutionInner class. */ - public ExternalSecuritySolutionInner() { + protected ExternalSecuritySolutionInner() { } /** @@ -61,6 +72,26 @@ public ExternalSecuritySolutionKind kind() { return this.kind; } + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ExternalSecuritySolutionInner object itself. + */ + ExternalSecuritySolutionInner withProperties(Object properties) { + this.properties = properties; + return this; + } + /** * Get the location property: Location where the resource is stored. * @@ -81,6 +112,26 @@ ExternalSecuritySolutionInner withLocation(String location) { return this; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + 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 ExternalSecuritySolutionInner object itself. + */ + ExternalSecuritySolutionInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + /** * Get the type property: The type of the resource. * @@ -126,6 +177,9 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + if (this.properties != null) { + jsonWriter.writeUntypedField("properties", this.properties); + } return jsonWriter.writeEndObject(); } @@ -184,8 +238,12 @@ static ExternalSecuritySolutionInner fromJsonKnownDiscriminator(JsonReader jsonR } else if ("kind".equals(fieldName)) { deserializedExternalSecuritySolutionInner.kind = ExternalSecuritySolutionKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedExternalSecuritySolutionInner.properties = reader.readUntyped(); } else if ("location".equals(fieldName)) { deserializedExternalSecuritySolutionInner.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedExternalSecuritySolutionInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 new file mode 100644 index 000000000000..4c38cf74997d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsListResponseInner.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.util.List; + +/** + * A list with a single sensitivity settings resource. + */ +@Immutable +public final class GetSensitivitySettingsListResponseInner + implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /** + * Creates an instance of GetSensitivitySettingsListResponseInner class. + */ + private GetSensitivitySettingsListResponseInner() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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)); + 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 new file mode 100644 index 000000000000..201a167a6dc2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsResponseInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.GetSensitivitySettingsResponseProperties; +import java.io.IOException; + +/** + * Data sensitivity settings for sensitive data discovery. + */ +@Immutable +public final class GetSensitivitySettingsResponseInner extends ProxyResource { + /* + * The sensitivity settings properties + */ + private GetSensitivitySettingsResponseProperties properties; + + /* + * 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 GetSensitivitySettingsResponseInner class. + */ + private GetSensitivitySettingsResponseInner() { + } + + /** + * Get the properties property: The sensitivity settings properties. + * + * @return the properties value. + */ + public GetSensitivitySettingsResponseProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.systemData = SystemData.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 new file mode 100644 index 000000000000..70583efdaec5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.GitHubOwnerProperties; +import java.io.IOException; + +/** + * GitHub Owner resource. + */ +@Immutable +public final class GitHubOwnerInner extends ProxyResource { + /* + * GitHub Owner properties. + */ + private GitHubOwnerProperties properties; + + /* + * 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 GitHubOwnerInner class. + */ + private GitHubOwnerInner() { + } + + /** + * Get the properties property: GitHub Owner properties. + * + * @return the properties value. + */ + public GitHubOwnerProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedGitHubOwnerInner.properties = GitHubOwnerProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGitHubOwnerInner.systemData = SystemData.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 new file mode 100644 index 000000000000..bdc6ae5e6902 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class GitHubOwnerListResponseInner implements JsonSerializable { + /* + * The GitHubOwner items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of GitHubOwnerListResponseInner class. + */ + private GitHubOwnerListResponseInner() { + } + + /** + * Get the value property: The GitHubOwner items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 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 new file mode 100644 index 000000000000..4ca36e0d4b8c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubRepositoryInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.GitHubRepositoryProperties; +import java.io.IOException; + +/** + * GitHub Repository resource. + */ +@Immutable +public final class GitHubRepositoryInner extends ProxyResource { + /* + * GitHub Repository properties. + */ + private GitHubRepositoryProperties properties; + + /* + * 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 GitHubRepositoryInner class. + */ + private GitHubRepositoryInner() { + } + + /** + * Get the properties property: GitHub Repository properties. + * + * @return the properties value. + */ + public GitHubRepositoryProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedGitHubRepositoryInner.properties = GitHubRepositoryProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGitHubRepositoryInner.systemData = SystemData.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 new file mode 100644 index 000000000000..ddc0d53037e1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.GitLabGroupProperties; +import java.io.IOException; + +/** + * GitLab Group resource. + */ +@Immutable +public final class GitLabGroupInner extends ProxyResource { + /* + * GitLab Group properties. + */ + private GitLabGroupProperties properties; + + /* + * 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 GitLabGroupInner class. + */ + private GitLabGroupInner() { + } + + /** + * Get the properties property: GitLab Group properties. + * + * @return the properties value. + */ + public GitLabGroupProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedGitLabGroupInner.properties = GitLabGroupProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGitLabGroupInner.systemData = SystemData.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 new file mode 100644 index 000000000000..64e94550173b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class GitLabGroupListResponseInner implements JsonSerializable { + /* + * The GitLabGroup items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of GitLabGroupListResponseInner class. + */ + private GitLabGroupListResponseInner() { + } + + /** + * Get the value property: The GitLabGroup items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 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 new file mode 100644 index 000000000000..9760fb5acacf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabProjectInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.GitLabProjectProperties; +import java.io.IOException; + +/** + * GitLab Project resource. + */ +@Immutable +public final class GitLabProjectInner extends ProxyResource { + /* + * GitLab Project properties. + */ + private GitLabProjectProperties properties; + + /* + * 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 GitLabProjectInner class. + */ + private GitLabProjectInner() { + } + + /** + * Get the properties property: GitLab Project properties. + * + * @return the properties value. + */ + public GitLabProjectProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 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 ("properties".equals(fieldName)) { + deserializedGitLabProjectInner.properties = GitLabProjectProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGitLabProjectInner.systemData = SystemData.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 new file mode 100644 index 000000000000..7e88a433fcb2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceAssignmentAdditionalData; +import com.azure.resourcemanager.security.models.GovernanceEmailNotification; +import com.azure.resourcemanager.security.models.RemediationEta; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Governance assignment over a given scope. + */ +@Fluent +public final class GovernanceAssignmentInner extends ProxyResource { + /* + * The properties of a governance assignment + */ + private GovernanceAssignmentProperties 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 GovernanceAssignmentInner class. + */ + public GovernanceAssignmentInner() { + } + + /** + * Get the innerProperties property: The properties of a governance assignment. + * + * @return the innerProperties value. + */ + private GovernanceAssignmentProperties 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 owner property: The Owner for the governance assignment - e.g. user@contoso.com - see example. + * + * @return the owner value. + */ + public String owner() { + return this.innerProperties() == null ? null : this.innerProperties().owner(); + } + + /** + * Set the owner property: The Owner for the governance assignment - e.g. user@contoso.com - see example. + * + * @param owner the owner value to set. + * @return the GovernanceAssignmentInner object itself. + */ + public GovernanceAssignmentInner withOwner(String owner) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceAssignmentProperties(); + } + this.innerProperties().withOwner(owner); + return this; + } + + /** + * Get the remediationDueDate property: The remediation due-date - after this date Secure Score will be affected (in + * case of active grace-period). + * + * @return the remediationDueDate value. + */ + public OffsetDateTime remediationDueDate() { + return this.innerProperties() == null ? null : this.innerProperties().remediationDueDate(); + } + + /** + * Set the remediationDueDate property: The remediation due-date - after this date Secure Score will be affected (in + * case of active grace-period). + * + * @param remediationDueDate the remediationDueDate value to set. + * @return the GovernanceAssignmentInner object itself. + */ + public GovernanceAssignmentInner withRemediationDueDate(OffsetDateTime remediationDueDate) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceAssignmentProperties(); + } + this.innerProperties().withRemediationDueDate(remediationDueDate); + return this; + } + + /** + * Get the remediationEta property: The ETA (estimated time of arrival) for remediation (optional), see example. + * + * @return the remediationEta value. + */ + public RemediationEta remediationEta() { + return this.innerProperties() == null ? null : this.innerProperties().remediationEta(); + } + + /** + * Set the remediationEta property: The ETA (estimated time of arrival) for remediation (optional), see example. + * + * @param remediationEta the remediationEta value to set. + * @return the GovernanceAssignmentInner object itself. + */ + public GovernanceAssignmentInner withRemediationEta(RemediationEta remediationEta) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceAssignmentProperties(); + } + this.innerProperties().withRemediationEta(remediationEta); + return this; + } + + /** + * Get the isGracePeriod property: Defines whether there is a grace period on the governance assignment. + * + * @return the isGracePeriod value. + */ + public Boolean isGracePeriod() { + return this.innerProperties() == null ? null : this.innerProperties().isGracePeriod(); + } + + /** + * Set the isGracePeriod property: Defines whether there is a grace period on the governance assignment. + * + * @param isGracePeriod the isGracePeriod value to set. + * @return the GovernanceAssignmentInner object itself. + */ + public GovernanceAssignmentInner withIsGracePeriod(Boolean isGracePeriod) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceAssignmentProperties(); + } + this.innerProperties().withIsGracePeriod(isGracePeriod); + return this; + } + + /** + * Get the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @return the governanceEmailNotification value. + */ + public GovernanceEmailNotification governanceEmailNotification() { + return this.innerProperties() == null ? null : this.innerProperties().governanceEmailNotification(); + } + + /** + * Set the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @param governanceEmailNotification the governanceEmailNotification value to set. + * @return the GovernanceAssignmentInner object itself. + */ + public GovernanceAssignmentInner + withGovernanceEmailNotification(GovernanceEmailNotification governanceEmailNotification) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceAssignmentProperties(); + } + this.innerProperties().withGovernanceEmailNotification(governanceEmailNotification); + return this; + } + + /** + * Get the additionalData property: The additional data for the governance assignment - e.g. links to ticket + * (optional), see example. + * + * @return the additionalData value. + */ + public GovernanceAssignmentAdditionalData additionalData() { + return this.innerProperties() == null ? null : this.innerProperties().additionalData(); + } + + /** + * Set the additionalData property: The additional data for the governance assignment - e.g. links to ticket + * (optional), see example. + * + * @param additionalData the additionalData value to set. + * @return the GovernanceAssignmentInner object itself. + */ + public GovernanceAssignmentInner withAdditionalData(GovernanceAssignmentAdditionalData additionalData) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceAssignmentProperties(); + } + this.innerProperties().withAdditionalData(additionalData); + 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 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 if ("systemData".equals(fieldName)) { + deserializedGovernanceAssignmentInner.systemData = SystemData.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 new file mode 100644 index 000000000000..f918d5ecbff3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentProperties.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Describes properties of an governance assignment. + */ +@Fluent +public final class GovernanceAssignmentProperties implements JsonSerializable { + /* + * The Owner for the governance assignment - e.g. user@contoso.com - see example + */ + private String owner; + + /* + * The remediation due-date - after this date Secure Score will be affected (in case of active grace-period) + */ + private OffsetDateTime remediationDueDate; + + /* + * The ETA (estimated time of arrival) for remediation (optional), see example + */ + private RemediationEta remediationEta; + + /* + * Defines whether there is a grace period on the governance assignment + */ + private Boolean isGracePeriod; + + /* + * The email notifications settings for the governance rule, states whether to disable notifications for mangers and + * owners + */ + private GovernanceEmailNotification governanceEmailNotification; + + /* + * The additional data for the governance assignment - e.g. links to ticket (optional), see example + */ + private GovernanceAssignmentAdditionalData additionalData; + + /** + * Creates an instance of GovernanceAssignmentProperties class. + */ + public GovernanceAssignmentProperties() { + } + + /** + * Get the owner property: The Owner for the governance assignment - e.g. user@contoso.com - see example. + * + * @return the owner value. + */ + public String owner() { + return this.owner; + } + + /** + * Set the owner property: The Owner for the governance assignment - e.g. user@contoso.com - see example. + * + * @param owner the owner value to set. + * @return the GovernanceAssignmentProperties object itself. + */ + public GovernanceAssignmentProperties withOwner(String owner) { + this.owner = owner; + return this; + } + + /** + * Get the remediationDueDate property: The remediation due-date - after this date Secure Score will be affected (in + * case of active grace-period). + * + * @return the remediationDueDate value. + */ + public OffsetDateTime remediationDueDate() { + return this.remediationDueDate; + } + + /** + * Set the remediationDueDate property: The remediation due-date - after this date Secure Score will be affected (in + * case of active grace-period). + * + * @param remediationDueDate the remediationDueDate value to set. + * @return the GovernanceAssignmentProperties object itself. + */ + public GovernanceAssignmentProperties withRemediationDueDate(OffsetDateTime remediationDueDate) { + this.remediationDueDate = remediationDueDate; + return this; + } + + /** + * Get the remediationEta property: The ETA (estimated time of arrival) for remediation (optional), see example. + * + * @return the remediationEta value. + */ + public RemediationEta remediationEta() { + return this.remediationEta; + } + + /** + * Set the remediationEta property: The ETA (estimated time of arrival) for remediation (optional), see example. + * + * @param remediationEta the remediationEta value to set. + * @return the GovernanceAssignmentProperties object itself. + */ + public GovernanceAssignmentProperties withRemediationEta(RemediationEta remediationEta) { + this.remediationEta = remediationEta; + return this; + } + + /** + * Get the isGracePeriod property: Defines whether there is a grace period on the governance assignment. + * + * @return the isGracePeriod value. + */ + public Boolean isGracePeriod() { + return this.isGracePeriod; + } + + /** + * Set the isGracePeriod property: Defines whether there is a grace period on the governance assignment. + * + * @param isGracePeriod the isGracePeriod value to set. + * @return the GovernanceAssignmentProperties object itself. + */ + public GovernanceAssignmentProperties withIsGracePeriod(Boolean isGracePeriod) { + this.isGracePeriod = isGracePeriod; + return this; + } + + /** + * Get the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @return the governanceEmailNotification value. + */ + public GovernanceEmailNotification governanceEmailNotification() { + return this.governanceEmailNotification; + } + + /** + * Set the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @param governanceEmailNotification the governanceEmailNotification value to set. + * @return the GovernanceAssignmentProperties object itself. + */ + public GovernanceAssignmentProperties + withGovernanceEmailNotification(GovernanceEmailNotification governanceEmailNotification) { + this.governanceEmailNotification = governanceEmailNotification; + return this; + } + + /** + * Get the additionalData property: The additional data for the governance assignment - e.g. links to ticket + * (optional), see example. + * + * @return the additionalData value. + */ + public GovernanceAssignmentAdditionalData additionalData() { + return this.additionalData; + } + + /** + * Set the additionalData property: The additional data for the governance assignment - e.g. links to ticket + * (optional), see example. + * + * @param additionalData the additionalData value to set. + * @return the GovernanceAssignmentProperties object itself. + */ + public GovernanceAssignmentProperties withAdditionalData(GovernanceAssignmentAdditionalData additionalData) { + this.additionalData = additionalData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (remediationDueDate() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property remediationDueDate in model GovernanceAssignmentProperties")); + } + if (remediationEta() != null) { + remediationEta().validate(); + } + if (governanceEmailNotification() != null) { + governanceEmailNotification().validate(); + } + if (additionalData() != null) { + additionalData().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 new file mode 100644 index 000000000000..246f345eb4ad --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleInner.java @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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 java.io.IOException; +import java.util.List; + +/** + * Governance rule over a given scope. + */ +@Fluent +public final class GovernanceRuleInner extends ProxyResource { + /* + * Properties of a governance rule + */ + private GovernanceRuleProperties 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 GovernanceRuleInner class. + */ + public GovernanceRuleInner() { + } + + /** + * Get the innerProperties property: Properties of a governance rule. + * + * @return the innerProperties value. + */ + private GovernanceRuleProperties 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 tenantId property: The tenantId (GUID). + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Get the displayName property: Display name of the governance rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: Display name of the governance rule. + * + * @param displayName the displayName value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: Description of the governance rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the governance rule. + * + * @param description the description value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the remediationTimeframe property: 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. + * + * @return the remediationTimeframe value. + */ + public String remediationTimeframe() { + return this.innerProperties() == null ? null : this.innerProperties().remediationTimeframe(); + } + + /** + * Set the remediationTimeframe property: 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. + * + * @param remediationTimeframe the remediationTimeframe value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withRemediationTimeframe(String remediationTimeframe) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withRemediationTimeframe(remediationTimeframe); + return this; + } + + /** + * Get the isGracePeriod property: Defines whether there is a grace period on the governance rule. + * + * @return the isGracePeriod value. + */ + public Boolean isGracePeriod() { + return this.innerProperties() == null ? null : this.innerProperties().isGracePeriod(); + } + + /** + * Set the isGracePeriod property: Defines whether there is a grace period on the governance rule. + * + * @param isGracePeriod the isGracePeriod value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withIsGracePeriod(Boolean isGracePeriod) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withIsGracePeriod(isGracePeriod); + return this; + } + + /** + * Get the rulePriority property: The governance rule priority, priority to the lower number. Rules with the same + * priority on the same scope will not be allowed. + * + * @return the rulePriority value. + */ + public Integer rulePriority() { + return this.innerProperties() == null ? null : this.innerProperties().rulePriority(); + } + + /** + * Set the rulePriority property: The governance rule priority, priority to the lower number. Rules with the same + * priority on the same scope will not be allowed. + * + * @param rulePriority the rulePriority value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withRulePriority(Integer rulePriority) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withRulePriority(rulePriority); + return this; + } + + /** + * Get the isDisabled property: Defines whether the rule is active/inactive. + * + * @return the isDisabled value. + */ + public Boolean isDisabled() { + return this.innerProperties() == null ? null : this.innerProperties().isDisabled(); + } + + /** + * Set the isDisabled property: Defines whether the rule is active/inactive. + * + * @param isDisabled the isDisabled value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withIsDisabled(Boolean isDisabled) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withIsDisabled(isDisabled); + return this; + } + + /** + * Get the ruleType property: The rule type of the governance rule, defines the source of the rule e.g. Integrated. + * + * @return the ruleType value. + */ + public GovernanceRuleType ruleType() { + return this.innerProperties() == null ? null : this.innerProperties().ruleType(); + } + + /** + * Set the ruleType property: The rule type of the governance rule, defines the source of the rule e.g. Integrated. + * + * @param ruleType the ruleType value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withRuleType(GovernanceRuleType ruleType) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withRuleType(ruleType); + return this; + } + + /** + * Get the sourceResourceType property: The governance rule source, what the rule affects, e.g. Assessments. + * + * @return the sourceResourceType value. + */ + public GovernanceRuleSourceResourceType sourceResourceType() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceType(); + } + + /** + * Set the sourceResourceType property: The governance rule source, what the rule affects, e.g. Assessments. + * + * @param sourceResourceType the sourceResourceType value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withSourceResourceType(GovernanceRuleSourceResourceType sourceResourceType) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withSourceResourceType(sourceResourceType); + 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 GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withExcludedScopes(List excludedScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withExcludedScopes(excludedScopes); + return this; + } + + /** + * Get the conditionSets property: The governance rule conditionSets - see examples. + * + * @return the conditionSets value. + */ + public List conditionSets() { + return this.innerProperties() == null ? null : this.innerProperties().conditionSets(); + } + + /** + * Set the conditionSets property: The governance rule conditionSets - see examples. + * + * @param conditionSets the conditionSets value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withConditionSets(List conditionSets) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withConditionSets(conditionSets); + return this; + } + + /** + * Get the includeMemberScopes property: Defines whether the rule is management scope rule (master connector as a + * single scope or management scope). + * + * @return the includeMemberScopes value. + */ + public Boolean includeMemberScopes() { + return this.innerProperties() == null ? null : this.innerProperties().includeMemberScopes(); + } + + /** + * Set the includeMemberScopes property: Defines whether the rule is management scope rule (master connector as a + * single scope or management scope). + * + * @param includeMemberScopes the includeMemberScopes value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withIncludeMemberScopes(Boolean includeMemberScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withIncludeMemberScopes(includeMemberScopes); + return this; + } + + /** + * Get the ownerSource property: The owner source for the governance rule - e.g. Manually by user@contoso.com - + * see example. + * + * @return the ownerSource value. + */ + public GovernanceRuleOwnerSource ownerSource() { + return this.innerProperties() == null ? null : this.innerProperties().ownerSource(); + } + + /** + * Set the ownerSource property: The owner source for the governance rule - e.g. Manually by user@contoso.com - + * see example. + * + * @param ownerSource the ownerSource value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withOwnerSource(GovernanceRuleOwnerSource ownerSource) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withOwnerSource(ownerSource); + return this; + } + + /** + * Get the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @return the governanceEmailNotification value. + */ + public GovernanceRuleEmailNotification governanceEmailNotification() { + return this.innerProperties() == null ? null : this.innerProperties().governanceEmailNotification(); + } + + /** + * Set the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @param governanceEmailNotification the governanceEmailNotification value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner + withGovernanceEmailNotification(GovernanceRuleEmailNotification governanceEmailNotification) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + this.innerProperties().withGovernanceEmailNotification(governanceEmailNotification); + return this; + } + + /** + * Get the metadata property: The governance rule metadata. + * + * @return the metadata value. + */ + public GovernanceRuleMetadata metadata() { + return this.innerProperties() == null ? null : this.innerProperties().metadata(); + } + + /** + * Set the metadata property: The governance rule metadata. + * + * @param metadata the metadata value to set. + * @return the GovernanceRuleInner object itself. + */ + public GovernanceRuleInner withMetadata(GovernanceRuleMetadata metadata) { + if (this.innerProperties() == null) { + this.innerProperties = new GovernanceRuleProperties(); + } + 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 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 if ("systemData".equals(fieldName)) { + deserializedGovernanceRuleInner.systemData = SystemData.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 new file mode 100644 index 000000000000..cf68a6fef173 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleProperties.java @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.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 java.io.IOException; +import java.util.List; + +/** + * Describes properties of an governance rule. + */ +@Fluent +public final class GovernanceRuleProperties implements JsonSerializable { + /* + * The tenantId (GUID) + */ + private String tenantId; + + /* + * Display name of the governance rule + */ + private String displayName; + + /* + * Description of the governance rule + */ + 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 + */ + private String remediationTimeframe; + + /* + * Defines whether there is a grace period on the governance rule + */ + 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 + */ + private int rulePriority; + + /* + * Defines whether the rule is active/inactive + */ + private Boolean isDisabled; + + /* + * The rule type of the governance rule, defines the source of the rule e.g. Integrated + */ + private GovernanceRuleType ruleType; + + /* + * The governance rule source, what the rule affects, e.g. Assessments + */ + private GovernanceRuleSourceResourceType sourceResourceType; + + /* + * Excluded scopes, filter out the descendants of the scope (on management scopes) + */ + private List excludedScopes; + + /* + * The governance rule conditionSets - see examples + */ + private List conditionSets; + + /* + * Defines whether the rule is management scope rule (master connector as a single scope or management scope) + */ + private Boolean includeMemberScopes; + + /* + * The owner source for the governance rule - e.g. Manually by user@contoso.com - see example + */ + private GovernanceRuleOwnerSource ownerSource; + + /* + * The email notifications settings for the governance rule, states whether to disable notifications for mangers and + * owners + */ + private GovernanceRuleEmailNotification governanceEmailNotification; + + /* + * The governance rule metadata + */ + private GovernanceRuleMetadata metadata; + + /** + * Creates an instance of GovernanceRuleProperties class. + */ + public GovernanceRuleProperties() { + } + + /** + * Get the tenantId property: The tenantId (GUID). + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the displayName property: Display name of the governance rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the governance rule. + * + * @param displayName the displayName value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Description of the governance rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the governance rule. + * + * @param description the description value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the remediationTimeframe property: 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. + * + * @return the remediationTimeframe value. + */ + public String remediationTimeframe() { + return this.remediationTimeframe; + } + + /** + * Set the remediationTimeframe property: 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. + * + * @param remediationTimeframe the remediationTimeframe value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withRemediationTimeframe(String remediationTimeframe) { + this.remediationTimeframe = remediationTimeframe; + return this; + } + + /** + * Get the isGracePeriod property: Defines whether there is a grace period on the governance rule. + * + * @return the isGracePeriod value. + */ + public Boolean isGracePeriod() { + return this.isGracePeriod; + } + + /** + * Set the isGracePeriod property: Defines whether there is a grace period on the governance rule. + * + * @param isGracePeriod the isGracePeriod value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withIsGracePeriod(Boolean isGracePeriod) { + this.isGracePeriod = isGracePeriod; + return this; + } + + /** + * Get the rulePriority property: The governance rule priority, priority to the lower number. Rules with the same + * priority on the same scope will not be allowed. + * + * @return the rulePriority value. + */ + public int rulePriority() { + return this.rulePriority; + } + + /** + * Set the rulePriority property: The governance rule priority, priority to the lower number. Rules with the same + * priority on the same scope will not be allowed. + * + * @param rulePriority the rulePriority value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withRulePriority(int rulePriority) { + this.rulePriority = rulePriority; + return this; + } + + /** + * Get the isDisabled property: Defines whether the rule is active/inactive. + * + * @return the isDisabled value. + */ + public Boolean isDisabled() { + return this.isDisabled; + } + + /** + * Set the isDisabled property: Defines whether the rule is active/inactive. + * + * @param isDisabled the isDisabled value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withIsDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + return this; + } + + /** + * Get the ruleType property: The rule type of the governance rule, defines the source of the rule e.g. Integrated. + * + * @return the ruleType value. + */ + public GovernanceRuleType ruleType() { + return this.ruleType; + } + + /** + * Set the ruleType property: The rule type of the governance rule, defines the source of the rule e.g. Integrated. + * + * @param ruleType the ruleType value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withRuleType(GovernanceRuleType ruleType) { + this.ruleType = ruleType; + return this; + } + + /** + * Get the sourceResourceType property: The governance rule source, what the rule affects, e.g. Assessments. + * + * @return the sourceResourceType value. + */ + public GovernanceRuleSourceResourceType sourceResourceType() { + return this.sourceResourceType; + } + + /** + * Set the sourceResourceType property: The governance rule source, what the rule affects, e.g. Assessments. + * + * @param sourceResourceType the sourceResourceType value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withSourceResourceType(GovernanceRuleSourceResourceType sourceResourceType) { + this.sourceResourceType = sourceResourceType; + 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 GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withExcludedScopes(List excludedScopes) { + this.excludedScopes = excludedScopes; + return this; + } + + /** + * Get the conditionSets property: The governance rule conditionSets - see examples. + * + * @return the conditionSets value. + */ + public List conditionSets() { + return this.conditionSets; + } + + /** + * Set the conditionSets property: The governance rule conditionSets - see examples. + * + * @param conditionSets the conditionSets value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withConditionSets(List conditionSets) { + this.conditionSets = conditionSets; + return this; + } + + /** + * Get the includeMemberScopes property: Defines whether the rule is management scope rule (master connector as a + * single scope or management scope). + * + * @return the includeMemberScopes value. + */ + public Boolean includeMemberScopes() { + return this.includeMemberScopes; + } + + /** + * Set the includeMemberScopes property: Defines whether the rule is management scope rule (master connector as a + * single scope or management scope). + * + * @param includeMemberScopes the includeMemberScopes value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withIncludeMemberScopes(Boolean includeMemberScopes) { + this.includeMemberScopes = includeMemberScopes; + return this; + } + + /** + * Get the ownerSource property: The owner source for the governance rule - e.g. Manually by user@contoso.com - + * see example. + * + * @return the ownerSource value. + */ + public GovernanceRuleOwnerSource ownerSource() { + return this.ownerSource; + } + + /** + * Set the ownerSource property: The owner source for the governance rule - e.g. Manually by user@contoso.com - + * see example. + * + * @param ownerSource the ownerSource value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withOwnerSource(GovernanceRuleOwnerSource ownerSource) { + this.ownerSource = ownerSource; + return this; + } + + /** + * Get the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @return the governanceEmailNotification value. + */ + public GovernanceRuleEmailNotification governanceEmailNotification() { + return this.governanceEmailNotification; + } + + /** + * Set the governanceEmailNotification property: The email notifications settings for the governance rule, states + * whether to disable notifications for mangers and owners. + * + * @param governanceEmailNotification the governanceEmailNotification value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties + withGovernanceEmailNotification(GovernanceRuleEmailNotification governanceEmailNotification) { + this.governanceEmailNotification = governanceEmailNotification; + return this; + } + + /** + * Get the metadata property: The governance rule metadata. + * + * @return the metadata value. + */ + public GovernanceRuleMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The governance rule metadata. + * + * @param metadata the metadata value to set. + * @return the GovernanceRuleProperties object itself. + */ + public GovernanceRuleProperties withMetadata(GovernanceRuleMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property displayName in model GovernanceRuleProperties")); + } + if (ruleType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property ruleType in model GovernanceRuleProperties")); + } + if (sourceResourceType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceResourceType in model GovernanceRuleProperties")); + } + if (conditionSets() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property conditionSets in model GovernanceRuleProperties")); + } + if (ownerSource() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property ownerSource in model GovernanceRuleProperties")); + } else { + ownerSource().validate(); + } + if (governanceEmailNotification() != null) { + governanceEmailNotification().validate(); + } + if (metadata() != null) { + metadata().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 new file mode 100644 index 000000000000..48eece07db0e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportInner.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.EnvironmentDetails; +import com.azure.resourcemanager.security.models.HealthDataClassification; +import com.azure.resourcemanager.security.models.HealthReportResourceDetails; +import com.azure.resourcemanager.security.models.HealthReportStatus; +import com.azure.resourcemanager.security.models.Issue; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The health report resource. + */ +@Immutable +public final class HealthReportInner extends ProxyResource { + /* + * Properties of a health report + */ + private HealthReportProperties 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 HealthReportInner class. + */ + private HealthReportInner() { + } + + /** + * Get the innerProperties property: Properties of a health report. + * + * @return the innerProperties value. + */ + private HealthReportProperties 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 resourceDetails property: The resource details of the health report. + * + * @return the resourceDetails value. + */ + public HealthReportResourceDetails resourceDetails() { + return this.innerProperties() == null ? null : this.innerProperties().resourceDetails(); + } + + /** + * Get the environmentDetails property: The environment details of the resource. + * + * @return the environmentDetails value. + */ + public EnvironmentDetails environmentDetails() { + return this.innerProperties() == null ? null : this.innerProperties().environmentDetails(); + } + + /** + * Get the healthDataClassification property: The classification of the health report. + * + * @return the healthDataClassification value. + */ + public HealthDataClassification healthDataClassification() { + return this.innerProperties() == null ? null : this.innerProperties().healthDataClassification(); + } + + /** + * Get the status property: The status of the health report. + * + * @return the status value. + */ + public HealthReportStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the affectedDefendersPlans property: The affected defenders plans by unhealthy report. + * + * @return the affectedDefendersPlans value. + */ + public List affectedDefendersPlans() { + return this.innerProperties() == null ? null : this.innerProperties().affectedDefendersPlans(); + } + + /** + * Get the affectedDefendersSubPlans property: The affected defenders sub plans by unhealthy report. + * + * @return the affectedDefendersSubPlans value. + */ + public List affectedDefendersSubPlans() { + return this.innerProperties() == null ? null : this.innerProperties().affectedDefendersSubPlans(); + } + + /** + * Get the reportAdditionalData property: Additional data for the given health report, this field can include more + * details on the resource and the health scenario. + * + * @return the reportAdditionalData value. + */ + public Map reportAdditionalData() { + return this.innerProperties() == null ? null : this.innerProperties().reportAdditionalData(); + } + + /** + * Get the issues property: A collection of the issues in the report. + * + * @return the issues value. + */ + public List issues() { + return this.innerProperties() == null ? null : this.innerProperties().issues(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedHealthReportInner.systemData = SystemData.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 new file mode 100644 index 000000000000..f6e20ceb9a9f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.EnvironmentDetails; +import com.azure.resourcemanager.security.models.HealthDataClassification; +import com.azure.resourcemanager.security.models.HealthReportResourceDetails; +import com.azure.resourcemanager.security.models.HealthReportStatus; +import com.azure.resourcemanager.security.models.Issue; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Describes properties of the health report. + */ +@Immutable +public final class HealthReportProperties implements JsonSerializable { + /* + * The resource details of the health report + */ + private HealthReportResourceDetails resourceDetails; + + /* + * The environment details of the resource + */ + private EnvironmentDetails environmentDetails; + + /* + * The classification of the health report + */ + private HealthDataClassification healthDataClassification; + + /* + * The status of the health report + */ + private HealthReportStatus status; + + /* + * The affected defenders plans by unhealthy report + */ + private List affectedDefendersPlans; + + /* + * The affected defenders sub plans by unhealthy report + */ + private List affectedDefendersSubPlans; + + /* + * Additional data for the given health report, this field can include more details on the resource and the health + * scenario. + */ + private Map reportAdditionalData; + + /* + * A collection of the issues in the report + */ + private List issues; + + /** + * Creates an instance of HealthReportProperties class. + */ + private HealthReportProperties() { + } + + /** + * Get the resourceDetails property: The resource details of the health report. + * + * @return the resourceDetails value. + */ + public HealthReportResourceDetails resourceDetails() { + return this.resourceDetails; + } + + /** + * Get the environmentDetails property: The environment details of the resource. + * + * @return the environmentDetails value. + */ + public EnvironmentDetails environmentDetails() { + return this.environmentDetails; + } + + /** + * Get the healthDataClassification property: The classification of the health report. + * + * @return the healthDataClassification value. + */ + public HealthDataClassification healthDataClassification() { + return this.healthDataClassification; + } + + /** + * Get the status property: The status of the health report. + * + * @return the status value. + */ + public HealthReportStatus status() { + return this.status; + } + + /** + * Get the affectedDefendersPlans property: The affected defenders plans by unhealthy report. + * + * @return the affectedDefendersPlans value. + */ + public List affectedDefendersPlans() { + return this.affectedDefendersPlans; + } + + /** + * Get the affectedDefendersSubPlans property: The affected defenders sub plans by unhealthy report. + * + * @return the affectedDefendersSubPlans value. + */ + public List affectedDefendersSubPlans() { + return this.affectedDefendersSubPlans; + } + + /** + * Get the reportAdditionalData property: Additional data for the given health report, this field can include more + * details on the resource and the health scenario. + * + * @return the reportAdditionalData value. + */ + public Map reportAdditionalData() { + return this.reportAdditionalData; + } + + /** + * Get the issues property: A collection of the issues in the report. + * + * @return the issues value. + */ + public List issues() { + return this.issues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceDetails() != null) { + resourceDetails().validate(); + } + if (environmentDetails() != null) { + environmentDetails().validate(); + } + if (healthDataClassification() != null) { + healthDataClassification().validate(); + } + if (status() != null) { + status().validate(); + } + if (issues() != null) { + 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 = HealthReportResourceDetails.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 = HealthReportStatus.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 new file mode 100644 index 000000000000..e63bf6f16f4c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.InformationType; +import com.azure.resourcemanager.security.models.SensitivityLabel; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Information protection policy. + */ +@Fluent +public final class InformationProtectionPolicyInner extends ProxyResource { + /* + * Information protection policy data + */ + private InformationProtectionPolicyProperties 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 InformationProtectionPolicyInner class. + */ + public InformationProtectionPolicyInner() { + } + + /** + * Get the innerProperties property: Information protection policy data. + * + * @return the innerProperties value. + */ + private InformationProtectionPolicyProperties 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 lastModifiedUtc property: Describes the last UTC time the policy was modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc(); + } + + /** + * Get the version property: Describes the version of the policy. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the labels property: Dictionary of sensitivity labels. + * + * @return the labels value. + */ + public Map labels() { + return this.innerProperties() == null ? null : this.innerProperties().labels(); + } + + /** + * Set the labels property: Dictionary of sensitivity labels. + * + * @param labels the labels value to set. + * @return the InformationProtectionPolicyInner object itself. + */ + public InformationProtectionPolicyInner withLabels(Map labels) { + if (this.innerProperties() == null) { + this.innerProperties = new InformationProtectionPolicyProperties(); + } + this.innerProperties().withLabels(labels); + return this; + } + + /** + * Get the informationTypes property: The sensitivity information types. + * + * @return the informationTypes value. + */ + public Map informationTypes() { + return this.innerProperties() == null ? null : this.innerProperties().informationTypes(); + } + + /** + * Set the informationTypes property: The sensitivity information types. + * + * @param informationTypes the informationTypes value to set. + * @return the InformationProtectionPolicyInner object itself. + */ + public InformationProtectionPolicyInner withInformationTypes(Map informationTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new InformationProtectionPolicyProperties(); + } + this.innerProperties().withInformationTypes(informationTypes); + 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 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 if ("systemData".equals(fieldName)) { + deserializedInformationProtectionPolicyInner.systemData = SystemData.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 new file mode 100644 index 000000000000..5055ac4bca60 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyProperties.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.InformationType; +import com.azure.resourcemanager.security.models.SensitivityLabel; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * describes properties of an information protection policy. + */ +@Fluent +public final class InformationProtectionPolicyProperties + implements JsonSerializable { + /* + * Describes the last UTC time the policy was modified. + */ + private OffsetDateTime lastModifiedUtc; + + /* + * Describes the version of the policy. + */ + private String version; + + /* + * Dictionary of sensitivity labels. + */ + private Map labels; + + /* + * The sensitivity information types. + */ + private Map informationTypes; + + /** + * Creates an instance of InformationProtectionPolicyProperties class. + */ + public InformationProtectionPolicyProperties() { + } + + /** + * Get the lastModifiedUtc property: Describes the last UTC time the policy was modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Get the version property: Describes the version of the policy. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the labels property: Dictionary of sensitivity labels. + * + * @return the labels value. + */ + public Map labels() { + return this.labels; + } + + /** + * Set the labels property: Dictionary of sensitivity labels. + * + * @param labels the labels value to set. + * @return the InformationProtectionPolicyProperties object itself. + */ + public InformationProtectionPolicyProperties withLabels(Map labels) { + this.labels = labels; + return this; + } + + /** + * Get the informationTypes property: The sensitivity information types. + * + * @return the informationTypes value. + */ + public Map informationTypes() { + return this.informationTypes; + } + + /** + * Set the informationTypes property: The sensitivity information types. + * + * @param informationTypes the informationTypes value to set. + * @return the InformationProtectionPolicyProperties object itself. + */ + public InformationProtectionPolicyProperties withInformationTypes(Map informationTypes) { + this.informationTypes = informationTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (labels() != null) { + labels().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (informationTypes() != null) { + informationTypes().values().forEach(e -> { + if (e != null) { + e.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 343f45767548..b15115515430 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +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; @@ -19,7 +20,7 @@ /** * Security Solution Aggregated Alert information. */ -@Fluent +@Immutable public final class IoTSecurityAggregatedAlertInner extends ProxyResource { /* * IoT Security solution aggregated alert details. @@ -31,6 +32,11 @@ public final class IoTSecurityAggregatedAlertInner extends ProxyResource { */ private Map tags; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -49,7 +55,7 @@ public final class IoTSecurityAggregatedAlertInner extends ProxyResource { /** * Creates an instance of IoTSecurityAggregatedAlertInner class. */ - public IoTSecurityAggregatedAlertInner() { + private IoTSecurityAggregatedAlertInner() { } /** @@ -71,14 +77,12 @@ public Map tags() { } /** - * Set the tags property: Resource tags. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param tags the tags value to set. - * @return the IoTSecurityAggregatedAlertInner object itself. + * @return the systemData value. */ - public IoTSecurityAggregatedAlertInner withTags(Map tags) { - this.tags = tags; - return this; + public SystemData systemData() { + return this.systemData; } /** @@ -280,6 +284,8 @@ public static IoTSecurityAggregatedAlertInner fromJson(JsonReader jsonReader) th } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedIoTSecurityAggregatedAlertInner.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 9a0f7a962955..8e0caaad6f17 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -89,7 +89,7 @@ public final class IoTSecurityAggregatedAlertProperties /** * Creates an instance of IoTSecurityAggregatedAlertProperties class. */ - public IoTSecurityAggregatedAlertProperties() { + private IoTSecurityAggregatedAlertProperties() { } /** 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 171b339d1e97..dd247d8bd531 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +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; @@ -16,7 +17,7 @@ /** * IoT Security solution recommendation information. */ -@Fluent +@Immutable public final class IoTSecurityAggregatedRecommendationInner extends ProxyResource { /* * Security Solution data @@ -28,6 +29,11 @@ public final class IoTSecurityAggregatedRecommendationInner extends ProxyResourc */ private Map tags; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -46,7 +52,7 @@ public final class IoTSecurityAggregatedRecommendationInner extends ProxyResourc /** * Creates an instance of IoTSecurityAggregatedRecommendationInner class. */ - public IoTSecurityAggregatedRecommendationInner() { + private IoTSecurityAggregatedRecommendationInner() { } /** @@ -68,14 +74,12 @@ public Map tags() { } /** - * Set the tags property: Resource tags. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param tags the tags value to set. - * @return the IoTSecurityAggregatedRecommendationInner object itself. + * @return the systemData value. */ - public IoTSecurityAggregatedRecommendationInner withTags(Map tags) { - this.tags = tags; - return this; + public SystemData systemData() { + return this.systemData; } /** @@ -117,20 +121,6 @@ public String recommendationName() { return this.innerProperties() == null ? null : this.innerProperties().recommendationName(); } - /** - * Set the recommendationName property: Name of the recommendation. - * - * @param recommendationName the recommendationName value to set. - * @return the IoTSecurityAggregatedRecommendationInner object itself. - */ - public IoTSecurityAggregatedRecommendationInner withRecommendationName(String recommendationName) { - if (this.innerProperties() == null) { - this.innerProperties = new IoTSecurityAggregatedRecommendationProperties(); - } - this.innerProperties().withRecommendationName(recommendationName); - return this; - } - /** * Get the recommendationDisplayName property: Display name of the recommendation type. * @@ -263,6 +253,8 @@ public static IoTSecurityAggregatedRecommendationInner fromJson(JsonReader jsonR } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedIoTSecurityAggregatedRecommendationInner.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 0a77745c1d83..36fef3c51827 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +15,7 @@ /** * IoT Security solution aggregated recommendation information. */ -@Fluent +@Immutable public final class IoTSecurityAggregatedRecommendationProperties implements JsonSerializable { /* @@ -71,7 +71,7 @@ public final class IoTSecurityAggregatedRecommendationProperties /** * Creates an instance of IoTSecurityAggregatedRecommendationProperties class. */ - public IoTSecurityAggregatedRecommendationProperties() { + private IoTSecurityAggregatedRecommendationProperties() { } /** @@ -83,17 +83,6 @@ public String recommendationName() { return this.recommendationName; } - /** - * Set the recommendationName property: Name of the recommendation. - * - * @param recommendationName the recommendationName value to set. - * @return the IoTSecurityAggregatedRecommendationProperties object itself. - */ - public IoTSecurityAggregatedRecommendationProperties withRecommendationName(String recommendationName) { - this.recommendationName = recommendationName; - return this; - } - /** * Get the recommendationDisplayName property: Display name of the recommendation type. * 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 9208df85ca9b..e1056f6b52c3 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +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; @@ -20,13 +21,18 @@ /** * Security analytics of your IoT Security solution. */ -@Fluent +@Immutable public final class IoTSecuritySolutionAnalyticsModelInner extends ProxyResource { /* * Security Solution Aggregated Alert data */ private IoTSecuritySolutionAnalyticsModelProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -45,7 +51,7 @@ public final class IoTSecuritySolutionAnalyticsModelInner extends ProxyResource /** * Creates an instance of IoTSecuritySolutionAnalyticsModelInner class. */ - public IoTSecuritySolutionAnalyticsModelInner() { + private IoTSecuritySolutionAnalyticsModelInner() { } /** @@ -57,6 +63,15 @@ private IoTSecuritySolutionAnalyticsModelProperties 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. * @@ -123,21 +138,6 @@ public List topAlertedDevices() { return this.innerProperties() == null ? null : this.innerProperties().topAlertedDevices(); } - /** - * Set the topAlertedDevices property: List of the 3 devices with the most alerts. - * - * @param topAlertedDevices the topAlertedDevices value to set. - * @return the IoTSecuritySolutionAnalyticsModelInner object itself. - */ - public IoTSecuritySolutionAnalyticsModelInner - withTopAlertedDevices(List topAlertedDevices) { - if (this.innerProperties() == null) { - this.innerProperties = new IoTSecuritySolutionAnalyticsModelProperties(); - } - this.innerProperties().withTopAlertedDevices(topAlertedDevices); - return this; - } - /** * Get the mostPrevalentDeviceAlerts property: List of the 3 most prevalent device alerts. * @@ -147,21 +147,6 @@ public List mostPrevalentDeviceAlerts() { return this.innerProperties() == null ? null : this.innerProperties().mostPrevalentDeviceAlerts(); } - /** - * Set the mostPrevalentDeviceAlerts property: List of the 3 most prevalent device alerts. - * - * @param mostPrevalentDeviceAlerts the mostPrevalentDeviceAlerts value to set. - * @return the IoTSecuritySolutionAnalyticsModelInner object itself. - */ - public IoTSecuritySolutionAnalyticsModelInner - withMostPrevalentDeviceAlerts(List mostPrevalentDeviceAlerts) { - if (this.innerProperties() == null) { - this.innerProperties = new IoTSecuritySolutionAnalyticsModelProperties(); - } - this.innerProperties().withMostPrevalentDeviceAlerts(mostPrevalentDeviceAlerts); - return this; - } - /** * Get the mostPrevalentDeviceRecommendations property: List of the 3 most prevalent device recommendations. * @@ -171,21 +156,6 @@ public List mostPrevalentDeviceRecommendations( return this.innerProperties() == null ? null : this.innerProperties().mostPrevalentDeviceRecommendations(); } - /** - * Set the mostPrevalentDeviceRecommendations property: List of the 3 most prevalent device recommendations. - * - * @param mostPrevalentDeviceRecommendations the mostPrevalentDeviceRecommendations value to set. - * @return the IoTSecuritySolutionAnalyticsModelInner object itself. - */ - public IoTSecuritySolutionAnalyticsModelInner withMostPrevalentDeviceRecommendations( - List mostPrevalentDeviceRecommendations) { - if (this.innerProperties() == null) { - this.innerProperties = new IoTSecuritySolutionAnalyticsModelProperties(); - } - this.innerProperties().withMostPrevalentDeviceRecommendations(mostPrevalentDeviceRecommendations); - return this; - } - /** * Validates the instance. * @@ -233,6 +203,8 @@ public static IoTSecuritySolutionAnalyticsModelInner fromJson(JsonReader jsonRea } else if ("properties".equals(fieldName)) { deserializedIoTSecuritySolutionAnalyticsModelInner.innerProperties = IoTSecuritySolutionAnalyticsModelProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 46cf8e52ec0d..402ef3db3b29 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -16,27 +16,27 @@ /** * List of Security analytics of your IoT Security solution. */ -@Fluent +@Immutable public final class IoTSecuritySolutionAnalyticsModelListInner implements JsonSerializable { /* - * List of Security analytics of your IoT Security solution + * The IoTSecuritySolutionAnalyticsModel items on this page */ private List value; /* - * When there is too much alert data for one page, use this URI to fetch the next page. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of IoTSecuritySolutionAnalyticsModelListInner class. */ - public IoTSecuritySolutionAnalyticsModelListInner() { + private IoTSecuritySolutionAnalyticsModelListInner() { } /** - * Get the value property: List of Security analytics of your IoT Security solution. + * Get the value property: The IoTSecuritySolutionAnalyticsModel items on this page. * * @return the value value. */ @@ -45,18 +45,7 @@ public List value() { } /** - * Set the value property: List of Security analytics of your IoT Security solution. - * - * @param value the value value to set. - * @return the IoTSecuritySolutionAnalyticsModelListInner object itself. - */ - public IoTSecuritySolutionAnalyticsModelListInner withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: When there is too much alert data for one page, use this URI to fetch the next page. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -88,6 +77,7 @@ public void validate() { 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(); } 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 b4078f2c67d2..d4a66c876744 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -20,7 +20,7 @@ /** * Security analytics properties of your IoT Security solution. */ -@Fluent +@Immutable public final class IoTSecuritySolutionAnalyticsModelProperties implements JsonSerializable { /* @@ -56,7 +56,7 @@ public final class IoTSecuritySolutionAnalyticsModelProperties /** * Creates an instance of IoTSecuritySolutionAnalyticsModelProperties class. */ - public IoTSecuritySolutionAnalyticsModelProperties() { + private IoTSecuritySolutionAnalyticsModelProperties() { } /** @@ -95,18 +95,6 @@ public List topAlertedDevices() { return this.topAlertedDevices; } - /** - * Set the topAlertedDevices property: List of the 3 devices with the most alerts. - * - * @param topAlertedDevices the topAlertedDevices value to set. - * @return the IoTSecuritySolutionAnalyticsModelProperties object itself. - */ - public IoTSecuritySolutionAnalyticsModelProperties - withTopAlertedDevices(List topAlertedDevices) { - this.topAlertedDevices = topAlertedDevices; - return this; - } - /** * Get the mostPrevalentDeviceAlerts property: List of the 3 most prevalent device alerts. * @@ -116,18 +104,6 @@ public List mostPrevalentDeviceAlerts() { return this.mostPrevalentDeviceAlerts; } - /** - * Set the mostPrevalentDeviceAlerts property: List of the 3 most prevalent device alerts. - * - * @param mostPrevalentDeviceAlerts the mostPrevalentDeviceAlerts value to set. - * @return the IoTSecuritySolutionAnalyticsModelProperties object itself. - */ - public IoTSecuritySolutionAnalyticsModelProperties - withMostPrevalentDeviceAlerts(List mostPrevalentDeviceAlerts) { - this.mostPrevalentDeviceAlerts = mostPrevalentDeviceAlerts; - return this; - } - /** * Get the mostPrevalentDeviceRecommendations property: List of the 3 most prevalent device recommendations. * @@ -137,18 +113,6 @@ public List mostPrevalentDeviceRecommendations( return this.mostPrevalentDeviceRecommendations; } - /** - * Set the mostPrevalentDeviceRecommendations property: List of the 3 most prevalent device recommendations. - * - * @param mostPrevalentDeviceRecommendations the mostPrevalentDeviceRecommendations value to set. - * @return the IoTSecuritySolutionAnalyticsModelProperties object itself. - */ - public IoTSecuritySolutionAnalyticsModelProperties withMostPrevalentDeviceRecommendations( - List mostPrevalentDeviceRecommendations) { - this.mostPrevalentDeviceRecommendations = mostPrevalentDeviceRecommendations; - return this; - } - /** * Validates the instance. * 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 9117476b4aad..6851a231ee98 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -27,24 +27,24 @@ @Fluent public final class IoTSecuritySolutionModelInner extends ProxyResource { /* - * The resource location. + * Security Solution data */ - private String location; + private IoTSecuritySolutionProperties innerProperties; /* - * Security Solution data + * Resource tags. */ - private IoTSecuritySolutionProperties innerProperties; + private Map tags; /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * The geo-location where the resource lives */ - private SystemData systemData; + private String location; /* - * Resource tags + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - private Map tags; + private SystemData systemData; /* * The type of the resource. @@ -68,61 +68,61 @@ public IoTSecuritySolutionModelInner() { } /** - * Get the location property: The resource location. + * Get the innerProperties property: Security Solution data. * - * @return the location value. + * @return the innerProperties value. */ - public String location() { - return this.location; + private IoTSecuritySolutionProperties innerProperties() { + return this.innerProperties; } /** - * Set the location property: The resource location. + * Get the tags property: Resource tags. * - * @param location the location value to set. - * @return the IoTSecuritySolutionModelInner object itself. + * @return the tags value. */ - public IoTSecuritySolutionModelInner withLocation(String location) { - this.location = location; - return this; + public Map tags() { + return this.tags; } /** - * Get the innerProperties property: Security Solution data. + * Set the tags property: Resource tags. * - * @return the innerProperties value. + * @param tags the tags value to set. + * @return the IoTSecuritySolutionModelInner object itself. */ - private IoTSecuritySolutionProperties innerProperties() { - return this.innerProperties; + public IoTSecuritySolutionModelInner withTags(Map tags) { + this.tags = tags; + return this; } /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * Get the location property: The geo-location where the resource lives. * - * @return the systemData value. + * @return the location value. */ - public SystemData systemData() { - return this.systemData; + public String location() { + return this.location; } /** - * Get the tags property: Resource tags. + * Set the location property: The geo-location where the resource lives. * - * @return the tags value. + * @param location the location value to set. + * @return the IoTSecuritySolutionModelInner object itself. */ - public Map tags() { - return this.tags; + public IoTSecuritySolutionModelInner withLocation(String location) { + this.location = location; + return this; } /** - * Set the tags property: Resource tags. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param tags the tags value to set. - * @return the IoTSecuritySolutionModelInner object itself. + * @return the systemData value. */ - public IoTSecuritySolutionModelInner withTags(Map tags) { - this.tags = tags; - return this; + public SystemData systemData() { + return this.systemData; } /** @@ -414,9 +414,9 @@ public void validate() { @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)); + jsonWriter.writeStringField("location", this.location); return jsonWriter.writeEndObject(); } @@ -443,16 +443,16 @@ public static IoTSecuritySolutionModelInner fromJson(JsonReader jsonReader) thro 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 if ("location".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 ee9bf93a8ba4..b68acd7f6367 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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 b94efca0f500..6fe5e9ce65d6 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; @@ -15,7 +16,7 @@ import java.util.List; /** - * The JitNetworkAccessPolicy model. + * Concrete proxy resource types can be created by aliasing this type using a specific property type. */ @Fluent public final class JitNetworkAccessPolicyInner extends ProxyResource { @@ -34,6 +35,11 @@ public final class JitNetworkAccessPolicyInner extends ProxyResource { */ private String location; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -93,6 +99,15 @@ public String location() { return this.location; } + /** + * 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. * @@ -231,10 +246,12 @@ public static JitNetworkAccessPolicyInner fromJson(JsonReader jsonReader) throws } 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 if ("kind".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.kind = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 167b827ec5df..1f2f41716526 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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 0407efba412b..657d9e6cae8a 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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..e006c9e65864 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanInner.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.MalwareScanProperties; +import java.io.IOException; + +/** + * Describes the state of a malware scan operation. + */ +@Immutable +public final class MalwareScanInner implements JsonSerializable { + /* + * The properties property. + */ + private MalwareScanProperties properties; + + /** + * Creates an instance of MalwareScanInner class. + */ + private MalwareScanInner() { + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public MalwareScanProperties properties() { + return this.properties; + } + + /** + * 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/MdeOnboardingDataInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataInner.java new file mode 100644 index 000000000000..ee507e7ec021 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataInner.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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 java.io.IOException; + +/** + * The resource of the configuration or data needed to onboard the machine to MDE. + */ +@Immutable +public final class MdeOnboardingDataInner extends ProxyResource { + private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + + /* + * Properties of the MDE configuration or data parameter needed to onboard the machine to MDE + */ + private MdeOnboardingDataProperties 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 MdeOnboardingDataInner class. + */ + private MdeOnboardingDataInner() { + } + + /** + * Get the innerProperties property: Properties of the MDE configuration or data parameter needed to onboard the + * machine to MDE. + * + * @return the innerProperties value. + */ + private MdeOnboardingDataProperties 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 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. + * + * @return the onboardingPackageWindows value. + */ + public byte[] onboardingPackageWindows() { + return this.innerProperties() == null ? EMPTY_BYTE_ARRAY : this.innerProperties().onboardingPackageWindows(); + } + + /** + * Get the onboardingPackageLinux property: 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. + * + * @return the onboardingPackageLinux value. + */ + public byte[] onboardingPackageLinux() { + return this.innerProperties() == null ? EMPTY_BYTE_ARRAY : this.innerProperties().onboardingPackageLinux(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedMdeOnboardingDataInner.systemData = SystemData.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 new file mode 100644 index 000000000000..ee293b6f85a5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.util.List; + +/** + * List of all MDE onboarding data resources. + */ +@Immutable +public final class MdeOnboardingDataListInner implements JsonSerializable { + /* + * List of the resources of the configuration or data needed to onboard the machine to MDE + */ + private List value; + + /** + * Creates an instance of MdeOnboardingDataListInner class. + */ + private MdeOnboardingDataListInner() { + } + + /** + * Get the value property: List of the resources of the configuration or data needed to onboard the machine to MDE. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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)); + 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 new file mode 100644 index 000000000000..6aafc4948dcd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; + +/** + * Properties of the MDE configuration or data parameter needed to onboard the machine to MDE. + */ +@Immutable +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 + */ + 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 + */ + private byte[] onboardingPackageLinux; + + /** + * Creates an instance of MdeOnboardingDataProperties class. + */ + private MdeOnboardingDataProperties() { + } + + /** + * 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. + * + * @return the onboardingPackageWindows value. + */ + public byte[] onboardingPackageWindows() { + return CoreUtils.clone(this.onboardingPackageWindows); + } + + /** + * Get the onboardingPackageLinux property: 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. + * + * @return the onboardingPackageLinux value. + */ + public byte[] onboardingPackageLinux() { + return CoreUtils.clone(this.onboardingPackageLinux); + } + + /** + * 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.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 new file mode 100644 index 000000000000..2db559e9bc32 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.ArmActionType; +import com.azure.resourcemanager.security.models.OperationDisplay; +import com.azure.resourcemanager.security.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + 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; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ArmActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * 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. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * 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: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ArmActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + 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 = ArmActionType.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/OperationResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultInner.java new file mode 100644 index 000000000000..cf360fc689b9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultInner.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.OperationResultStatus; +import java.io.IOException; + +/** + * Long run operation status of governance rule over a given scope. + */ +@Immutable +public final class OperationResultInner implements JsonSerializable { + /* + * The status of the long run operation result of governance rule + */ + private OperationResultStatus status; + + /** + * Creates an instance of OperationResultInner class. + */ + private OperationResultInner() { + } + + /** + * Get the status property: The status of the long run operation result of governance rule. + * + * @return the status value. + */ + public OperationResultStatus status() { + return this.status; + } + + /** + * 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(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationResultInner 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 OperationResultInner. + */ + public static OperationResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationResultInner deserializedOperationResultInner = new OperationResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedOperationResultInner.status = OperationResultStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationResultInner; + }); + } +} 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 new file mode 100644 index 000000000000..cf5574dcd991 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +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 java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The current status of an async operation. + */ +@Immutable +public final class OperationStatusResultInner implements JsonSerializable { + /* + * Fully qualified ID for the async operation. + */ + private String id; + + /* + * Name of the async operation. + */ + private String name; + + /* + * Operation status. + */ + private String status; + + /* + * Percent of the operation that is complete. + */ + private Double percentComplete; + + /* + * The start time of the operation. + */ + private OffsetDateTime startTime; + + /* + * The end time of the operation. + */ + private OffsetDateTime endTime; + + /* + * The operations list. + */ + private List operations; + + /* + * If present, details of the operation error. + */ + private ManagementError error; + + /* + * Fully qualified ID of the resource against which the original async operation was started. + */ + private String resourceId; + + /** + * Creates an instance of OperationStatusResultInner class. + */ + private OperationStatusResultInner() { + } + + /** + * Get the id property: Fully qualified ID for the async operation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Name of the async operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + public Double percentComplete() { + return this.percentComplete; + } + + /** + * Get the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the operations property: The operations list. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Get the error property: If present, details of the operation error. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Get the resourceId property: Fully qualified ID of the resource against which the original async operation was + * started. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property status in model OperationStatusResultInner")); + } + if (operations() != null) { + operations().forEach(e -> e.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::getDouble); + } 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 if ("resourceId".equals(fieldName)) { + deserializedOperationStatusResultInner.resourceId = reader.getString(); + } 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 ae17c656705a..ab3513672f0e 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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; @@ -30,6 +31,11 @@ public final class PricingInner extends ProxyResource { */ private PricingProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -60,6 +66,15 @@ private PricingProperties 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. * @@ -319,6 +334,8 @@ public static PricingInner fromJson(JsonReader jsonReader) throws IOException { deserializedPricingInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedPricingInner.innerProperties = PricingProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPricingInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 fdaa6b5b3c4b..c2b07f990724 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -16,7 +16,7 @@ /** * List of pricing configurations response. */ -@Fluent +@Immutable public final class PricingListInner implements JsonSerializable { /* * List of pricing configurations @@ -26,7 +26,7 @@ public final class PricingListInner implements JsonSerializable value() { return this.value; } - /** - * Set the value property: List of pricing configurations. - * - * @param value the value value to set. - * @return the PricingListInner object itself. - */ - public PricingListInner withValue(List value) { - this.value = value; - return this; - } - /** * Validates the instance. * 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 3a4a2ad4b69d..f9a8ec0fa923 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateEndpointConnectionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..b83a5cb70151 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateEndpoint; +import com.azure.resourcemanager.security.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.security.models.PrivateLinkServiceConnectionState; +import java.io.IOException; +import java.util.List; + +/** + * The private endpoint connection resource. + */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + private PrivateEndpointConnectionProperties 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 PrivateEndpointConnectionInner class. + */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties 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 groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.innerProperties() == null ? null : this.innerProperties().groupIds(); + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: The private endpoint resource. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * 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 PrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionInner 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 PrivateEndpointConnectionInner. + */ + public static PrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionInner deserializedPrivateEndpointConnectionInner + = new PrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.innerProperties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..c56c61056232 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.PrivateEndpoint; +import com.azure.resourcemanager.security.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.security.models.PrivateLinkServiceConnectionState; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * The group ids for the private endpoint resource. + */ + private List groupIds; + + /* + * The private endpoint resource. + */ + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint resource. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties 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 PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else if ("groupIds".equals(fieldName)) { + List groupIds = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionProperties.groupIds = groupIds; + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkGroupResourceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkGroupResourceInner.java new file mode 100644 index 000000000000..056042f373b1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkGroupResourceInner.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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 java.io.IOException; +import java.util.List; + +/** + * A private link group resource that describes a grouping for the private link. + */ +@Immutable +public final class PrivateLinkGroupResourceInner extends ProxyResource { + /* + * Resource properties. + */ + private PrivateLinkResourceProperties 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 PrivateLinkGroupResourceInner class. + */ + private PrivateLinkGroupResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties 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 groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * 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 PrivateLinkGroupResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkGroupResourceInner 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 PrivateLinkGroupResourceInner. + */ + public static PrivateLinkGroupResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkGroupResourceInner deserializedPrivateLinkGroupResourceInner + = new PrivateLinkGroupResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkGroupResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkGroupResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkGroupResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkGroupResourceInner.innerProperties + = PrivateLinkResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateLinkGroupResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkGroupResourceInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkProperties.java new file mode 100644 index 000000000000..fc4a749ce9a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkProperties.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ProvisioningState; +import com.azure.resourcemanager.security.models.PublicNetworkAccess; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. These properties control the behavior and configuration of private endpoint + * connectivity to Defender services. + */ +@Fluent +public final class PrivateLinkProperties implements JsonSerializable { + /* + * The current provisioning state of the private link resource. Indicates whether the resource is being created, + * updated, deleted, or has completed successfully. + */ + private ProvisioningState provisioningState; + + /* + * List of private endpoint connections associated with this private link. Each connection represents a private + * endpoint from a customer's virtual network. + */ + private List privateEndpointConnections; + + /* + * List of private link resources available for connection. For Defender services, this typically includes the + * 'containers' group with 'api' and regional data endpoints. + */ + private List privateLinkResources; + + /* + * This determines if traffic is allowed over public network. By default it is disabled. + */ + private PublicNetworkAccess publicNetworkAccess; + + /** + * Creates an instance of PrivateLinkProperties class. + */ + public PrivateLinkProperties() { + } + + /** + * Get the provisioningState property: The current provisioning state of the private link resource. Indicates + * whether the resource is being created, updated, deleted, or has completed successfully. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with this private + * link. Each connection represents a private endpoint from a customer's virtual network. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the privateLinkResources property: List of private link resources available for connection. For Defender + * services, this typically includes the 'containers' group with 'api' and regional data endpoints. + * + * @return the privateLinkResources value. + */ + public List privateLinkResources() { + return this.privateLinkResources; + } + + /** + * Get the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * disabled. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * disabled. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the PrivateLinkProperties object itself. + */ + public PrivateLinkProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (privateLinkResources() != null) { + privateLinkResources().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkProperties 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 PrivateLinkProperties. + */ + public static PrivateLinkProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkProperties deserializedPrivateLinkProperties = new PrivateLinkProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedPrivateLinkProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedPrivateLinkProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("privateLinkResources".equals(fieldName)) { + List privateLinkResources + = reader.readArray(reader1 -> PrivateLinkGroupResourceInner.fromJson(reader1)); + deserializedPrivateLinkProperties.privateLinkResources = privateLinkResources; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedPrivateLinkProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkResourceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 000000000000..f2d4762a9a8e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +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.ProvisioningState; +import com.azure.resourcemanager.security.models.PublicNetworkAccess; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * A private link resource that enables secure, private connectivity to Microsoft Defender for Cloud services. This + * resource manages the lifecycle of private endpoint connections and provides the necessary infrastructure for private + * connectivity. + */ +@Fluent +public final class PrivateLinkResourceInner extends Resource { + /* + * Properties specific to the private link resource + */ + private PrivateLinkProperties innerProperties = new PrivateLinkProperties(); + + /* + * 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 PrivateLinkResourceInner class. + */ + public PrivateLinkResourceInner() { + } + + /** + * Get the innerProperties property: Properties specific to the private link resource. + * + * @return the innerProperties value. + */ + private PrivateLinkProperties 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; + } + + /** + * {@inheritDoc} + */ + @Override + public PrivateLinkResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PrivateLinkResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The current provisioning state of the private link resource. Indicates + * whether the resource is being created, updated, deleted, or has completed successfully. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with this private + * link. Each connection represents a private endpoint from a customer's virtual network. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the privateLinkResources property: List of private link resources available for connection. For Defender + * services, this typically includes the 'containers' group with 'api' and regional data endpoints. + * + * @return the privateLinkResources value. + */ + public List privateLinkResources() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkResources(); + } + + /** + * Get the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * disabled. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * disabled. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + 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 PrivateLinkResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourceInner.class); + + /** + * {@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 PrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceInner 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 PrivateLinkResourceInner. + */ + public static PrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceInner deserializedPrivateLinkResourceInner = new PrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPrivateLinkResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResourceInner.innerProperties = PrivateLinkProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateLinkResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkResourceProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..6b0d08e7e00e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Immutable +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * The private link resource group id. + */ + private String groupId; + + /* + * The private link resource required member names. + */ + private List requiredMembers; + + /* + * The private link resource private link DNS zone name. + */ + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + private PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * 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.writeArrayField("requiredZoneNames", this.requiredZoneNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties 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 PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } +} 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 new file mode 100644 index 000000000000..b01e671807a6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.State; +import java.io.IOException; + +/** + * Regulatory compliance assessment details and state. + */ +@Immutable +public final class RegulatoryComplianceAssessmentInner extends ProxyResource { + /* + * Regulatory compliance assessment data + */ + private RegulatoryComplianceAssessmentProperties 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 RegulatoryComplianceAssessmentInner class. + */ + private RegulatoryComplianceAssessmentInner() { + } + + /** + * Get the innerProperties property: Regulatory compliance assessment data. + * + * @return the innerProperties value. + */ + private RegulatoryComplianceAssessmentProperties 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 description property: The description of the regulatory compliance assessment. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the assessmentType property: The expected type of assessment contained in the AssessmentDetailsLink. + * + * @return the assessmentType value. + */ + public String assessmentType() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentType(); + } + + /** + * Get the assessmentDetailsLink property: Link to more detailed assessment results data. The response type will be + * according to the assessmentType field. + * + * @return the assessmentDetailsLink value. + */ + public String assessmentDetailsLink() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentDetailsLink(); + } + + /** + * Get the state property: Aggregative state based on the assessment's scanned resources states. + * + * @return the state value. + */ + public State state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the passedResources property: The given assessment's related resources count with passed state. + * + * @return the passedResources value. + */ + public Integer passedResources() { + return this.innerProperties() == null ? null : this.innerProperties().passedResources(); + } + + /** + * Get the failedResources property: The given assessment's related resources count with failed state. + * + * @return the failedResources value. + */ + public Integer failedResources() { + return this.innerProperties() == null ? null : this.innerProperties().failedResources(); + } + + /** + * Get the skippedResources property: The given assessment's related resources count with skipped state. + * + * @return the skippedResources value. + */ + public Integer skippedResources() { + return this.innerProperties() == null ? null : this.innerProperties().skippedResources(); + } + + /** + * Get the unsupportedResources property: The given assessment's related resources count with unsupported state. + * + * @return the unsupportedResources value. + */ + public Integer unsupportedResources() { + return this.innerProperties() == null ? null : this.innerProperties().unsupportedResources(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentInner.systemData = SystemData.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 new file mode 100644 index 000000000000..a51dfce096cd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentProperties.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.State; +import java.io.IOException; + +/** + * Regulatory compliance assessment data. + */ +@Immutable +public final class RegulatoryComplianceAssessmentProperties + implements JsonSerializable { + /* + * The description of the regulatory compliance assessment + */ + private String description; + + /* + * The expected type of assessment contained in the AssessmentDetailsLink + */ + private String assessmentType; + + /* + * Link to more detailed assessment results data. The response type will be according to the assessmentType field + */ + private String assessmentDetailsLink; + + /* + * Aggregative state based on the assessment's scanned resources states + */ + private State state; + + /* + * The given assessment's related resources count with passed state. + */ + private Integer passedResources; + + /* + * The given assessment's related resources count with failed state. + */ + private Integer failedResources; + + /* + * The given assessment's related resources count with skipped state. + */ + private Integer skippedResources; + + /* + * The given assessment's related resources count with unsupported state. + */ + private Integer unsupportedResources; + + /** + * Creates an instance of RegulatoryComplianceAssessmentProperties class. + */ + private RegulatoryComplianceAssessmentProperties() { + } + + /** + * Get the description property: The description of the regulatory compliance assessment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the assessmentType property: The expected type of assessment contained in the AssessmentDetailsLink. + * + * @return the assessmentType value. + */ + public String assessmentType() { + return this.assessmentType; + } + + /** + * Get the assessmentDetailsLink property: Link to more detailed assessment results data. The response type will be + * according to the assessmentType field. + * + * @return the assessmentDetailsLink value. + */ + public String assessmentDetailsLink() { + return this.assessmentDetailsLink; + } + + /** + * Get the state property: Aggregative state based on the assessment's scanned resources states. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Get the passedResources property: The given assessment's related resources count with passed state. + * + * @return the passedResources value. + */ + public Integer passedResources() { + return this.passedResources; + } + + /** + * Get the failedResources property: The given assessment's related resources count with failed state. + * + * @return the failedResources value. + */ + public Integer failedResources() { + return this.failedResources; + } + + /** + * Get the skippedResources property: The given assessment's related resources count with skipped state. + * + * @return the skippedResources value. + */ + public Integer skippedResources() { + return this.skippedResources; + } + + /** + * Get the unsupportedResources property: The given assessment's related resources count with unsupported state. + * + * @return the unsupportedResources value. + */ + public Integer unsupportedResources() { + return this.unsupportedResources; + } + + /** + * 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("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 new file mode 100644 index 000000000000..4bd22c895f15 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.State; +import java.io.IOException; + +/** + * Regulatory compliance control details and state. + */ +@Immutable +public final class RegulatoryComplianceControlInner extends ProxyResource { + /* + * Regulatory compliance control data + */ + private RegulatoryComplianceControlProperties 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 RegulatoryComplianceControlInner class. + */ + private RegulatoryComplianceControlInner() { + } + + /** + * Get the innerProperties property: Regulatory compliance control data. + * + * @return the innerProperties value. + */ + private RegulatoryComplianceControlProperties 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 description property: The description of the regulatory compliance control. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the state property: Aggregative state based on the control's supported assessments states. + * + * @return the state value. + */ + public State state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the passedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a passed state. + * + * @return the passedAssessments value. + */ + public Integer passedAssessments() { + return this.innerProperties() == null ? null : this.innerProperties().passedAssessments(); + } + + /** + * Get the failedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a failed state. + * + * @return the failedAssessments value. + */ + public Integer failedAssessments() { + return this.innerProperties() == null ? null : this.innerProperties().failedAssessments(); + } + + /** + * Get the skippedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a skipped state. + * + * @return the skippedAssessments value. + */ + public Integer skippedAssessments() { + return this.innerProperties() == null ? null : this.innerProperties().skippedAssessments(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedRegulatoryComplianceControlInner.systemData = SystemData.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 new file mode 100644 index 000000000000..09d5a9541c0f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.State; +import java.io.IOException; + +/** + * Regulatory compliance control data. + */ +@Immutable +public final class RegulatoryComplianceControlProperties + implements JsonSerializable { + /* + * The description of the regulatory compliance control + */ + private String description; + + /* + * Aggregative state based on the control's supported assessments states + */ + private State state; + + /* + * The number of supported regulatory compliance assessments of the given control with a passed state + */ + private Integer passedAssessments; + + /* + * The number of supported regulatory compliance assessments of the given control with a failed state + */ + private Integer failedAssessments; + + /* + * The number of supported regulatory compliance assessments of the given control with a skipped state + */ + private Integer skippedAssessments; + + /** + * Creates an instance of RegulatoryComplianceControlProperties class. + */ + private RegulatoryComplianceControlProperties() { + } + + /** + * Get the description property: The description of the regulatory compliance control. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the state property: Aggregative state based on the control's supported assessments states. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Get the passedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a passed state. + * + * @return the passedAssessments value. + */ + public Integer passedAssessments() { + return this.passedAssessments; + } + + /** + * Get the failedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a failed state. + * + * @return the failedAssessments value. + */ + public Integer failedAssessments() { + return this.failedAssessments; + } + + /** + * Get the skippedAssessments property: The number of supported regulatory compliance assessments of the given + * control with a skipped state. + * + * @return the skippedAssessments value. + */ + public Integer skippedAssessments() { + return this.skippedAssessments; + } + + /** + * 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("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 new file mode 100644 index 000000000000..9f874152bf33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.State; +import java.io.IOException; + +/** + * Regulatory compliance standard details and state. + */ +@Immutable +public final class RegulatoryComplianceStandardInner extends ProxyResource { + /* + * Regulatory compliance standard data + */ + private RegulatoryComplianceStandardProperties 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 RegulatoryComplianceStandardInner class. + */ + private RegulatoryComplianceStandardInner() { + } + + /** + * Get the innerProperties property: Regulatory compliance standard data. + * + * @return the innerProperties value. + */ + private RegulatoryComplianceStandardProperties 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 state property: Aggregative state based on the standard's supported controls states. + * + * @return the state value. + */ + public State state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the passedControls property: The number of supported regulatory compliance controls of the given standard + * with a passed state. + * + * @return the passedControls value. + */ + public Integer passedControls() { + return this.innerProperties() == null ? null : this.innerProperties().passedControls(); + } + + /** + * Get the failedControls property: The number of supported regulatory compliance controls of the given standard + * with a failed state. + * + * @return the failedControls value. + */ + public Integer failedControls() { + return this.innerProperties() == null ? null : this.innerProperties().failedControls(); + } + + /** + * Get the skippedControls property: The number of supported regulatory compliance controls of the given standard + * with a skipped state. + * + * @return the skippedControls value. + */ + public Integer skippedControls() { + return this.innerProperties() == null ? null : this.innerProperties().skippedControls(); + } + + /** + * Get the unsupportedControls property: The number of regulatory compliance controls of the given standard which + * are unsupported by automated assessments. + * + * @return the unsupportedControls value. + */ + public Integer unsupportedControls() { + return this.innerProperties() == null ? null : this.innerProperties().unsupportedControls(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedRegulatoryComplianceStandardInner.systemData = SystemData.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 new file mode 100644 index 000000000000..00999eb61eba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.State; +import java.io.IOException; + +/** + * Regulatory compliance standard data. + */ +@Immutable +public final class RegulatoryComplianceStandardProperties + implements JsonSerializable { + /* + * Aggregative state based on the standard's supported controls states + */ + private State state; + + /* + * The number of supported regulatory compliance controls of the given standard with a passed state + */ + private Integer passedControls; + + /* + * The number of supported regulatory compliance controls of the given standard with a failed state + */ + private Integer failedControls; + + /* + * The number of supported regulatory compliance controls of the given standard with a skipped state + */ + private Integer skippedControls; + + /* + * The number of regulatory compliance controls of the given standard which are unsupported by automated assessments + */ + private Integer unsupportedControls; + + /** + * Creates an instance of RegulatoryComplianceStandardProperties class. + */ + private RegulatoryComplianceStandardProperties() { + } + + /** + * Get the state property: Aggregative state based on the standard's supported controls states. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Get the passedControls property: The number of supported regulatory compliance controls of the given standard + * with a passed state. + * + * @return the passedControls value. + */ + public Integer passedControls() { + return this.passedControls; + } + + /** + * Get the failedControls property: The number of supported regulatory compliance controls of the given standard + * with a failed state. + * + * @return the failedControls value. + */ + public Integer failedControls() { + return this.failedControls; + } + + /** + * Get the skippedControls property: The number of supported regulatory compliance controls of the given standard + * with a skipped state. + * + * @return the skippedControls value. + */ + public Integer skippedControls() { + return this.skippedControls; + } + + /** + * Get the unsupportedControls property: The number of regulatory compliance controls of the given standard which + * are unsupported by automated assessments. + * + * @return the unsupportedControls value. + */ + public Integer unsupportedControls() { + return this.unsupportedControls; + } + + /** + * 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("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 new file mode 100644 index 000000000000..6f65296a1e90 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.RuleResultsProperties; +import java.io.IOException; + +/** + * Rule results. + */ +@Immutable +public final class RuleResultsInner extends ProxyResource { + /* + * Rule results properties. + */ + private RuleResultsProperties properties; + + /* + * 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 RuleResultsInner class. + */ + private RuleResultsInner() { + } + + /** + * Get the properties property: Rule results properties. + * + * @return the properties value. + */ + public RuleResultsProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedRuleResultsInner.systemData = SystemData.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 new file mode 100644 index 000000000000..3ef9c25fd82b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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 java.io.IOException; +import java.util.List; + +/** + * A list of rules results. + */ +@Immutable +public final class RulesResultsInner implements JsonSerializable { + /* + * List of rule results. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of RulesResultsInner class. + */ + private RulesResultsInner() { + } + + /** + * Get the value property: List of rule results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 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 if ("nextLink".equals(fieldName)) { + deserializedRulesResultsInner.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRulesResultsInner; + }); + } +} 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 new file mode 100644 index 000000000000..564bc2cd3ce9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.ScanResultProperties; +import java.io.IOException; + +/** + * A vulnerability assessment scan result for a single rule. + */ +@Immutable +public final class ScanResultInner extends ProxyResource { + /* + * A vulnerability assessment scan result properties for a single rule. + */ + private ScanResultProperties properties; + + /* + * 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 ScanResultInner class. + */ + private ScanResultInner() { + } + + /** + * Get the properties property: A vulnerability assessment scan result properties for a single rule. + * + * @return the properties value. + */ + public ScanResultProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedScanResultInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScanResultInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanV2Inner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanV2Inner.java new file mode 100644 index 000000000000..6ff1954fe6b4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanV2Inner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.ScanPropertiesV2; +import java.io.IOException; + +/** + * A vulnerability assessment scan record. + */ +@Immutable +public final class ScanV2Inner extends ProxyResource { + /* + * A vulnerability assessment scan record properties. + */ + private ScanPropertiesV2 properties; + + /* + * 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 ScanV2Inner class. + */ + private ScanV2Inner() { + } + + /** + * Get the properties property: A vulnerability assessment scan record properties. + * + * @return the properties value. + */ + public ScanPropertiesV2 properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 ScanV2Inner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanV2Inner 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 ScanV2Inner. + */ + public static ScanV2Inner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanV2Inner deserializedScanV2Inner = new ScanV2Inner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedScanV2Inner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedScanV2Inner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedScanV2Inner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedScanV2Inner.properties = ScanPropertiesV2.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedScanV2Inner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScanV2Inner; + }); + } +} 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 f652042448a1..919ce067722b 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -34,7 +34,7 @@ public final class ScoreDetails implements JsonSerializable { /** * Creates an instance of ScoreDetails class. */ - public ScoreDetails() { + private ScoreDetails() { } /** 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 3689eaa93965..1671eba6ab40 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -24,6 +25,11 @@ public final class SecureScoreControlDefinitionItemInner extends ProxyResource { */ private SecureScoreControlDefinitionItemProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -42,7 +48,7 @@ public final class SecureScoreControlDefinitionItemInner extends ProxyResource { /** * Creates an instance of SecureScoreControlDefinitionItemInner class. */ - public SecureScoreControlDefinitionItemInner() { + private SecureScoreControlDefinitionItemInner() { } /** @@ -54,6 +60,15 @@ private SecureScoreControlDefinitionItemProperties 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. * @@ -177,6 +192,8 @@ public static SecureScoreControlDefinitionItemInner fromJson(JsonReader jsonRead } else if ("properties".equals(fieldName)) { deserializedSecureScoreControlDefinitionItemInner.innerProperties = SecureScoreControlDefinitionItemProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 175d6f0f4ff5..89525269509d 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -48,7 +48,7 @@ public final class SecureScoreControlDefinitionItemProperties /** * Creates an instance of SecureScoreControlDefinitionItemProperties class. */ - public SecureScoreControlDefinitionItemProperties() { + private SecureScoreControlDefinitionItemProperties() { } /** 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 83f54e87b37f..021837fa8fbd 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +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; @@ -14,13 +15,18 @@ /** * Details of the security control, its score, and the health status of the relevant resources. */ -@Fluent +@Immutable public final class SecureScoreControlDetailsInner extends ProxyResource { /* * Calculation result data in control level */ private SecureScoreControlScoreDetailsInner innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -39,7 +45,7 @@ public final class SecureScoreControlDetailsInner extends ProxyResource { /** * Creates an instance of SecureScoreControlDetailsInner class. */ - public SecureScoreControlDetailsInner() { + private SecureScoreControlDetailsInner() { } /** @@ -51,6 +57,15 @@ private SecureScoreControlScoreDetailsInner 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. * @@ -136,20 +151,6 @@ public SecureScoreControlDefinitionItemInner definition() { return this.innerProperties() == null ? null : this.innerProperties().definition(); } - /** - * Set the definition property: Information about the security control. - * - * @param definition the definition value to set. - * @return the SecureScoreControlDetailsInner object itself. - */ - public SecureScoreControlDetailsInner withDefinition(SecureScoreControlDefinitionItemInner definition) { - if (this.innerProperties() == null) { - this.innerProperties = new SecureScoreControlScoreDetailsInner(); - } - this.innerProperties().withDefinition(definition); - return this; - } - /** * Get the max property: Maximum score available. * @@ -225,6 +226,8 @@ public static SecureScoreControlDetailsInner fromJson(JsonReader jsonReader) thr } else if ("properties".equals(fieldName)) { deserializedSecureScoreControlDetailsInner.innerProperties = SecureScoreControlScoreDetailsInner.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecureScoreControlDetailsInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 3c934221bfb1..6addc6298c6a 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,7 +14,7 @@ /** * Calculation result data in control level. */ -@Fluent +@Immutable public final class SecureScoreControlScoreDetailsInner implements JsonSerializable { /* @@ -56,7 +56,7 @@ public final class SecureScoreControlScoreDetailsInner /** * Creates an instance of SecureScoreControlScoreDetailsInner class. */ - public SecureScoreControlScoreDetailsInner() { + private SecureScoreControlScoreDetailsInner() { } /** @@ -123,17 +123,6 @@ public SecureScoreControlDefinitionItemInner definition() { return this.definition; } - /** - * Set the definition property: Information about the security control. - * - * @param definition the definition value to set. - * @return the SecureScoreControlScoreDetailsInner object itself. - */ - public SecureScoreControlScoreDetailsInner withDefinition(SecureScoreControlDefinitionItemInner definition) { - this.definition = definition; - return this; - } - /** * Get the max property: Maximum score available. * @@ -182,6 +171,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("score", this.innerScore); jsonWriter.writeJsonField("definition", this.definition); return jsonWriter.writeEndObject(); } 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 3ac1d2a6a8f8..e1f159ec947c 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -21,6 +22,11 @@ public final class SecureScoreItemInner extends ProxyResource { */ private SecureScoreItemProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -39,7 +45,7 @@ public final class SecureScoreItemInner extends ProxyResource { /** * Creates an instance of SecureScoreItemInner class. */ - public SecureScoreItemInner() { + private SecureScoreItemInner() { } /** @@ -51,6 +57,15 @@ private SecureScoreItemProperties 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. * @@ -82,7 +97,7 @@ public String id() { } /** - * Get the displayName property: The initiative’s name. + * Get the displayName property: The initiative's name. * * @return the displayName value. */ @@ -172,6 +187,8 @@ public static SecureScoreItemInner fromJson(JsonReader jsonReader) throws IOExce deserializedSecureScoreItemInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedSecureScoreItemInner.innerProperties = SecureScoreItemProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecureScoreItemInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 2ca1dbc7de3b..2e9bb93144b2 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -17,7 +17,7 @@ @Immutable public final class SecureScoreItemProperties implements JsonSerializable { /* - * The initiative’s name + * The initiative's name */ private String displayName; @@ -35,11 +35,11 @@ public final class SecureScoreItemProperties implements JsonSerializable writer.writeString(element)); jsonWriter.writeJsonField("metadata", metadata()); jsonWriter.writeJsonField("partnersData", partnersData()); @@ -185,6 +200,9 @@ public static SecurityAssessmentProperties fromJson(JsonReader jsonReader) throw if ("resourceDetails".equals(fieldName)) { deserializedSecurityAssessmentProperties.withResourceDetails(ResourceDetails.fromJson(reader)); + } else if ("risk".equals(fieldName)) { + deserializedSecurityAssessmentProperties + .withRisk(SecurityAssessmentPropertiesBaseRisk.fromJson(reader)); } else if ("displayName".equals(fieldName)) { deserializedSecurityAssessmentProperties.displayName = reader.getString(); } else if ("additionalData".equals(fieldName)) { 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 9aac9f03b59c..79a7a95f12d5 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; @@ -12,15 +12,17 @@ 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.SecurityAssessmentMetadataProperties; import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; import com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBase; +import com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBaseRisk; import java.io.IOException; import java.util.Map; /** * Describes properties of an assessment. */ -@Fluent +@Immutable public final class SecurityAssessmentPropertiesResponse extends SecurityAssessmentPropertiesBase { /* * The result of the assessment @@ -40,7 +42,7 @@ public final class SecurityAssessmentPropertiesResponse extends SecurityAssessme /** * Creates an instance of SecurityAssessmentPropertiesResponse class. */ - public SecurityAssessmentPropertiesResponse() { + private SecurityAssessmentPropertiesResponse() { } /** @@ -52,17 +54,6 @@ public AssessmentStatusResponse status() { return this.status; } - /** - * Set the status property: The result of the assessment. - * - * @param status the status value to set. - * @return the SecurityAssessmentPropertiesResponse object itself. - */ - public SecurityAssessmentPropertiesResponse withStatus(AssessmentStatusResponse status) { - this.status = status; - return this; - } - /** * Get the links property: Links relevant to the assessment. * @@ -83,42 +74,6 @@ public String displayName() { return this.displayName; } - /** - * {@inheritDoc} - */ - @Override - public SecurityAssessmentPropertiesResponse withResourceDetails(ResourceDetails resourceDetails) { - super.withResourceDetails(resourceDetails); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public SecurityAssessmentPropertiesResponse withAdditionalData(Map additionalData) { - super.withAdditionalData(additionalData); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public SecurityAssessmentPropertiesResponse withMetadata(SecurityAssessmentMetadataProperties metadata) { - super.withMetadata(metadata); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public SecurityAssessmentPropertiesResponse withPartnersData(SecurityAssessmentPartnerData partnersData) { - super.withPartnersData(partnersData); - return this; - } - /** * Validates the instance. * @@ -133,6 +88,9 @@ public void validate() { } else { status().validate(); } + if (risk() != null) { + risk().validate(); + } if (resourceDetails() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -160,6 +118,7 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeJsonField("resourceDetails", resourceDetails()); + jsonWriter.writeJsonField("risk", risk()); jsonWriter.writeMapField("additionalData", additionalData(), (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("metadata", metadata()); jsonWriter.writeJsonField("partnersData", partnersData()); @@ -187,6 +146,9 @@ public static SecurityAssessmentPropertiesResponse fromJson(JsonReader jsonReade if ("resourceDetails".equals(fieldName)) { deserializedSecurityAssessmentPropertiesResponse .withResourceDetails(ResourceDetails.fromJson(reader)); + } else if ("risk".equals(fieldName)) { + deserializedSecurityAssessmentPropertiesResponse + .withRisk(SecurityAssessmentPropertiesBaseRisk.fromJson(reader)); } else if ("displayName".equals(fieldName)) { deserializedSecurityAssessmentPropertiesResponse.displayName = reader.getString(); } else if ("additionalData".equals(fieldName)) { 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 14ba020c6b43..07fc5bed3e84 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 @@ -1,31 +1,39 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +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.AssessmentLinks; import com.azure.resourcemanager.security.models.AssessmentStatusResponse; import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataProperties; import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; +import com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBaseRisk; import java.io.IOException; import java.util.Map; /** * Security assessment on a resource - response format. */ -@Fluent +@Immutable public final class SecurityAssessmentResponseInner extends ProxyResource { /* * Describes properties of an assessment. */ private SecurityAssessmentPropertiesResponse innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -44,7 +52,7 @@ public final class SecurityAssessmentResponseInner extends ProxyResource { /** * Creates an instance of SecurityAssessmentResponseInner class. */ - public SecurityAssessmentResponseInner() { + private SecurityAssessmentResponseInner() { } /** @@ -56,6 +64,15 @@ private SecurityAssessmentPropertiesResponse 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. * @@ -96,17 +113,12 @@ public AssessmentStatusResponse status() { } /** - * Set the status property: The result of the assessment. + * Get the risk property: External model of risk result. * - * @param status the status value to set. - * @return the SecurityAssessmentResponseInner object itself. + * @return the risk value. */ - public SecurityAssessmentResponseInner withStatus(AssessmentStatusResponse status) { - if (this.innerProperties() == null) { - this.innerProperties = new SecurityAssessmentPropertiesResponse(); - } - this.innerProperties().withStatus(status); - return this; + public SecurityAssessmentPropertiesBaseRisk risk() { + return this.innerProperties() == null ? null : this.innerProperties().risk(); } /** @@ -118,20 +130,6 @@ public ResourceDetails resourceDetails() { return this.innerProperties() == null ? null : this.innerProperties().resourceDetails(); } - /** - * Set the resourceDetails property: Details of the resource that was assessed. - * - * @param resourceDetails the resourceDetails value to set. - * @return the SecurityAssessmentResponseInner object itself. - */ - public SecurityAssessmentResponseInner withResourceDetails(ResourceDetails resourceDetails) { - if (this.innerProperties() == null) { - this.innerProperties = new SecurityAssessmentPropertiesResponse(); - } - this.innerProperties().withResourceDetails(resourceDetails); - return this; - } - /** * Get the displayName property: User friendly display name of the assessment. * @@ -150,20 +148,6 @@ public Map additionalData() { return this.innerProperties() == null ? null : this.innerProperties().additionalData(); } - /** - * Set the additionalData property: Additional data regarding the assessment. - * - * @param additionalData the additionalData value to set. - * @return the SecurityAssessmentResponseInner object itself. - */ - public SecurityAssessmentResponseInner withAdditionalData(Map additionalData) { - if (this.innerProperties() == null) { - this.innerProperties = new SecurityAssessmentPropertiesResponse(); - } - this.innerProperties().withAdditionalData(additionalData); - return this; - } - /** * Get the links property: Links relevant to the assessment. * @@ -182,20 +166,6 @@ public SecurityAssessmentMetadataProperties metadata() { return this.innerProperties() == null ? null : this.innerProperties().metadata(); } - /** - * Set the metadata property: Describes properties of an assessment metadata. - * - * @param metadata the metadata value to set. - * @return the SecurityAssessmentResponseInner object itself. - */ - public SecurityAssessmentResponseInner withMetadata(SecurityAssessmentMetadataProperties metadata) { - if (this.innerProperties() == null) { - this.innerProperties = new SecurityAssessmentPropertiesResponse(); - } - this.innerProperties().withMetadata(metadata); - return this; - } - /** * Get the partnersData property: Data regarding 3rd party partner integration. * @@ -205,20 +175,6 @@ public SecurityAssessmentPartnerData partnersData() { return this.innerProperties() == null ? null : this.innerProperties().partnersData(); } - /** - * Set the partnersData property: Data regarding 3rd party partner integration. - * - * @param partnersData the partnersData value to set. - * @return the SecurityAssessmentResponseInner object itself. - */ - public SecurityAssessmentResponseInner withPartnersData(SecurityAssessmentPartnerData partnersData) { - if (this.innerProperties() == null) { - this.innerProperties = new SecurityAssessmentPropertiesResponse(); - } - this.innerProperties().withPartnersData(partnersData); - return this; - } - /** * Validates the instance. * @@ -266,6 +222,8 @@ public static SecurityAssessmentResponseInner fromJson(JsonReader jsonReader) th } else if ("properties".equals(fieldName)) { deserializedSecurityAssessmentResponseInner.innerProperties = SecurityAssessmentPropertiesResponse.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecurityAssessmentResponseInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 new file mode 100644 index 000000000000..d13272e27d3c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorInner.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.CloudName; +import com.azure.resourcemanager.security.models.CloudOffering; +import com.azure.resourcemanager.security.models.EnvironmentData; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * The security connector resource. + */ +@Fluent +public final class SecurityConnectorInner extends ProxyResource { + /* + * Security connector data + */ + private SecurityConnectorProperties innerProperties; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * Kind of the resource + */ + private String kind; + + /* + * Entity tag is used for comparing two or more entities from the same requested resource. + */ + private String etag; + + /* + * 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 SecurityConnectorInner class. + */ + public SecurityConnectorInner() { + } + + /** + * Get the innerProperties property: Security connector data. + * + * @return the innerProperties value. + */ + private SecurityConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the kind property: Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of the resource. + * + * @param kind the kind value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @param etag the etag value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * 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 hierarchyIdentifier property: The multi cloud resource identifier (account id in case of AWS connector, + * project number in case of GCP connector). + * + * @return the hierarchyIdentifier value. + */ + public String hierarchyIdentifier() { + return this.innerProperties() == null ? null : this.innerProperties().hierarchyIdentifier(); + } + + /** + * Set the hierarchyIdentifier property: The multi cloud resource identifier (account id in case of AWS connector, + * project number in case of GCP connector). + * + * @param hierarchyIdentifier the hierarchyIdentifier value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withHierarchyIdentifier(String hierarchyIdentifier) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityConnectorProperties(); + } + this.innerProperties().withHierarchyIdentifier(hierarchyIdentifier); + return this; + } + + /** + * Get the hierarchyIdentifierTrialEndDate property: The date on which the trial period will end, if applicable. + * Trial period exists for 30 days after upgrading to payed offerings. + * + * @return the hierarchyIdentifierTrialEndDate value. + */ + public OffsetDateTime hierarchyIdentifierTrialEndDate() { + return this.innerProperties() == null ? null : this.innerProperties().hierarchyIdentifierTrialEndDate(); + } + + /** + * Get the environmentName property: The multi cloud resource's cloud name. + * + * @return the environmentName value. + */ + public CloudName environmentName() { + return this.innerProperties() == null ? null : this.innerProperties().environmentName(); + } + + /** + * Set the environmentName property: The multi cloud resource's cloud name. + * + * @param environmentName the environmentName value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withEnvironmentName(CloudName environmentName) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityConnectorProperties(); + } + this.innerProperties().withEnvironmentName(environmentName); + return this; + } + + /** + * Get the offerings property: A collection of offerings for the security connector. + * + * @return the offerings value. + */ + public List offerings() { + return this.innerProperties() == null ? null : this.innerProperties().offerings(); + } + + /** + * Set the offerings property: A collection of offerings for the security connector. + * + * @param offerings the offerings value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withOfferings(List offerings) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityConnectorProperties(); + } + this.innerProperties().withOfferings(offerings); + return this; + } + + /** + * Get the environmentData property: The security connector environment data. + * + * @return the environmentData value. + */ + public EnvironmentData environmentData() { + return this.innerProperties() == null ? null : this.innerProperties().environmentData(); + } + + /** + * Set the environmentData property: The security connector environment data. + * + * @param environmentData the environmentData value to set. + * @return the SecurityConnectorInner object itself. + */ + public SecurityConnectorInner withEnvironmentData(EnvironmentData environmentData) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityConnectorProperties(); + } + this.innerProperties().withEnvironmentData(environmentData); + 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); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("etag", this.etag); + 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 ("properties".equals(fieldName)) { + deserializedSecurityConnectorInner.innerProperties = SecurityConnectorProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSecurityConnectorInner.tags = tags; + } else if ("location".equals(fieldName)) { + deserializedSecurityConnectorInner.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedSecurityConnectorInner.kind = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedSecurityConnectorInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedSecurityConnectorInner.systemData = SystemData.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 new file mode 100644 index 000000000000..6c9e114d2ca7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorProperties.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.CloudName; +import com.azure.resourcemanager.security.models.CloudOffering; +import com.azure.resourcemanager.security.models.EnvironmentData; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * A set of properties that defines the security connector configuration. + */ +@Fluent +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). + */ + 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. + */ + private OffsetDateTime hierarchyIdentifierTrialEndDate; + + /* + * The multi cloud resource's cloud name. + */ + private CloudName environmentName; + + /* + * A collection of offerings for the security connector. + */ + private List offerings; + + /* + * The security connector environment data. + */ + private EnvironmentData environmentData; + + /** + * Creates an instance of SecurityConnectorProperties class. + */ + public SecurityConnectorProperties() { + } + + /** + * Get the hierarchyIdentifier property: The multi cloud resource identifier (account id in case of AWS connector, + * project number in case of GCP connector). + * + * @return the hierarchyIdentifier value. + */ + public String hierarchyIdentifier() { + return this.hierarchyIdentifier; + } + + /** + * Set the hierarchyIdentifier property: The multi cloud resource identifier (account id in case of AWS connector, + * project number in case of GCP connector). + * + * @param hierarchyIdentifier the hierarchyIdentifier value to set. + * @return the SecurityConnectorProperties object itself. + */ + public SecurityConnectorProperties withHierarchyIdentifier(String hierarchyIdentifier) { + this.hierarchyIdentifier = hierarchyIdentifier; + return this; + } + + /** + * Get the hierarchyIdentifierTrialEndDate property: The date on which the trial period will end, if applicable. + * Trial period exists for 30 days after upgrading to payed offerings. + * + * @return the hierarchyIdentifierTrialEndDate value. + */ + public OffsetDateTime hierarchyIdentifierTrialEndDate() { + return this.hierarchyIdentifierTrialEndDate; + } + + /** + * Get the environmentName property: The multi cloud resource's cloud name. + * + * @return the environmentName value. + */ + public CloudName environmentName() { + return this.environmentName; + } + + /** + * Set the environmentName property: The multi cloud resource's cloud name. + * + * @param environmentName the environmentName value to set. + * @return the SecurityConnectorProperties object itself. + */ + public SecurityConnectorProperties withEnvironmentName(CloudName environmentName) { + this.environmentName = environmentName; + return this; + } + + /** + * Get the offerings property: A collection of offerings for the security connector. + * + * @return the offerings value. + */ + public List offerings() { + return this.offerings; + } + + /** + * Set the offerings property: A collection of offerings for the security connector. + * + * @param offerings the offerings value to set. + * @return the SecurityConnectorProperties object itself. + */ + public SecurityConnectorProperties withOfferings(List offerings) { + this.offerings = offerings; + return this; + } + + /** + * Get the environmentData property: The security connector environment data. + * + * @return the environmentData value. + */ + public EnvironmentData environmentData() { + return this.environmentData; + } + + /** + * Set the environmentData property: The security connector environment data. + * + * @param environmentData the environmentData value to set. + * @return the SecurityConnectorProperties object itself. + */ + public SecurityConnectorProperties withEnvironmentData(EnvironmentData environmentData) { + this.environmentData = environmentData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (offerings() != null) { + offerings().forEach(e -> e.validate()); + } + if (environmentData() != null) { + 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 new file mode 100644 index 000000000000..d21387605e15 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.NotificationsSource; +import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole; +import java.io.IOException; +import java.util.List; + +/** + * Contact details and configurations for notifications coming from Microsoft Defender for Cloud. + */ +@Fluent +public final class SecurityContactInner extends ProxyResource { + /* + * Security contact data + */ + private SecurityContactProperties 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 SecurityContactInner class. + */ + public SecurityContactInner() { + } + + /** + * Get the innerProperties property: Security contact data. + * + * @return the innerProperties value. + */ + private SecurityContactProperties 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 emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud + * by the configurations defined in this security contact. + * + * @return the emails value. + */ + public String emails() { + return this.innerProperties() == null ? null : this.innerProperties().emails(); + } + + /** + * Set the emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud + * by the configurations defined in this security contact. + * + * @param emails the emails value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withEmails(String emails) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityContactProperties(); + } + this.innerProperties().withEmails(emails); + return this; + } + + /** + * Get the phone property: The security contact's phone number. + * + * @return the phone value. + */ + public String phone() { + return this.innerProperties() == null ? null : this.innerProperties().phone(); + } + + /** + * Set the phone property: The security contact's phone number. + * + * @param phone the phone value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withPhone(String phone) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityContactProperties(); + } + this.innerProperties().withPhone(phone); + return this; + } + + /** + * Get the isEnabled property: Indicates whether the security contact is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: Indicates whether the security contact is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withIsEnabled(Boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityContactProperties(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the notificationsSources property: A collection of sources types which evaluate the email notification. + * + * @return the notificationsSources value. + */ + public List notificationsSources() { + return this.innerProperties() == null ? null : this.innerProperties().notificationsSources(); + } + + /** + * Set the notificationsSources property: A collection of sources types which evaluate the email notification. + * + * @param notificationsSources the notificationsSources value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner withNotificationsSources(List notificationsSources) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityContactProperties(); + } + this.innerProperties().withNotificationsSources(notificationsSources); + return this; + } + + /** + * Get the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for + * Cloud to persons with specific RBAC roles on the subscription. + * + * @return the notificationsByRole value. + */ + public SecurityContactPropertiesNotificationsByRole notificationsByRole() { + return this.innerProperties() == null ? null : this.innerProperties().notificationsByRole(); + } + + /** + * Set the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for + * Cloud to persons with specific RBAC roles on the subscription. + * + * @param notificationsByRole the notificationsByRole value to set. + * @return the SecurityContactInner object itself. + */ + public SecurityContactInner + withNotificationsByRole(SecurityContactPropertiesNotificationsByRole notificationsByRole) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityContactProperties(); + } + this.innerProperties().withNotificationsByRole(notificationsByRole); + 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 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 if ("systemData".equals(fieldName)) { + deserializedSecurityContactInner.systemData = SystemData.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 new file mode 100644 index 000000000000..abc0cf7c232d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactProperties.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.NotificationsSource; +import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole; +import java.io.IOException; +import java.util.List; + +/** + * Describes security contact properties. + */ +@Fluent +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. + */ + private String emails; + + /* + * The security contact's phone number + */ + private String phone; + + /* + * Indicates whether the security contact is enabled. + */ + private Boolean isEnabled; + + /* + * A collection of sources types which evaluate the email notification. + */ + private List notificationsSources; + + /* + * Defines whether to send email notifications from Microsoft Defender for Cloud to persons with specific RBAC roles + * on the subscription. + */ + private SecurityContactPropertiesNotificationsByRole notificationsByRole; + + /** + * Creates an instance of SecurityContactProperties class. + */ + public SecurityContactProperties() { + } + + /** + * 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. + * + * @return the emails value. + */ + public String emails() { + return this.emails; + } + + /** + * Set the emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud + * by the configurations defined in this security contact. + * + * @param emails the emails value to set. + * @return the SecurityContactProperties object itself. + */ + public SecurityContactProperties withEmails(String emails) { + this.emails = emails; + return this; + } + + /** + * Get the phone property: The security contact's phone number. + * + * @return the phone value. + */ + public String phone() { + return this.phone; + } + + /** + * Set the phone property: The security contact's phone number. + * + * @param phone the phone value to set. + * @return the SecurityContactProperties object itself. + */ + public SecurityContactProperties withPhone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get the isEnabled property: Indicates whether the security contact is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Indicates whether the security contact is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the SecurityContactProperties object itself. + */ + public SecurityContactProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the notificationsSources property: A collection of sources types which evaluate the email notification. + * + * @return the notificationsSources value. + */ + public List notificationsSources() { + return this.notificationsSources; + } + + /** + * Set the notificationsSources property: A collection of sources types which evaluate the email notification. + * + * @param notificationsSources the notificationsSources value to set. + * @return the SecurityContactProperties object itself. + */ + public SecurityContactProperties withNotificationsSources(List notificationsSources) { + this.notificationsSources = notificationsSources; + return this; + } + + /** + * Get the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for + * Cloud to persons with specific RBAC roles on the subscription. + * + * @return the notificationsByRole value. + */ + public SecurityContactPropertiesNotificationsByRole notificationsByRole() { + return this.notificationsByRole; + } + + /** + * Set the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for + * Cloud to persons with specific RBAC roles on the subscription. + * + * @param notificationsByRole the notificationsByRole value to set. + * @return the SecurityContactProperties object itself. + */ + public SecurityContactProperties + withNotificationsByRole(SecurityContactPropertiesNotificationsByRole notificationsByRole) { + this.notificationsByRole = notificationsByRole; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (notificationsSources() != null) { + notificationsSources().forEach(e -> e.validate()); + } + if (notificationsByRole() != null) { + 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 new file mode 100644 index 000000000000..3b1191c9544a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.Identity; +import java.io.IOException; + +/** + * Security operator under a given subscription and pricing. + */ +@Immutable +public final class SecurityOperatorInner extends ProxyResource { + /* + * Identity for the resource. + */ + private Identity identity; + + /* + * 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 SecurityOperatorInner class. + */ + private SecurityOperatorInner() { + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + 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 if ("systemData".equals(fieldName)) { + deserializedSecurityOperatorInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityOperatorInner; + }); + } +} 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 908a926108c7..fb6ff37e99fa 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +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; @@ -14,9 +15,9 @@ import java.io.IOException; /** - * The SecuritySolution model. + * Concrete proxy resource types can be created by aliasing this type using a specific property type. */ -@Fluent +@Immutable public final class SecuritySolutionInner extends ProxyResource { /* * The properties property. @@ -28,6 +29,11 @@ public final class SecuritySolutionInner extends ProxyResource { */ private String location; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -46,7 +52,7 @@ public final class SecuritySolutionInner extends ProxyResource { /** * Creates an instance of SecuritySolutionInner class. */ - public SecuritySolutionInner() { + private SecuritySolutionInner() { } /** @@ -67,6 +73,15 @@ public String location() { return this.location; } + /** + * 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. * @@ -106,20 +121,6 @@ public SecurityFamily securityFamily() { return this.innerProperties() == null ? null : this.innerProperties().securityFamily(); } - /** - * Set the securityFamily property: The security family of the security solution. - * - * @param securityFamily the securityFamily value to set. - * @return the SecuritySolutionInner object itself. - */ - public SecuritySolutionInner withSecurityFamily(SecurityFamily securityFamily) { - if (this.innerProperties() == null) { - this.innerProperties = new SecuritySolutionProperties(); - } - this.innerProperties().withSecurityFamily(securityFamily); - return this; - } - /** * Get the provisioningState property: The security family provisioning State. * @@ -129,20 +130,6 @@ public ProvisioningState provisioningState() { return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } - /** - * Set the provisioningState property: The security family provisioning State. - * - * @param provisioningState the provisioningState value to set. - * @return the SecuritySolutionInner object itself. - */ - public SecuritySolutionInner withProvisioningState(ProvisioningState provisioningState) { - if (this.innerProperties() == null) { - this.innerProperties = new SecuritySolutionProperties(); - } - this.innerProperties().withProvisioningState(provisioningState); - return this; - } - /** * Get the template property: The security solutions' template. * @@ -152,20 +139,6 @@ public String template() { return this.innerProperties() == null ? null : this.innerProperties().template(); } - /** - * Set the template property: The security solutions' template. - * - * @param template the template value to set. - * @return the SecuritySolutionInner object itself. - */ - public SecuritySolutionInner withTemplate(String template) { - if (this.innerProperties() == null) { - this.innerProperties = new SecuritySolutionProperties(); - } - this.innerProperties().withTemplate(template); - return this; - } - /** * Get the protectionStatus property: The security solutions' status. * @@ -175,20 +148,6 @@ public String protectionStatus() { return this.innerProperties() == null ? null : this.innerProperties().protectionStatus(); } - /** - * Set the protectionStatus property: The security solutions' status. - * - * @param protectionStatus the protectionStatus value to set. - * @return the SecuritySolutionInner object itself. - */ - public SecuritySolutionInner withProtectionStatus(String protectionStatus) { - if (this.innerProperties() == null) { - this.innerProperties = new SecuritySolutionProperties(); - } - this.innerProperties().withProtectionStatus(protectionStatus); - return this; - } - /** * Validates the instance. * @@ -232,10 +191,12 @@ public static SecuritySolutionInner fromJson(JsonReader jsonReader) throws IOExc 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 if ("properties".equals(fieldName)) { + deserializedSecuritySolutionInner.innerProperties = SecuritySolutionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecuritySolutionInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 a699203e8388..314e08b53ba4 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,7 +17,7 @@ /** * The SecuritySolutionProperties model. */ -@Fluent +@Immutable public final class SecuritySolutionProperties implements JsonSerializable { /* * The security family of the security solution @@ -42,7 +42,7 @@ public final class SecuritySolutionProperties implements JsonSerializable { /* @@ -27,7 +27,7 @@ public final class SecuritySolutionsReferenceDataListInner /** * Creates an instance of SecuritySolutionsReferenceDataListInner class. */ - public SecuritySolutionsReferenceDataListInner() { + private SecuritySolutionsReferenceDataListInner() { } /** @@ -39,17 +39,6 @@ public List value() { return this.value; } - /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the SecuritySolutionsReferenceDataListInner object itself. - */ - public SecuritySolutionsReferenceDataListInner withValue(List value) { - this.value = value; - return this; - } - /** * Validates the instance. * 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 811148c1246d..34bac7684394 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -16,7 +16,7 @@ /** * The SecuritySolutionsReferenceDataProperties model. */ -@Fluent +@Immutable public final class SecuritySolutionsReferenceDataProperties implements JsonSerializable { /* @@ -57,7 +57,7 @@ public final class SecuritySolutionsReferenceDataProperties /** * Creates an instance of SecuritySolutionsReferenceDataProperties class. */ - public SecuritySolutionsReferenceDataProperties() { + private SecuritySolutionsReferenceDataProperties() { } /** @@ -69,17 +69,6 @@ public SecurityFamily securityFamily() { return this.securityFamily; } - /** - * Set the securityFamily property: The security family of the security solution. - * - * @param securityFamily the securityFamily value to set. - * @return the SecuritySolutionsReferenceDataProperties object itself. - */ - public SecuritySolutionsReferenceDataProperties withSecurityFamily(SecurityFamily securityFamily) { - this.securityFamily = securityFamily; - return this; - } - /** * Get the alertVendorName property: The security solutions' vendor name. * @@ -89,17 +78,6 @@ public String alertVendorName() { return this.alertVendorName; } - /** - * Set the alertVendorName property: The security solutions' vendor name. - * - * @param alertVendorName the alertVendorName value to set. - * @return the SecuritySolutionsReferenceDataProperties object itself. - */ - public SecuritySolutionsReferenceDataProperties withAlertVendorName(String alertVendorName) { - this.alertVendorName = alertVendorName; - return this; - } - /** * Get the packageInfoUrl property: The security solutions' package info url. * @@ -109,17 +87,6 @@ public String packageInfoUrl() { return this.packageInfoUrl; } - /** - * Set the packageInfoUrl property: The security solutions' package info url. - * - * @param packageInfoUrl the packageInfoUrl value to set. - * @return the SecuritySolutionsReferenceDataProperties object itself. - */ - public SecuritySolutionsReferenceDataProperties withPackageInfoUrl(String packageInfoUrl) { - this.packageInfoUrl = packageInfoUrl; - return this; - } - /** * Get the productName property: The security solutions' product name. * @@ -129,17 +96,6 @@ public String productName() { return this.productName; } - /** - * Set the productName property: The security solutions' product name. - * - * @param productName the productName value to set. - * @return the SecuritySolutionsReferenceDataProperties object itself. - */ - public SecuritySolutionsReferenceDataProperties withProductName(String productName) { - this.productName = productName; - return this; - } - /** * Get the publisher property: The security solutions' publisher. * @@ -149,17 +105,6 @@ public String publisher() { return this.publisher; } - /** - * Set the publisher property: The security solutions' publisher. - * - * @param publisher the publisher value to set. - * @return the SecuritySolutionsReferenceDataProperties object itself. - */ - public SecuritySolutionsReferenceDataProperties withPublisher(String publisher) { - this.publisher = publisher; - return this; - } - /** * Get the publisherDisplayName property: The security solutions' publisher display name. * @@ -169,17 +114,6 @@ public String publisherDisplayName() { return this.publisherDisplayName; } - /** - * Set the publisherDisplayName property: The security solutions' publisher display name. - * - * @param publisherDisplayName the publisherDisplayName value to set. - * @return the SecuritySolutionsReferenceDataProperties object itself. - */ - public SecuritySolutionsReferenceDataProperties withPublisherDisplayName(String publisherDisplayName) { - this.publisherDisplayName = publisherDisplayName; - return this; - } - /** * Get the template property: The security solutions' template. * @@ -189,17 +123,6 @@ public String template() { return this.template; } - /** - * Set the template property: The security solutions' template. - * - * @param template the template value to set. - * @return the SecuritySolutionsReferenceDataProperties object itself. - */ - public SecuritySolutionsReferenceDataProperties withTemplate(String template) { - this.template = template; - return this; - } - /** * Validates the instance. * 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 index ad049f7516fc..87601f9bbd1c 100644 --- 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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; @@ -24,7 +25,12 @@ public final class SecurityStandardInner extends ProxyResource { /* * Properties of a security standard */ - private StandardProperties innerProperties; + private SecurityStandardProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; /* * The type of the resource. @@ -52,10 +58,19 @@ public SecurityStandardInner() { * * @return the innerProperties value. */ - private StandardProperties innerProperties() { + private SecurityStandardProperties 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. * @@ -103,7 +118,7 @@ public String displayName() { */ public SecurityStandardInner withDisplayName(String displayName) { if (this.innerProperties() == null) { - this.innerProperties = new StandardProperties(); + this.innerProperties = new SecurityStandardProperties(); } this.innerProperties().withDisplayName(displayName); return this; @@ -135,7 +150,7 @@ public String description() { */ public SecurityStandardInner withDescription(String description) { if (this.innerProperties() == null) { - this.innerProperties = new StandardProperties(); + this.innerProperties = new SecurityStandardProperties(); } this.innerProperties().withDescription(description); return this; @@ -158,7 +173,7 @@ public List assessments() { */ public SecurityStandardInner withAssessments(List assessments) { if (this.innerProperties() == null) { - this.innerProperties = new StandardProperties(); + this.innerProperties = new SecurityStandardProperties(); } this.innerProperties().withAssessments(assessments); return this; @@ -181,7 +196,7 @@ public List cloudProviders() { */ public SecurityStandardInner withCloudProviders(List cloudProviders) { if (this.innerProperties() == null) { - this.innerProperties = new StandardProperties(); + this.innerProperties = new SecurityStandardProperties(); } this.innerProperties().withCloudProviders(cloudProviders); return this; @@ -204,7 +219,7 @@ public String policySetDefinitionId() { */ public SecurityStandardInner withPolicySetDefinitionId(String policySetDefinitionId) { if (this.innerProperties() == null) { - this.innerProperties = new StandardProperties(); + this.innerProperties = new SecurityStandardProperties(); } this.innerProperties().withPolicySetDefinitionId(policySetDefinitionId); return this; @@ -227,7 +242,7 @@ public StandardMetadata metadata() { */ public SecurityStandardInner withMetadata(StandardMetadata metadata) { if (this.innerProperties() == null) { - this.innerProperties = new StandardProperties(); + this.innerProperties = new SecurityStandardProperties(); } this.innerProperties().withMetadata(metadata); return this; @@ -277,7 +292,9 @@ public static SecurityStandardInner fromJson(JsonReader jsonReader) throws IOExc } else if ("type".equals(fieldName)) { deserializedSecurityStandardInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { - deserializedSecurityStandardInner.innerProperties = StandardProperties.fromJson(reader); + deserializedSecurityStandardInner.innerProperties = SecurityStandardProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecurityStandardInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityStandardProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityStandardProperties.java new file mode 100644 index 000000000000..468e13fba158 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityStandardProperties.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 SecurityStandardProperties 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 SecurityStandardProperties class. + */ + public SecurityStandardProperties() { + } + + /** + * 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 SecurityStandardProperties object itself. + */ + public SecurityStandardProperties 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 SecurityStandardProperties object itself. + */ + public SecurityStandardProperties 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 SecurityStandardProperties object itself. + */ + public SecurityStandardProperties 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 SecurityStandardProperties object itself. + */ + public SecurityStandardProperties 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 SecurityStandardProperties object itself. + */ + public SecurityStandardProperties 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 SecurityStandardProperties object itself. + */ + public SecurityStandardProperties 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 SecurityStandardProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityStandardProperties 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 SecurityStandardProperties. + */ + public static SecurityStandardProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityStandardProperties deserializedSecurityStandardProperties = new SecurityStandardProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSecurityStandardProperties.displayName = reader.getString(); + } else if ("standardType".equals(fieldName)) { + deserializedSecurityStandardProperties.standardType = StandardType.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSecurityStandardProperties.description = reader.getString(); + } else if ("assessments".equals(fieldName)) { + List assessments + = reader.readArray(reader1 -> PartialAssessmentProperties.fromJson(reader1)); + deserializedSecurityStandardProperties.assessments = assessments; + } else if ("cloudProviders".equals(fieldName)) { + List cloudProviders + = reader.readArray(reader1 -> StandardSupportedCloud.fromString(reader1.getString())); + deserializedSecurityStandardProperties.cloudProviders = cloudProviders; + } else if ("policySetDefinitionId".equals(fieldName)) { + deserializedSecurityStandardProperties.policySetDefinitionId = reader.getString(); + } else if ("metadata".equals(fieldName)) { + deserializedSecurityStandardProperties.metadata = StandardMetadata.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityStandardProperties; + }); + } +} 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 new file mode 100644 index 000000000000..0091f46b09f6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.AdditionalData; +import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SubAssessmentStatus; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Security sub-assessment on a resource. + */ +@Immutable +public final class SecuritySubAssessmentInner extends ProxyResource { + /* + * Describes properties of an sub-assessment. + */ + private SecuritySubAssessmentProperties 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 SecuritySubAssessmentInner class. + */ + private SecuritySubAssessmentInner() { + } + + /** + * Get the innerProperties property: Describes properties of an sub-assessment. + * + * @return the innerProperties value. + */ + private SecuritySubAssessmentProperties 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 id property: Vulnerability ID. + * + * @return the id value. + */ + public String idPropertiesId() { + return this.innerProperties() == null ? null : this.innerProperties().id(); + } + + /** + * Get the displayName property: User friendly display name of the sub-assessment. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the status property: Status of the sub-assessment. + * + * @return the status value. + */ + public SubAssessmentStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the remediation property: Information on how to remediate this sub-assessment. + * + * @return the remediation value. + */ + public String remediation() { + return this.innerProperties() == null ? null : this.innerProperties().remediation(); + } + + /** + * Get the impact property: Description of the impact of this sub-assessment. + * + * @return the impact value. + */ + public String impact() { + return this.innerProperties() == null ? null : this.innerProperties().impact(); + } + + /** + * Get the category property: Category of the sub-assessment. + * + * @return the category value. + */ + public String category() { + return this.innerProperties() == null ? null : this.innerProperties().category(); + } + + /** + * Get the description property: Human readable description of the assessment status. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the timeGenerated property: The date and time the sub-assessment was generated. + * + * @return the timeGenerated value. + */ + public OffsetDateTime timeGenerated() { + return this.innerProperties() == null ? null : this.innerProperties().timeGenerated(); + } + + /** + * Get the resourceDetails property: Details of the resource that was assessed. + * + * @return the resourceDetails value. + */ + public ResourceDetails resourceDetails() { + return this.innerProperties() == null ? null : this.innerProperties().resourceDetails(); + } + + /** + * Get the additionalData property: Details of the sub-assessment. + * + * @return the additionalData value. + */ + public AdditionalData additionalData() { + return this.innerProperties() == null ? null : this.innerProperties().additionalData(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.systemData = SystemData.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 new file mode 100644 index 000000000000..d23bf316b59b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.AdditionalData; +import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SubAssessmentStatus; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Describes properties of an sub-assessment. + */ +@Immutable +public final class SecuritySubAssessmentProperties implements JsonSerializable { + /* + * Vulnerability ID + */ + private String id; + + /* + * User friendly display name of the sub-assessment + */ + private String displayName; + + /* + * Status of the sub-assessment + */ + private SubAssessmentStatus status; + + /* + * Information on how to remediate this sub-assessment + */ + private String remediation; + + /* + * Description of the impact of this sub-assessment + */ + private String impact; + + /* + * Category of the sub-assessment + */ + private String category; + + /* + * Human readable description of the assessment status + */ + private String description; + + /* + * The date and time the sub-assessment was generated + */ + private OffsetDateTime timeGenerated; + + /* + * Details of the resource that was assessed + */ + private ResourceDetails resourceDetails; + + /* + * Details of the sub-assessment + */ + private AdditionalData additionalData; + + /** + * Creates an instance of SecuritySubAssessmentProperties class. + */ + private SecuritySubAssessmentProperties() { + } + + /** + * Get the id property: Vulnerability ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the displayName property: User friendly display name of the sub-assessment. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the status property: Status of the sub-assessment. + * + * @return the status value. + */ + public SubAssessmentStatus status() { + return this.status; + } + + /** + * Get the remediation property: Information on how to remediate this sub-assessment. + * + * @return the remediation value. + */ + public String remediation() { + return this.remediation; + } + + /** + * Get the impact property: Description of the impact of this sub-assessment. + * + * @return the impact value. + */ + public String impact() { + return this.impact; + } + + /** + * Get the category property: Category of the sub-assessment. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Get the description property: Human readable description of the assessment status. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the timeGenerated property: The date and time the sub-assessment was generated. + * + * @return the timeGenerated value. + */ + public OffsetDateTime timeGenerated() { + return this.timeGenerated; + } + + /** + * Get the resourceDetails property: Details of the resource that was assessed. + * + * @return the resourceDetails value. + */ + public ResourceDetails resourceDetails() { + return this.resourceDetails; + } + + /** + * Get the additionalData property: Details of the sub-assessment. + * + * @return the additionalData value. + */ + public AdditionalData additionalData() { + return this.additionalData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + if (resourceDetails() != null) { + resourceDetails().validate(); + } + if (additionalData() != null) { + 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 new file mode 100644 index 000000000000..ac4cbd56d9c2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.SecurityTaskParameters; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Security task that we recommend to do in order to strengthen security. + */ +@Immutable +public final class SecurityTaskInner extends ProxyResource { + /* + * Describes properties of a task. + */ + private SecurityTaskProperties 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 SecurityTaskInner class. + */ + private SecurityTaskInner() { + } + + /** + * Get the innerProperties property: Describes properties of a task. + * + * @return the innerProperties value. + */ + private SecurityTaskProperties 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 state property: State of the task (Active, Resolved etc.). + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the creationTimeUtc property: The time this task was discovered in UTC. + * + * @return the creationTimeUtc value. + */ + public OffsetDateTime creationTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().creationTimeUtc(); + } + + /** + * Get the securityTaskParameters property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @return the securityTaskParameters value. + */ + public SecurityTaskParameters securityTaskParameters() { + return this.innerProperties() == null ? null : this.innerProperties().securityTaskParameters(); + } + + /** + * Get the lastStateChangeTimeUtc property: The time this task's details were last changed in UTC. + * + * @return the lastStateChangeTimeUtc value. + */ + public OffsetDateTime lastStateChangeTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastStateChangeTimeUtc(); + } + + /** + * Get the subState property: Additional data on the state of the task. + * + * @return the subState value. + */ + public String subState() { + return this.innerProperties() == null ? null : this.innerProperties().subState(); + } + + /** + * 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 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 if ("systemData".equals(fieldName)) { + deserializedSecurityTaskInner.systemData = SystemData.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 new file mode 100644 index 000000000000..80ab07c97848 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.SecurityTaskParameters; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Describes properties of a task. + */ +@Immutable +public final class SecurityTaskProperties implements JsonSerializable { + /* + * State of the task (Active, Resolved etc.) + */ + private String state; + + /* + * The time this task was discovered in UTC + */ + private OffsetDateTime creationTimeUtc; + + /* + * Changing set of properties, depending on the task type that is derived from the name field + */ + private SecurityTaskParameters securityTaskParameters; + + /* + * The time this task's details were last changed in UTC + */ + private OffsetDateTime lastStateChangeTimeUtc; + + /* + * Additional data on the state of the task + */ + private String subState; + + /** + * Creates an instance of SecurityTaskProperties class. + */ + private SecurityTaskProperties() { + } + + /** + * Get the state property: State of the task (Active, Resolved etc.). + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the creationTimeUtc property: The time this task was discovered in UTC. + * + * @return the creationTimeUtc value. + */ + public OffsetDateTime creationTimeUtc() { + return this.creationTimeUtc; + } + + /** + * Get the securityTaskParameters property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @return the securityTaskParameters value. + */ + public SecurityTaskParameters securityTaskParameters() { + return this.securityTaskParameters; + } + + /** + * Get the lastStateChangeTimeUtc property: The time this task's details were last changed in UTC. + * + * @return the lastStateChangeTimeUtc value. + */ + public OffsetDateTime lastStateChangeTimeUtc() { + return this.lastStateChangeTimeUtc; + } + + /** + * Get the subState property: Additional data on the state of the task. + * + * @return the subState value. + */ + public String subState() { + return this.subState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securityTaskParameters() != null) { + 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/ServerVulnerabilityAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java index 3fa335b52741..42d2571fd5cb 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -22,6 +23,11 @@ public final class ServerVulnerabilityAssessmentInner extends ProxyResource { */ private ServerVulnerabilityAssessmentProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -40,7 +46,7 @@ public final class ServerVulnerabilityAssessmentInner extends ProxyResource { /** * Creates an instance of ServerVulnerabilityAssessmentInner class. */ - public ServerVulnerabilityAssessmentInner() { + private ServerVulnerabilityAssessmentInner() { } /** @@ -52,6 +58,15 @@ private ServerVulnerabilityAssessmentProperties 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. * @@ -138,6 +153,8 @@ public static ServerVulnerabilityAssessmentInner fromJson(JsonReader jsonReader) } else if ("properties".equals(fieldName)) { deserializedServerVulnerabilityAssessmentInner.innerProperties = ServerVulnerabilityAssessmentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 00606cbdf4ab..c8da9a8374bd 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -26,7 +26,7 @@ public final class ServerVulnerabilityAssessmentProperties /** * Creates an instance of ServerVulnerabilityAssessmentProperties class. */ - public ServerVulnerabilityAssessmentProperties() { + private ServerVulnerabilityAssessmentProperties() { } /** 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 6c4354abd1a4..b01473334788 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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 3a39c833028a..c9c8dca573ce 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +15,7 @@ /** * List of server vulnerability assessments. */ -@Fluent +@Immutable public final class ServerVulnerabilityAssessmentsListInner implements JsonSerializable { /* @@ -26,7 +26,7 @@ public final class ServerVulnerabilityAssessmentsListInner /** * Creates an instance of ServerVulnerabilityAssessmentsListInner class. */ - public ServerVulnerabilityAssessmentsListInner() { + private ServerVulnerabilityAssessmentsListInner() { } /** @@ -38,17 +38,6 @@ public List value() { return this.value; } - /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the ServerVulnerabilityAssessmentsListInner object itself. - */ - public ServerVulnerabilityAssessmentsListInner withValue(List value) { - this.value = value; - return this; - } - /** * Validates the instance. * 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 c2bb9f5311b9..74f728bed194 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.json.JsonReader; @@ -12,12 +12,13 @@ import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AzureServersSetting; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKind; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingProperties; import java.io.IOException; /** * A base vulnerability assessments setting on servers in the defined scope. */ -@Immutable +@Fluent public class ServerVulnerabilityAssessmentsSettingInner extends ProxyResource { /* * The kind of the server vulnerability assessments setting. @@ -25,6 +26,11 @@ public class ServerVulnerabilityAssessmentsSettingInner extends ProxyResource { private ServerVulnerabilityAssessmentsSettingKind kind = ServerVulnerabilityAssessmentsSettingKind.fromString("ServerVulnerabilityAssessmentsSetting"); + /* + * The resource-specific properties for this resource. + */ + private ServerVulnerabilityAssessmentsSettingProperties properties; + /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ @@ -60,6 +66,27 @@ public ServerVulnerabilityAssessmentsSettingKind kind() { return this.kind; } + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ServerVulnerabilityAssessmentsSettingProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ServerVulnerabilityAssessmentsSettingInner object itself. + */ + public ServerVulnerabilityAssessmentsSettingInner + withProperties(ServerVulnerabilityAssessmentsSettingProperties properties) { + this.properties = properties; + return this; + } + /** * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * @@ -116,6 +143,9 @@ public String id() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (properties() != null) { + properties().validate(); + } } /** @@ -125,6 +155,7 @@ public void validate() { 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(); } @@ -180,6 +211,9 @@ static ServerVulnerabilityAssessmentsSettingInner fromJsonKnownDiscriminator(Jso } else if ("kind".equals(fieldName)) { deserializedServerVulnerabilityAssessmentsSettingInner.kind = ServerVulnerabilityAssessmentsSettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentsSettingInner.properties + = ServerVulnerabilityAssessmentsSettingProperties.fromJson(reader); } else if ("systemData".equals(fieldName)) { deserializedServerVulnerabilityAssessmentsSettingInner.systemData = SystemData.fromJson(reader); } else { 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 b0cc33254d4e..6d50e843daf3 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 @@ -1,29 +1,41 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; -import com.azure.core.annotation.Immutable; +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.AlertSyncSettings; import com.azure.resourcemanager.security.models.DataExportSettings; import com.azure.resourcemanager.security.models.SettingKind; +import com.azure.resourcemanager.security.models.SettingProperties; import java.io.IOException; /** * The kind of the security setting. */ -@Immutable +@Fluent public class SettingInner extends ProxyResource { /* * the kind of the settings string */ private SettingKind kind = SettingKind.fromString("Setting"); + /* + * The resource-specific properties for this resource. + */ + private SettingProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -54,6 +66,46 @@ public SettingKind kind() { return this.kind; } + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SettingProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SettingInner object itself. + */ + public SettingInner withProperties(SettingProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + 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 SettingInner object itself. + */ + SettingInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + /** * Get the type property: The type of the resource. * @@ -90,6 +142,9 @@ public String id() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (properties() != null) { + properties().validate(); + } } /** @@ -99,6 +154,7 @@ public void validate() { 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(); } @@ -153,6 +209,10 @@ static SettingInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOE deserializedSettingInner.type = reader.getString(); } else if ("kind".equals(fieldName)) { deserializedSettingInner.kind = SettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedSettingInner.properties = SettingProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSettingInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SqlVulnerabilityAssessmentScanOperationResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SqlVulnerabilityAssessmentScanOperationResultInner.java new file mode 100644 index 000000000000..6ff9cb64d42a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SqlVulnerabilityAssessmentScanOperationResultInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +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.SqlVulnerabilityAssessmentScanOperationResultProperties; +import java.io.IOException; + +/** + * Represents the result of a SQL Vulnerability Assessment scan operation, wrapped in the ARM resource envelope. + */ +@Immutable +public final class SqlVulnerabilityAssessmentScanOperationResultInner extends ProxyResource { + /* + * Represents the properties of a SQL Vulnerability Assessment scan operation result. + */ + private SqlVulnerabilityAssessmentScanOperationResultProperties properties; + + /* + * 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 SqlVulnerabilityAssessmentScanOperationResultInner class. + */ + private SqlVulnerabilityAssessmentScanOperationResultInner() { + } + + /** + * Get the properties property: Represents the properties of a SQL Vulnerability Assessment scan operation result. + * + * @return the properties value. + */ + public SqlVulnerabilityAssessmentScanOperationResultProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 SqlVulnerabilityAssessmentScanOperationResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlVulnerabilityAssessmentScanOperationResultInner 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 SqlVulnerabilityAssessmentScanOperationResultInner. + */ + public static SqlVulnerabilityAssessmentScanOperationResultInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlVulnerabilityAssessmentScanOperationResultInner deserializedSqlVulnerabilityAssessmentScanOperationResultInner + = new SqlVulnerabilityAssessmentScanOperationResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentScanOperationResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentScanOperationResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentScanOperationResultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentScanOperationResultInner.properties + = SqlVulnerabilityAssessmentScanOperationResultProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentScanOperationResultInner.systemData + = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlVulnerabilityAssessmentScanOperationResultInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SqlVulnerabilityAssessmentSettingsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SqlVulnerabilityAssessmentSettingsInner.java new file mode 100644 index 000000000000..bcb7f57cba60 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SqlVulnerabilityAssessmentSettingsInner.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentSettingsProperties; +import java.io.IOException; + +/** + * SQL Vulnerability Assessment settings resource. + */ +@Fluent +public final class SqlVulnerabilityAssessmentSettingsInner extends ProxyResource { + /* + * SQL Vulnerability Assessment settings properties. + */ + private SqlVulnerabilityAssessmentSettingsProperties properties; + + /* + * 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 SqlVulnerabilityAssessmentSettingsInner class. + */ + public SqlVulnerabilityAssessmentSettingsInner() { + } + + /** + * Get the properties property: SQL Vulnerability Assessment settings properties. + * + * @return the properties value. + */ + public SqlVulnerabilityAssessmentSettingsProperties properties() { + return this.properties; + } + + /** + * Set the properties property: SQL Vulnerability Assessment settings properties. + * + * @param properties the properties value to set. + * @return the SqlVulnerabilityAssessmentSettingsInner object itself. + */ + public SqlVulnerabilityAssessmentSettingsInner + withProperties(SqlVulnerabilityAssessmentSettingsProperties properties) { + this.properties = properties; + return this; + } + + /** + * 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; + } + + /** + * 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 SqlVulnerabilityAssessmentSettingsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlVulnerabilityAssessmentSettingsInner 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 SqlVulnerabilityAssessmentSettingsInner. + */ + public static SqlVulnerabilityAssessmentSettingsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlVulnerabilityAssessmentSettingsInner deserializedSqlVulnerabilityAssessmentSettingsInner + = new SqlVulnerabilityAssessmentSettingsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentSettingsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentSettingsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentSettingsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentSettingsInner.properties + = SqlVulnerabilityAssessmentSettingsProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlVulnerabilityAssessmentSettingsInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlVulnerabilityAssessmentSettingsInner; + }); + } +} 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 index a2c787b90b9b..01d35da9ba99 100644 --- 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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; @@ -28,6 +29,11 @@ public final class StandardAssignmentInner extends ProxyResource { */ private StandardAssignmentProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -58,6 +64,15 @@ private StandardAssignmentProperties 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. * @@ -342,6 +357,8 @@ public static StandardAssignmentInner fromJson(JsonReader jsonReader) throws IOE deserializedStandardAssignmentInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedStandardAssignmentInner.innerProperties = StandardAssignmentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedStandardAssignmentInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 index 3dd48b2911a8..82ef3156290a 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardInner.java new file mode 100644 index 000000000000..ac0184617f22 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardInner.java @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.StandardComponentProperties; +import com.azure.resourcemanager.security.models.StandardSupportedClouds; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Security Standard on a resource. + */ +@Fluent +public final class StandardInner extends ProxyResource { + /* + * Properties of a security standard + */ + private StandardProperties innerProperties; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * Kind of the resource + */ + private String kind; + + /* + * Entity tag is used for comparing two or more entities from the same requested resource. + */ + private String etag; + + /* + * 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 StandardInner class. + */ + public StandardInner() { + } + + /** + * Get the innerProperties property: Properties of a security standard. + * + * @return the innerProperties value. + */ + private StandardProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the StandardInner object itself. + */ + public StandardInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the StandardInner object itself. + */ + public StandardInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the kind property: Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of the resource. + * + * @param kind the kind value to set. + * @return the StandardInner object itself. + */ + public StandardInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @param etag the etag value to set. + * @return the StandardInner object itself. + */ + public StandardInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * 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 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 StandardInner object itself. + */ + public StandardInner 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 BuiltIn only currently). + * + * @return the standardType value. + */ + public String 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 StandardInner object itself. + */ + public StandardInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the category property: category of the standard provided. + * + * @return the category value. + */ + public String category() { + return this.innerProperties() == null ? null : this.innerProperties().category(); + } + + /** + * Set the category property: category of the standard provided. + * + * @param category the category value to set. + * @return the StandardInner object itself. + */ + public StandardInner withCategory(String category) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withCategory(category); + return this; + } + + /** + * Get the components property: List of component objects containing component unique keys (such as assessment keys) + * to apply to standard scope. Currently only supports assessment keys. + * + * @return the components value. + */ + public List components() { + return this.innerProperties() == null ? null : this.innerProperties().components(); + } + + /** + * Set the components property: List of component objects containing component unique keys (such as assessment keys) + * to apply to standard scope. Currently only supports assessment keys. + * + * @param components the components value to set. + * @return the StandardInner object itself. + */ + public StandardInner withComponents(List components) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withComponents(components); + return this; + } + + /** + * Get the supportedClouds property: List of all standard supported clouds. + * + * @return the supportedClouds value. + */ + public List supportedClouds() { + return this.innerProperties() == null ? null : this.innerProperties().supportedClouds(); + } + + /** + * Set the supportedClouds property: List of all standard supported clouds. + * + * @param supportedClouds the supportedClouds value to set. + * @return the StandardInner object itself. + */ + public StandardInner withSupportedClouds(List supportedClouds) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withSupportedClouds(supportedClouds); + 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); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StandardInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StandardInner 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 StandardInner. + */ + public static StandardInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StandardInner deserializedStandardInner = new StandardInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStandardInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStandardInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStandardInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedStandardInner.innerProperties = StandardProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedStandardInner.tags = tags; + } else if ("location".equals(fieldName)) { + deserializedStandardInner.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedStandardInner.kind = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedStandardInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedStandardInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStandardInner; + }); + } +} 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 index 88ca50e38a2f..091c9409676c 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -9,10 +9,8 @@ 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 com.azure.resourcemanager.security.models.StandardComponentProperties; +import com.azure.resourcemanager.security.models.StandardSupportedClouds; import java.io.IOException; import java.util.List; @@ -22,39 +20,35 @@ @Fluent public final class StandardProperties implements JsonSerializable { /* - * Display name of the standard, equivalent to the standardId + * display name of the standard, equivalent to the standardId */ private String displayName; /* - * Standard type (Custom or Default or Compliance only currently) + * standard type (Custom or BuiltIn only currently) */ - private StandardType standardType; + private String standardType; /* - * Description of the standard + * description of the standard */ private String description; /* - * List of assessment keys to apply to standard scope. + * category of the standard provided */ - private List assessments; + private String category; /* - * List of all standard supported clouds. + * List of component objects containing component unique keys (such as assessment keys) to apply to standard scope. + * Currently only supports assessment keys. */ - private List cloudProviders; + private List components; /* - * The policy set definition id associated with the standard. - */ - private String policySetDefinitionId; - - /* - * The security standard metadata. + * List of all standard supported clouds. */ - private StandardMetadata metadata; + private List supportedClouds; /** * Creates an instance of StandardProperties class. @@ -63,7 +57,7 @@ public StandardProperties() { } /** - * Get the displayName property: Display name of the standard, equivalent to the standardId. + * Get the displayName property: display name of the standard, equivalent to the standardId. * * @return the displayName value. */ @@ -72,7 +66,7 @@ public String displayName() { } /** - * Set the displayName property: Display name of the standard, equivalent to the standardId. + * 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. @@ -83,16 +77,16 @@ public StandardProperties withDisplayName(String displayName) { } /** - * Get the standardType property: Standard type (Custom or Default or Compliance only currently). + * Get the standardType property: standard type (Custom or BuiltIn only currently). * * @return the standardType value. */ - public StandardType standardType() { + public String standardType() { return this.standardType; } /** - * Get the description property: Description of the standard. + * Get the description property: description of the standard. * * @return the description value. */ @@ -101,7 +95,7 @@ public String description() { } /** - * Set the description property: Description of the standard. + * Set the description property: description of the standard. * * @param description the description value to set. * @return the StandardProperties object itself. @@ -112,82 +106,64 @@ public StandardProperties withDescription(String description) { } /** - * 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. + * Get the category property: category of the standard provided. * - * @return the cloudProviders value. + * @return the category value. */ - public List cloudProviders() { - return this.cloudProviders; + public String category() { + return this.category; } /** - * Set the cloudProviders property: List of all standard supported clouds. + * Set the category property: category of the standard provided. * - * @param cloudProviders the cloudProviders value to set. + * @param category the category value to set. * @return the StandardProperties object itself. */ - public StandardProperties withCloudProviders(List cloudProviders) { - this.cloudProviders = cloudProviders; + public StandardProperties withCategory(String category) { + this.category = category; return this; } /** - * Get the policySetDefinitionId property: The policy set definition id associated with the standard. + * Get the components property: List of component objects containing component unique keys (such as assessment keys) + * to apply to standard scope. Currently only supports assessment keys. * - * @return the policySetDefinitionId value. + * @return the components value. */ - public String policySetDefinitionId() { - return this.policySetDefinitionId; + public List components() { + return this.components; } /** - * Set the policySetDefinitionId property: The policy set definition id associated with the standard. + * Set the components property: List of component objects containing component unique keys (such as assessment keys) + * to apply to standard scope. Currently only supports assessment keys. * - * @param policySetDefinitionId the policySetDefinitionId value to set. + * @param components the components value to set. * @return the StandardProperties object itself. */ - public StandardProperties withPolicySetDefinitionId(String policySetDefinitionId) { - this.policySetDefinitionId = policySetDefinitionId; + public StandardProperties withComponents(List components) { + this.components = components; return this; } /** - * Get the metadata property: The security standard metadata. + * Get the supportedClouds property: List of all standard supported clouds. * - * @return the metadata value. + * @return the supportedClouds value. */ - public StandardMetadata metadata() { - return this.metadata; + public List supportedClouds() { + return this.supportedClouds; } /** - * Set the metadata property: The security standard metadata. + * Set the supportedClouds property: List of all standard supported clouds. * - * @param metadata the metadata value to set. + * @param supportedClouds the supportedClouds value to set. * @return the StandardProperties object itself. */ - public StandardProperties withMetadata(StandardMetadata metadata) { - this.metadata = metadata; + public StandardProperties withSupportedClouds(List supportedClouds) { + this.supportedClouds = supportedClouds; return this; } @@ -197,11 +173,8 @@ public StandardProperties withMetadata(StandardMetadata metadata) { * @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(); + if (components() != null) { + components().forEach(e -> e.validate()); } } @@ -213,11 +186,10 @@ 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, + jsonWriter.writeStringField("category", this.category); + jsonWriter.writeArrayField("components", this.components, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("supportedClouds", this.supportedClouds, (writer, element) -> writer.writeString(element == null ? null : element.toString())); - jsonWriter.writeStringField("policySetDefinitionId", this.policySetDefinitionId); - jsonWriter.writeJsonField("metadata", this.metadata); return jsonWriter.writeEndObject(); } @@ -239,21 +211,19 @@ public static StandardProperties fromJson(JsonReader jsonReader) throws IOExcept if ("displayName".equals(fieldName)) { deserializedStandardProperties.displayName = reader.getString(); } else if ("standardType".equals(fieldName)) { - deserializedStandardProperties.standardType = StandardType.fromString(reader.getString()); + deserializedStandardProperties.standardType = 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 if ("category".equals(fieldName)) { + deserializedStandardProperties.category = reader.getString(); + } else if ("components".equals(fieldName)) { + List components + = reader.readArray(reader1 -> StandardComponentProperties.fromJson(reader1)); + deserializedStandardProperties.components = components; + } else if ("supportedClouds".equals(fieldName)) { + List supportedClouds + = reader.readArray(reader1 -> StandardSupportedClouds.fromString(reader1.getString())); + deserializedStandardProperties.supportedClouds = supportedClouds; } else { reader.skipChildren(); } 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 6fde5a719571..05affc466215 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 @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; 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; @@ -15,7 +16,7 @@ import java.util.List; /** - * The TopologyResource model. + * Concrete proxy resource types can be created by aliasing this type using a specific property type. */ @Immutable public final class TopologyResourceInner extends ProxyResource { @@ -29,6 +30,11 @@ public final class TopologyResourceInner extends ProxyResource { */ private String location; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -47,7 +53,7 @@ public final class TopologyResourceInner extends ProxyResource { /** * Creates an instance of TopologyResourceInner class. */ - public TopologyResourceInner() { + private TopologyResourceInner() { } /** @@ -68,6 +74,15 @@ public String location() { return this.location; } + /** + * 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. * @@ -158,10 +173,12 @@ public static TopologyResourceInner fromJson(JsonReader jsonReader) throws IOExc 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 if ("properties".equals(fieldName)) { + deserializedTopologyResourceInner.innerProperties = TopologyResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTopologyResourceInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } 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 00ca75b2a412..28f04afa816e 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.fluent.models; @@ -33,7 +33,7 @@ public final class TopologyResourceProperties implements JsonSerializable { + 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 if ("systemData".equals(fieldName)) { + deserializedWorkspaceSettingInner.systemData = SystemData.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 new file mode 100644 index 000000000000..019ee47c21ad --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingProperties.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +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.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Workspace setting data. + */ +@Fluent +public final class WorkspaceSettingProperties implements JsonSerializable { + /* + * The full Azure ID of the workspace to save the data in + */ + 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 + */ + private String scope; + + /** + * Creates an instance of WorkspaceSettingProperties class. + */ + public WorkspaceSettingProperties() { + } + + /** + * Get the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @param workspaceId the workspaceId value to set. + * @return the WorkspaceSettingProperties object itself. + */ + public WorkspaceSettingProperties withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the scope property: All the VMs in this scope will send their security data to the mentioned workspace unless + * overridden by a setting with more specific scope. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: All the VMs in this scope will send their security data to the mentioned workspace unless + * overridden by a setting with more specific scope. + * + * @param scope the scope value to set. + * @return the WorkspaceSettingProperties object itself. + */ + public WorkspaceSettingProperties withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (workspaceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property workspaceId in model WorkspaceSettingProperties")); + } + if (scope() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property scope in model WorkspaceSettingProperties")); + } + } + + 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/fluent/models/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/package-info.java index f1e5e652b0f2..379d6e5c5131 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/package-info.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the inner data models for SecurityCenter. - * API spec for Microsoft.Security (Azure Security Center) resource provider. + * Package containing the inner data models for Security. + * API spec for Microsoft.Security (Azure Security Center) alerts resource provider. */ package com.azure.resourcemanager.security.fluent.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/package-info.java index 3de5e2298809..af2d11d9d794 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/package-info.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the service clients for SecurityCenter. - * API spec for Microsoft.Security (Azure Security Center) resource provider. + * Package containing the service clients for Security. + * API spec for Microsoft.Security (Azure Security Center) alerts resource provider. */ package com.azure.resourcemanager.security.fluent; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionSettingImpl.java index 55dc50b0564b..c0324b2e3aed 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionSettingImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionSettingImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.AdvancedThreatProtectionSettingInner; import com.azure.resourcemanager.security.models.AdvancedThreatProtectionSetting; @@ -32,6 +33,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Boolean isEnabled() { return this.innerModel().isEnabled(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java index d9251b4a7474..575eda4d115c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -56,34 +56,34 @@ public final class AdvancedThreatProtectionsClientImpl implements AdvancedThreat * The interface defining all the services for SecurityCenterAdvancedThreatProtections to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterAdvanc") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAdvancedThreatProtections") public interface AdvancedThreatProtectionsService { @Headers({ "Content-Type: application/json" }) @Get("/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("settingName") String settingName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Put("/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> create(@HostParam("$host") String endpoint, + Mono> create(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, - @PathParam("settingName") String settingName, + @PathParam("settingName") String settingName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, - @HeaderParam("Accept") String accept, Context context); + Context context); } /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -111,7 +111,7 @@ private Mono> getWithResponseAsyn /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -139,7 +139,7 @@ private Mono> getWithResponseAsyn /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -154,7 +154,7 @@ private Mono getAsync(String resourceId) { /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -169,7 +169,7 @@ public Response getWithResponse(String res /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -183,7 +183,7 @@ public AdvancedThreatProtectionSettingInner get(String resourceId) { /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -209,17 +209,18 @@ private Mono> createWithResponseA } final String apiVersion = "2019-01-01"; final String settingName = "current"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, - advancedThreatProtectionSetting, accept, context)) + contentType, accept, advancedThreatProtectionSetting, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -246,16 +247,17 @@ private Mono> createWithResponseA } final String apiVersion = "2019-01-01"; final String settingName = "current"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, - advancedThreatProtectionSetting, accept, context); + return service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, contentType, accept, + advancedThreatProtectionSetting, context); } /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -272,7 +274,7 @@ private Mono createAsync(String resourceId /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -289,7 +291,7 @@ public Response createWithResponse(String /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param advancedThreatProtectionSetting Advanced Threat Protection Settings. * @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/AdvancedThreatProtectionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java index f16d95c1fbe2..e8d80d26daca 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -29,12 +29,8 @@ public AdvancedThreatProtectionsImpl(AdvancedThreatProtectionsClient innerClient public Response getWithResponse(String resourceId, Context context) { Response inner = this.serviceClient().getWithResponse(resourceId, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new AdvancedThreatProtectionSettingImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AdvancedThreatProtectionSettingImpl(inner.getValue(), this.manager())); } public AdvancedThreatProtectionSetting get(String resourceId) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertImpl.java index 45bd26cca507..2096aa0294ed 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.AlertInner; import com.azure.resourcemanager.security.models.Alert; import com.azure.resourcemanager.security.models.AlertEntity; @@ -39,6 +40,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String version() { return this.innerModel().version(); } 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 e0df17af14ba..f10b89b0bd9c 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -32,7 +32,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.security.fluent.AlertsClient; import com.azure.resourcemanager.security.fluent.models.AlertInner; -import com.azure.resourcemanager.security.models.AlertList; +import com.azure.resourcemanager.security.implementation.models.AlertList; import com.azure.resourcemanager.security.models.AlertSimulatorRequestBody; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; @@ -66,184 +66,184 @@ public final class AlertsClientImpl implements AlertsClient { * The interface defining all the services for SecurityCenterAlerts to be used by the proxy service to perform REST * calls. */ - @Host("{$host}") + @Host("{endpoint}") @ServiceInterface(name = "SecurityCenterAlerts") public interface AlertsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> getSubscriptionLevel(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listSubscriptionLevelByRegion(@HostParam("$host") String endpoint, + Mono> listSubscriptionLevelByRegion(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listResourceGroupLevelByRegion(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("ascLocation") String ascLocation, @PathParam("resourceGroupName") String resourceGroupName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}") - @ExpectedResponses({ 200 }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss") + @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getSubscriptionLevel(@HostParam("$host") String endpoint, + Mono> updateSubscriptionLevelStateToDismiss(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, - @HeaderParam("Accept") String accept, Context context); + @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}") - @ExpectedResponses({ 200 }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve") + @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getResourceGroupLevel(@HostParam("$host") String endpoint, + Mono> updateSubscriptionLevelStateToResolve(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); + @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, Context context); - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss") + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateSubscriptionLevelStateToDismiss(@HostParam("$host") String endpoint, + Mono> updateSubscriptionLevelStateToActivate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, - @HeaderParam("Accept") String accept, Context context); + @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, Context context); - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve") + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateSubscriptionLevelStateToResolve(@HostParam("$host") String endpoint, + Mono> updateSubscriptionLevelStateToInProgress(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, - @HeaderParam("Accept") String accept, Context context); + @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate") - @ExpectedResponses({ 204 }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateSubscriptionLevelStateToActivate(@HostParam("$host") String endpoint, + Mono> getResourceGroupLevel(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, - @HeaderParam("Accept") String accept, Context context); + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress") - @ExpectedResponses({ 204 }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateSubscriptionLevelStateToInProgress(@HostParam("$host") String endpoint, + Mono> listResourceGroupLevelByRegion(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateResourceGroupLevelStateToResolve(@HostParam("$host") String endpoint, + Mono> updateResourceGroupLevelStateToResolve(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); + @PathParam("alertName") String alertName, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateResourceGroupLevelStateToDismiss(@HostParam("$host") String endpoint, + Mono> updateResourceGroupLevelStateToDismiss(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); + @PathParam("alertName") String alertName, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateResourceGroupLevelStateToActivate(@HostParam("$host") String endpoint, + Mono> updateResourceGroupLevelStateToActivate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); + @PathParam("alertName") String alertName, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateResourceGroupLevelStateToInProgress(@HostParam("$host") String endpoint, + Mono> updateResourceGroupLevelStateToInProgress(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); + @PathParam("alertName") String alertName, Context context); @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Accept: application/json;q=0.9" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> simulate(@HostParam("$host") String endpoint, + Mono>> simulate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("ascLocation") String ascLocation, - @BodyParam("application/json") AlertSimulatorRequestBody alertSimulatorRequestBody, - @HeaderParam("Accept") String accept, Context context); + @PathParam("ascLocation") String ascLocation, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") AlertSimulatorRequestBody alertSimulatorRequestBody, 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); + Mono> listSubscriptionLevelByRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listResourceGroupLevelByRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listSubscriptionLevelByRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listResourceGroupLevelByRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * List all the alerts that are associated with the subscription. + * Get an alert that is associated with a subscription. * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an alert that is associated with a subscription along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getSubscriptionLevelWithResponseAsync(String ascLocation, String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -252,27 +252,36 @@ private Mono> listSinglePageAsync() { 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 (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } final String apiVersion = "2022-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.getSubscriptionLevel(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List all the alerts that are associated with the subscription. + * Get an alert that is associated with a subscription. * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. * @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 security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an alert that is associated with a subscription along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getSubscriptionLevelWithResponseAsync(String ascLocation, String alertName, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -281,79 +290,82 @@ private Mono> listSinglePageAsync(Context context) { 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 (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } final String apiVersion = "2022-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.getSubscriptionLevel(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + ascLocation, alertName, accept, context); } /** - * List all the alerts that are associated with the subscription. + * Get an alert that is associated with a subscription. * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedFlux}. + * @return an alert that is associated with a subscription on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSubscriptionLevelAsync(String ascLocation, String alertName) { + return getSubscriptionLevelWithResponseAsync(ascLocation, alertName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * List all the alerts that are associated with the subscription. + * Get an alert that is associated with a subscription. * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. * @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 security alerts as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * List all the alerts that are associated with 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 list of security alerts as paginated response with {@link PagedIterable}. + * @return an alert that is associated with a subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, + Context context) { + return getSubscriptionLevelWithResponseAsync(ascLocation, alertName, context).block(); } /** - * List all the alerts that are associated with the subscription. + * Get an alert that is associated with a subscription. * - * @param context The context to associate with this operation. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedIterable}. + * @return an alert that is associated with a subscription. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertInner getSubscriptionLevel(String ascLocation, String alertName) { + return getSubscriptionLevelWithResponse(ascLocation, alertName, Context.NONE).getValue(); } /** - * List all the alerts that are associated with the resource group. + * List all the alerts that are associated with the subscription that are stored in a specific location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + private Mono> listSubscriptionLevelByRegionSinglePageAsync(String ascLocation) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -362,25 +374,24 @@ private Mono> listByResourceGroupSinglePageAsync(Strin 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } final String apiVersion = "2022-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .withContext(context -> service.listSubscriptionLevelByRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, 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())); } /** - * List all the alerts that are associated with the resource group. + * List all the alerts that are associated with the subscription that are stored in a specific location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. * @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. @@ -388,7 +399,7 @@ private Mono> listByResourceGroupSinglePageAsync(Strin * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + private Mono> listSubscriptionLevelByRegionSinglePageAsync(String ascLocation, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -398,41 +409,40 @@ private Mono> listByResourceGroupSinglePageAsync(Strin 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } final String apiVersion = "2022-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, accept, context) + .listSubscriptionLevelByRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + ascLocation, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** - * List all the alerts that are associated with the resource group. + * List all the alerts that are associated with the subscription that are stored in a specific location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation), + nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink)); } /** - * List all the alerts that are associated with the resource group. + * List all the alerts that are associated with the subscription that are stored in a specific location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. * @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. @@ -440,31 +450,31 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupName) * @return list of security alerts as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>(() -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation, context), + nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink, context)); } /** - * List all the alerts that are associated with the resource group. + * List all the alerts that are associated with the subscription that are stored in a specific location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + public PagedIterable listSubscriptionLevelByRegion(String ascLocation) { + return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation)); } /** - * List all the alerts that are associated with the resource group. + * List all the alerts that are associated with the subscription that are stored in a specific location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. * @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. @@ -472,22 +482,24 @@ public PagedIterable listByResourceGroup(String resourceGroupName) { * @return list of security alerts as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + public PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context) { + return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation, context)); } /** - * List all the alerts that are associated with the subscription that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSubscriptionLevelByRegionSinglePageAsync(String ascLocation) { + private Mono> updateSubscriptionLevelStateToDismissWithResponseAsync(String ascLocation, + String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -499,30 +511,31 @@ private Mono> listSubscriptionLevelByRegionSinglePageA if (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listSubscriptionLevelByRegion(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.updateSubscriptionLevelStateToDismiss(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List all the alerts that are associated with the subscription that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param alertName Name of the alert object. * @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 security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSubscriptionLevelByRegionSinglePageAsync(String ascLocation, - Context context) { + private Mono> updateSubscriptionLevelStateToDismissWithResponseAsync(String ascLocation, + String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -534,95 +547,79 @@ private Mono> listSubscriptionLevelByRegionSinglePageA if (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listSubscriptionLevelByRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - ascLocation, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.updateSubscriptionLevelStateToDismiss(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, context); } /** - * List all the alerts that are associated with the subscription that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedFlux}. + * @return A {@link Mono} that completes when a successful response is received. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation), - nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSubscriptionLevelStateToDismissAsync(String ascLocation, String alertName) { + return updateSubscriptionLevelStateToDismissWithResponseAsync(ascLocation, alertName) + .flatMap(ignored -> Mono.empty()); } /** - * List all the alerts that are associated with the subscription that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param alertName Name of the alert object. * @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 security alerts as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation, Context context) { - return new PagedFlux<>(() -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation, context), - nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink, context)); - } - - /** - * List all the alerts that are associated with the subscription that are stored in a specific location. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 security alerts as paginated response with {@link PagedIterable}. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listSubscriptionLevelByRegion(String ascLocation) { - return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, + Context context) { + return updateSubscriptionLevelStateToDismissWithResponseAsync(ascLocation, alertName, context).block(); } /** - * List all the alerts that are associated with the subscription that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param context The context to associate with this operation. + * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context) { - return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName) { + updateSubscriptionLevelStateToDismissWithResponse(ascLocation, alertName, Context.NONE); } /** - * List all the alerts that are associated with the resource group that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listResourceGroupLevelByRegionSinglePageAsync(String ascLocation, - String resourceGroupName) { + private Mono> updateSubscriptionLevelStateToResolveWithResponseAsync(String ascLocation, + String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -634,36 +631,31 @@ private Mono> listResourceGroupLevelByRegionSinglePage if (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listResourceGroupLevelByRegion(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, resourceGroupName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.updateSubscriptionLevelStateToResolve(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List all the alerts that are associated with the resource group that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param alertName Name of the alert object. * @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 security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listResourceGroupLevelByRegionSinglePageAsync(String ascLocation, - String resourceGroupName, Context context) { + private Mono> updateSubscriptionLevelStateToResolveWithResponseAsync(String ascLocation, + String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -675,97 +667,67 @@ private Mono> listResourceGroupLevelByRegionSinglePage if (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + if (alertName == null) { + return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listResourceGroupLevelByRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - ascLocation, resourceGroupName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.updateSubscriptionLevelStateToResolve(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, context); } /** - * List all the alerts that are associated with the resource group that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedFlux}. + * @return A {@link Mono} that completes when a successful response is received. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listResourceGroupLevelByRegionAsync(String ascLocation, String resourceGroupName) { - return new PagedFlux<>(() -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName), - nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSubscriptionLevelStateToResolveAsync(String ascLocation, String alertName) { + return updateSubscriptionLevelStateToResolveWithResponseAsync(ascLocation, alertName) + .flatMap(ignored -> Mono.empty()); } /** - * List all the alerts that are associated with the resource group that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param alertName Name of the alert object. * @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 security alerts as paginated response with {@link PagedFlux}. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listResourceGroupLevelByRegionAsync(String ascLocation, String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocation, String alertName, Context context) { - return new PagedFlux<>( - () -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName, context), - nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink, context)); - } - - /** - * List all the alerts that are associated with the resource group that are stored in a specific location. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 security alerts as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName) { - return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName)); + return updateSubscriptionLevelStateToResolveWithResponseAsync(ascLocation, alertName, context).block(); } /** - * List all the alerts that are associated with the resource group that are stored in a specific location. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param context The context to associate with this operation. + * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, - Context context) { - return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName) { + updateSubscriptionLevelStateToResolveWithResponse(ascLocation, alertName, Context.NONE); } /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -773,11 +735,11 @@ public PagedIterable listResourceGroupLevelByRegion(String ascLocati * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated with a subscription along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getSubscriptionLevelWithResponseAsync(String ascLocation, String alertName) { + private Mono> updateSubscriptionLevelStateToActivateWithResponseAsync(String ascLocation, + String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -793,15 +755,14 @@ private Mono> getSubscriptionLevelWithResponseAsync(String return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getSubscriptionLevel(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) + .withContext(context -> service.updateSubscriptionLevelStateToActivate(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -810,12 +771,11 @@ private Mono> getSubscriptionLevelWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated with a subscription along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getSubscriptionLevelWithResponseAsync(String ascLocation, String alertName, - Context context) { + private Mono> updateSubscriptionLevelStateToActivateWithResponseAsync(String ascLocation, + String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -831,14 +791,13 @@ private Mono> getSubscriptionLevelWithResponseAsync(String return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.getSubscriptionLevel(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - ascLocation, alertName, accept, context); + return service.updateSubscriptionLevelStateToActivate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, context); } /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -846,16 +805,16 @@ private Mono> getSubscriptionLevelWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated with a subscription on successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getSubscriptionLevelAsync(String ascLocation, String alertName) { - return getSubscriptionLevelWithResponseAsync(ascLocation, alertName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono updateSubscriptionLevelStateToActivateAsync(String ascLocation, String alertName) { + return updateSubscriptionLevelStateToActivateWithResponseAsync(ascLocation, alertName) + .flatMap(ignored -> Mono.empty()); } /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -864,16 +823,16 @@ private Mono getSubscriptionLevelAsync(String ascLocation, String al * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated with a subscription along with {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, + public Response updateSubscriptionLevelStateToActivateWithResponse(String ascLocation, String alertName, Context context) { - return getSubscriptionLevelWithResponseAsync(ascLocation, alertName, context).block(); + return updateSubscriptionLevelStateToActivateWithResponseAsync(ascLocation, alertName, context).block(); } /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -881,30 +840,26 @@ public Response getSubscriptionLevelWithResponse(String ascLocation, * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated with a subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public AlertInner getSubscriptionLevel(String ascLocation, String alertName) { - return getSubscriptionLevelWithResponse(ascLocation, alertName, Context.NONE).getValue(); + public void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName) { + updateSubscriptionLevelStateToActivateWithResponse(ascLocation, alertName, Context.NONE); } /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated a resource group or a resource in a resource group along with - * {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getResourceGroupLevelWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName) { + private Mono> updateSubscriptionLevelStateToInProgressWithResponseAsync(String ascLocation, + String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -913,10 +868,6 @@ private Mono> getResourceGroupLevelWithResponseAsync(String 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -924,18 +875,15 @@ private Mono> getResourceGroupLevelWithResponseAsync(String return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getResourceGroupLevel(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context)) + .withContext(context -> service.updateSubscriptionLevelStateToInProgress(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -943,12 +891,11 @@ private Mono> getResourceGroupLevelWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated a resource group or a resource in a resource group along with - * {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getResourceGroupLevelWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName, Context context) { + private Mono> updateSubscriptionLevelStateToInProgressWithResponseAsync(String ascLocation, + String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -957,10 +904,6 @@ private Mono> getResourceGroupLevelWithResponseAsync(String 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -968,38 +911,31 @@ private Mono> getResourceGroupLevelWithResponseAsync(String return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.getResourceGroupLevel(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, ascLocation, alertName, accept, context); + return service.updateSubscriptionLevelStateToInProgress(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, context); } /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated a resource group or a resource in a resource group on successful completion - * of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getResourceGroupLevelAsync(String resourceGroupName, String ascLocation, - String alertName) { - return getResourceGroupLevelWithResponseAsync(resourceGroupName, ascLocation, alertName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono updateSubscriptionLevelStateToInProgressAsync(String ascLocation, String alertName) { + return updateSubscriptionLevelStateToInProgressWithResponseAsync(ascLocation, alertName) + .flatMap(ignored -> Mono.empty()); } /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1007,47 +943,45 @@ private Mono getResourceGroupLevelAsync(String resourceGroupName, St * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated a resource group or a resource in a resource group along with - * {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, - String alertName, Context context) { - return getResourceGroupLevelWithResponseAsync(resourceGroupName, ascLocation, alertName, context).block(); + public Response updateSubscriptionLevelStateToInProgressWithResponse(String ascLocation, String alertName, + Context context) { + return updateSubscriptionLevelStateToInProgressWithResponseAsync(ascLocation, alertName, context).block(); } /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated a resource group or a resource in a resource group. */ @ServiceMethod(returns = ReturnType.SINGLE) - public AlertInner getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName) { - return getResourceGroupLevelWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE).getValue(); + public void updateSubscriptionLevelStateToInProgress(String ascLocation, String alertName) { + updateSubscriptionLevelStateToInProgressWithResponse(ascLocation, alertName, Context.NONE); } /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return an alert that is associated a resource group or a resource in a resource group along with + * {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToDismissWithResponseAsync(String ascLocation, - String alertName) { + private Mono> getResourceGroupLevelWithResponseAsync(String resourceGroupName, + String ascLocation, String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1056,6 +990,10 @@ private Mono> updateSubscriptionLevelStateToDismissWithResponseAs 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -1065,14 +1003,15 @@ private Mono> updateSubscriptionLevelStateToDismissWithResponseAs final String apiVersion = "2022-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.updateSubscriptionLevelStateToDismiss(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) + .withContext(context -> service.getResourceGroupLevel(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1080,11 +1019,12 @@ private Mono> updateSubscriptionLevelStateToDismissWithResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return an alert that is associated a resource group or a resource in a resource group along with + * {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToDismissWithResponseAsync(String ascLocation, - String alertName, Context context) { + private Mono> getResourceGroupLevelWithResponseAsync(String resourceGroupName, + String ascLocation, String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1093,6 +1033,10 @@ private Mono> updateSubscriptionLevelStateToDismissWithResponseAs 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -1102,30 +1046,34 @@ private Mono> updateSubscriptionLevelStateToDismissWithResponseAs final String apiVersion = "2022-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateSubscriptionLevelStateToDismiss(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context); + return service.getResourceGroupLevel(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, alertName, accept, context); } /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return an alert that is associated a resource group or a resource in a resource group on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateSubscriptionLevelStateToDismissAsync(String ascLocation, String alertName) { - return updateSubscriptionLevelStateToDismissWithResponseAsync(ascLocation, alertName) - .flatMap(ignored -> Mono.empty()); + private Mono getResourceGroupLevelAsync(String resourceGroupName, String ascLocation, + String alertName) { + return getResourceGroupLevelWithResponseAsync(resourceGroupName, ascLocation, alertName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1133,154 +1081,170 @@ private Mono updateSubscriptionLevelStateToDismissAsync(String ascLocation * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return an alert that is associated a resource group or a resource in a resource group along with + * {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, - Context context) { - return updateSubscriptionLevelStateToDismissWithResponseAsync(ascLocation, alertName, context).block(); + public Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, + String alertName, Context context) { + return getResourceGroupLevelWithResponseAsync(resourceGroupName, ascLocation, alertName, context).block(); } /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 alert that is associated a resource group or a resource in a resource group. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName) { - updateSubscriptionLevelStateToDismissWithResponse(ascLocation, alertName, Context.NONE); + public AlertInner getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName) { + return getResourceGroupLevelWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE).getValue(); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToResolveWithResponseAsync(String ascLocation, - String alertName) { - 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.")); - } + private Mono> listResourceGroupLevelByRegionSinglePageAsync(String ascLocation, + String resourceGroupName) { if (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } - if (alertName == null) { - return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.updateSubscriptionLevelStateToResolve(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) + .withContext(context -> service.listResourceGroupLevelByRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, 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())); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToResolveWithResponseAsync(String ascLocation, - String alertName, 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.")); - } + private Mono> listResourceGroupLevelByRegionSinglePageAsync(String ascLocation, + String resourceGroupName, Context context) { if (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } - if (alertName == null) { - return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateSubscriptionLevelStateToResolve(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context); + return service + .listResourceGroupLevelByRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateSubscriptionLevelStateToResolveAsync(String ascLocation, String alertName) { - return updateSubscriptionLevelStateToResolveWithResponseAsync(ascLocation, alertName) - .flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listResourceGroupLevelByRegionAsync(String ascLocation, String resourceGroupName) { + return new PagedFlux<>(() -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName), + nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink)); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocation, String alertName, + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listResourceGroupLevelByRegionAsync(String ascLocation, String resourceGroupName, Context context) { - return updateSubscriptionLevelStateToResolveWithResponseAsync(ascLocation, alertName, context).block(); + return new PagedFlux<>( + () -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName, context), + nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink, context)); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName) { - updateSubscriptionLevelStateToResolveWithResponse(ascLocation, alertName, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName) { + return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName)); + } + + /** + * List all the alerts that are associated with the resource group that are stored in a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, + Context context) { + return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName, context)); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1290,8 +1254,8 @@ public void updateSubscriptionLevelStateToResolve(String ascLocation, String ale * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToActivateWithResponseAsync(String ascLocation, - String alertName) { + private Mono> updateResourceGroupLevelStateToResolveWithResponseAsync(String resourceGroupName, + String ascLocation, String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1300,6 +1264,10 @@ private Mono> updateSubscriptionLevelStateToActivateWithResponseA 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -1307,16 +1275,16 @@ private Mono> updateSubscriptionLevelStateToActivateWithResponseA return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.updateSubscriptionLevelStateToActivate(this.client.getEndpoint(), - apiVersion, this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) + .withContext(context -> service.updateResourceGroupLevelStateToResolve(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1327,8 +1295,8 @@ private Mono> updateSubscriptionLevelStateToActivateWithResponseA * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToActivateWithResponseAsync(String ascLocation, - String alertName, Context context) { + private Mono> updateResourceGroupLevelStateToResolveWithResponseAsync(String resourceGroupName, + String ascLocation, String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1337,6 +1305,10 @@ private Mono> updateSubscriptionLevelStateToActivateWithResponseA 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -1344,15 +1316,15 @@ private Mono> updateSubscriptionLevelStateToActivateWithResponseA return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateSubscriptionLevelStateToActivate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context); + return service.updateResourceGroupLevelStateToResolve(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1362,14 +1334,16 @@ private Mono> updateSubscriptionLevelStateToActivateWithResponseA * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateSubscriptionLevelStateToActivateAsync(String ascLocation, String alertName) { - return updateSubscriptionLevelStateToActivateWithResponseAsync(ascLocation, alertName) + private Mono updateResourceGroupLevelStateToResolveAsync(String resourceGroupName, String ascLocation, + String alertName) { + return updateResourceGroupLevelStateToResolveWithResponseAsync(resourceGroupName, ascLocation, alertName) .flatMap(ignored -> Mono.empty()); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1380,14 +1354,16 @@ private Mono updateSubscriptionLevelStateToActivateAsync(String ascLocatio * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateSubscriptionLevelStateToActivateWithResponse(String ascLocation, String alertName, - Context context) { - return updateSubscriptionLevelStateToActivateWithResponseAsync(ascLocation, alertName, context).block(); + public Response updateResourceGroupLevelStateToResolveWithResponse(String resourceGroupName, + String ascLocation, String alertName, Context context) { + return updateResourceGroupLevelStateToResolveWithResponseAsync(resourceGroupName, ascLocation, alertName, + context).block(); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1396,13 +1372,14 @@ public Response updateSubscriptionLevelStateToActivateWithResponse(String * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName) { - updateSubscriptionLevelStateToActivateWithResponse(ascLocation, alertName, Context.NONE); + public void updateResourceGroupLevelStateToResolve(String resourceGroupName, String ascLocation, String alertName) { + updateResourceGroupLevelStateToResolveWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1412,8 +1389,8 @@ public void updateSubscriptionLevelStateToActivate(String ascLocation, String al * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToInProgressWithResponseAsync(String ascLocation, - String alertName) { + private Mono> updateResourceGroupLevelStateToDismissWithResponseAsync(String resourceGroupName, + String ascLocation, String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1422,6 +1399,10 @@ private Mono> updateSubscriptionLevelStateToInProgressWithRespons 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -1429,16 +1410,16 @@ private Mono> updateSubscriptionLevelStateToInProgressWithRespons return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.updateSubscriptionLevelStateToInProgress(this.client.getEndpoint(), - apiVersion, this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) + .withContext(context -> service.updateResourceGroupLevelStateToDismiss(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1449,8 +1430,8 @@ private Mono> updateSubscriptionLevelStateToInProgressWithRespons * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateSubscriptionLevelStateToInProgressWithResponseAsync(String ascLocation, - String alertName, Context context) { + private Mono> updateResourceGroupLevelStateToDismissWithResponseAsync(String resourceGroupName, + String ascLocation, String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1459,6 +1440,10 @@ private Mono> updateSubscriptionLevelStateToInProgressWithRespons 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } @@ -1466,15 +1451,15 @@ private Mono> updateSubscriptionLevelStateToInProgressWithRespons return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateSubscriptionLevelStateToInProgress(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context); + return service.updateResourceGroupLevelStateToDismiss(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1484,14 +1469,16 @@ private Mono> updateSubscriptionLevelStateToInProgressWithRespons * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateSubscriptionLevelStateToInProgressAsync(String ascLocation, String alertName) { - return updateSubscriptionLevelStateToInProgressWithResponseAsync(ascLocation, alertName) + private Mono updateResourceGroupLevelStateToDismissAsync(String resourceGroupName, String ascLocation, + String alertName) { + return updateResourceGroupLevelStateToDismissWithResponseAsync(resourceGroupName, ascLocation, alertName) .flatMap(ignored -> Mono.empty()); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1502,14 +1489,16 @@ private Mono updateSubscriptionLevelStateToInProgressAsync(String ascLocat * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateSubscriptionLevelStateToInProgressWithResponse(String ascLocation, String alertName, - Context context) { - return updateSubscriptionLevelStateToInProgressWithResponseAsync(ascLocation, alertName, context).block(); + public Response updateResourceGroupLevelStateToDismissWithResponse(String resourceGroupName, + String ascLocation, String alertName, Context context) { + return updateResourceGroupLevelStateToDismissWithResponseAsync(resourceGroupName, ascLocation, alertName, + context).block(); } /** * Update the alert's state. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1518,15 +1507,14 @@ public Response updateSubscriptionLevelStateToInProgressWithResponse(Strin * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void updateSubscriptionLevelStateToInProgress(String ascLocation, String alertName) { - updateSubscriptionLevelStateToInProgressWithResponse(ascLocation, alertName, Context.NONE); + public void updateResourceGroupLevelStateToDismiss(String resourceGroupName, String ascLocation, String alertName) { + updateResourceGroupLevelStateToDismissWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1536,7 +1524,7 @@ public void updateSubscriptionLevelStateToInProgress(String ascLocation, String * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToResolveWithResponseAsync(String resourceGroupName, + private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync(String resourceGroupName, String ascLocation, String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -1557,19 +1545,16 @@ private Mono> updateResourceGroupLevelStateToResolveWithResponseA return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.updateResourceGroupLevelStateToResolve(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context)) + .withContext(context -> service.updateResourceGroupLevelStateToActivate(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1580,7 +1565,7 @@ private Mono> updateResourceGroupLevelStateToResolveWithResponseA * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToResolveWithResponseAsync(String resourceGroupName, + private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync(String resourceGroupName, String ascLocation, String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -1601,17 +1586,15 @@ private Mono> updateResourceGroupLevelStateToResolveWithResponseA return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateResourceGroupLevelStateToResolve(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); + return service.updateResourceGroupLevelStateToActivate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1621,17 +1604,16 @@ private Mono> updateResourceGroupLevelStateToResolveWithResponseA * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateResourceGroupLevelStateToResolveAsync(String resourceGroupName, String ascLocation, + private Mono updateResourceGroupLevelStateToActivateAsync(String resourceGroupName, String ascLocation, String alertName) { - return updateResourceGroupLevelStateToResolveWithResponseAsync(resourceGroupName, ascLocation, alertName) + return updateResourceGroupLevelStateToActivateWithResponseAsync(resourceGroupName, ascLocation, alertName) .flatMap(ignored -> Mono.empty()); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1642,17 +1624,16 @@ private Mono updateResourceGroupLevelStateToResolveAsync(String resourceGr * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateResourceGroupLevelStateToResolveWithResponse(String resourceGroupName, + public Response updateResourceGroupLevelStateToActivateWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context) { - return updateResourceGroupLevelStateToResolveWithResponseAsync(resourceGroupName, ascLocation, alertName, + return updateResourceGroupLevelStateToActivateWithResponseAsync(resourceGroupName, ascLocation, alertName, context).block(); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1661,15 +1642,15 @@ public Response updateResourceGroupLevelStateToResolveWithResponse(String * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void updateResourceGroupLevelStateToResolve(String resourceGroupName, String ascLocation, String alertName) { - updateResourceGroupLevelStateToResolveWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); + public void updateResourceGroupLevelStateToActivate(String resourceGroupName, String ascLocation, + String alertName) { + updateResourceGroupLevelStateToActivateWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1679,7 +1660,7 @@ public void updateResourceGroupLevelStateToResolve(String resourceGroupName, Str * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToDismissWithResponseAsync(String resourceGroupName, + private Mono> updateResourceGroupLevelStateToInProgressWithResponseAsync(String resourceGroupName, String ascLocation, String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -1700,19 +1681,16 @@ private Mono> updateResourceGroupLevelStateToDismissWithResponseA return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.updateResourceGroupLevelStateToDismiss(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context)) + .withContext(context -> service.updateResourceGroupLevelStateToInProgress(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1723,7 +1701,7 @@ private Mono> updateResourceGroupLevelStateToDismissWithResponseA * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToDismissWithResponseAsync(String resourceGroupName, + private Mono> updateResourceGroupLevelStateToInProgressWithResponseAsync(String resourceGroupName, String ascLocation, String alertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -1744,17 +1722,15 @@ private Mono> updateResourceGroupLevelStateToDismissWithResponseA return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateResourceGroupLevelStateToDismiss(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); + return service.updateResourceGroupLevelStateToInProgress(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, context); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1764,17 +1740,16 @@ private Mono> updateResourceGroupLevelStateToDismissWithResponseA * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateResourceGroupLevelStateToDismissAsync(String resourceGroupName, String ascLocation, + private Mono updateResourceGroupLevelStateToInProgressAsync(String resourceGroupName, String ascLocation, String alertName) { - return updateResourceGroupLevelStateToDismissWithResponseAsync(resourceGroupName, ascLocation, alertName) + return updateResourceGroupLevelStateToInProgressWithResponseAsync(resourceGroupName, ascLocation, alertName) .flatMap(ignored -> Mono.empty()); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1785,17 +1760,16 @@ private Mono updateResourceGroupLevelStateToDismissAsync(String resourceGr * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateResourceGroupLevelStateToDismissWithResponse(String resourceGroupName, + public Response updateResourceGroupLevelStateToInProgressWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context) { - return updateResourceGroupLevelStateToDismissWithResponseAsync(resourceGroupName, ascLocation, alertName, + return updateResourceGroupLevelStateToInProgressWithResponseAsync(resourceGroupName, ascLocation, alertName, context).block(); } /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -1804,26 +1778,20 @@ public Response updateResourceGroupLevelStateToDismissWithResponse(String * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void updateResourceGroupLevelStateToDismiss(String resourceGroupName, String ascLocation, String alertName) { - updateResourceGroupLevelStateToDismissWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); + public void updateResourceGroupLevelStateToInProgress(String resourceGroupName, String ascLocation, + String alertName) { + updateResourceGroupLevelStateToInProgressWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); } /** - * Update the alert's state. + * List all the alerts that are associated with the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName) { + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1832,42 +1800,27 @@ private Mono> updateResourceGroupLevelStateToActivateWithResponse 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (alertName == null) { - return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); - } final String apiVersion = "2022-01-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.updateResourceGroupLevelStateToActivate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); } /** - * Update the alert's state. + * List all the alerts that are associated with the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. * @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}. + * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1876,98 +1829,78 @@ private Mono> updateResourceGroupLevelStateToActivateWithResponse 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (alertName == null) { - return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); - } final String apiVersion = "2022-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateResourceGroupLevelStateToActivate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Update the alert's state. + * List all the alerts that are associated with the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateResourceGroupLevelStateToActivateAsync(String resourceGroupName, String ascLocation, - String alertName) { - return updateResourceGroupLevelStateToActivateWithResponseAsync(resourceGroupName, ascLocation, alertName) - .flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Update the alert's state. + * List all the alerts that are associated with the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. * @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}. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateResourceGroupLevelStateToActivateWithResponse(String resourceGroupName, - String ascLocation, String alertName, Context context) { - return updateResourceGroupLevelStateToActivateWithResponseAsync(resourceGroupName, ascLocation, alertName, - context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Update the alert's state. + * List all the alerts that are associated with the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the alerts that are associated with the subscription. + * + * @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 security alerts as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void updateResourceGroupLevelStateToActivate(String resourceGroupName, String ascLocation, - String alertName) { - updateResourceGroupLevelStateToActivateWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToInProgressWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName) { + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1980,38 +1913,29 @@ private Mono> updateResourceGroupLevelStateToInProgressWithRespon return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (alertName == null) { - return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); - } final String apiVersion = "2022-01-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.updateResourceGroupLevelStateToInProgress(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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())); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToInProgressWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName, Context context) { + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -2024,76 +1948,74 @@ private Mono> updateResourceGroupLevelStateToInProgressWithRespon return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (alertName == null) { - return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); - } final String apiVersion = "2022-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.updateResourceGroupLevelStateToInProgress(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateResourceGroupLevelStateToInProgressAsync(String resourceGroupName, String ascLocation, - String alertName) { - return updateResourceGroupLevelStateToInProgressWithResponseAsync(resourceGroupName, ascLocation, alertName) - .flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateResourceGroupLevelStateToInProgressWithResponse(String resourceGroupName, - String ascLocation, String alertName, Context context) { - return updateResourceGroupLevelStateToInProgressWithResponseAsync(resourceGroupName, ascLocation, alertName, - context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** - * Update the alert's state. + * List all the alerts that are associated with the resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security alerts as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void updateResourceGroupLevelStateToInProgress(String resourceGroupName, String ascLocation, - String alertName) { - updateResourceGroupLevelStateToInProgressWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); } /** @@ -2101,7 +2023,7 @@ public void updateResourceGroupLevelStateToInProgress(String resourceGroupName, * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2128,10 +2050,10 @@ private Mono>> simulateWithResponseAsync(String ascLoc alertSimulatorRequestBody.validate(); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; + final String contentType = "application/json"; return FluxUtil .withContext(context -> service.simulate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertSimulatorRequestBody, accept, context)) + this.client.getSubscriptionId(), ascLocation, contentType, alertSimulatorRequestBody, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -2140,7 +2062,7 @@ private Mono>> simulateWithResponseAsync(String ascLoc * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2168,10 +2090,10 @@ private Mono>> simulateWithResponseAsync(String ascLoc alertSimulatorRequestBody.validate(); } final String apiVersion = "2022-01-01"; - final String accept = "application/json"; + final String contentType = "application/json"; context = this.client.mergeContext(context); return service.simulate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, - alertSimulatorRequestBody, accept, context); + contentType, alertSimulatorRequestBody, context); } /** @@ -2179,7 +2101,7 @@ private Mono>> simulateWithResponseAsync(String ascLoc * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2198,7 +2120,7 @@ private PollerFlux, Void> beginSimulateAsync(String ascLocation * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2220,7 +2142,7 @@ private PollerFlux, Void> beginSimulateAsync(String ascLocation * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2237,7 +2159,7 @@ public SyncPoller, Void> beginSimulate(String ascLocation, * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2255,7 +2177,7 @@ public SyncPoller, Void> beginSimulate(String ascLocation, * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2272,7 +2194,7 @@ private Mono simulateAsync(String ascLocation, AlertSimulatorRequestBody a * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2291,7 +2213,7 @@ private Mono simulateAsync(String ascLocation, AlertSimulatorRequestBody a * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2306,7 +2228,7 @@ public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulato * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -2327,7 +2249,7 @@ public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulato * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listSubscriptionLevelByRegionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2336,7 +2258,8 @@ private Mono> listNextSinglePageAsync(String nextLink) 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)) + return FluxUtil.withContext( + context -> service.listSubscriptionLevelByRegionNext(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())); @@ -2353,7 +2276,8 @@ private Mono> listNextSinglePageAsync(String nextLink) * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private Mono> listSubscriptionLevelByRegionNextSinglePageAsync(String nextLink, + Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2363,7 +2287,7 @@ private Mono> listNextSinglePageAsync(String nextLink, } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listSubscriptionLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -2378,18 +2302,13 @@ private Mono> listNextSinglePageAsync(String nextLink, * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> listResourceGroupLevelByRegionNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + return FluxUtil.withContext( + context -> service.listResourceGroupLevelByRegionNext(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())); @@ -2406,17 +2325,14 @@ private Mono> listByResourceGroupNextSinglePageAsync(S * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + private Mono> listResourceGroupLevelByRegionNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listResourceGroupLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -2431,7 +2347,7 @@ private Mono> listByResourceGroupNextSinglePageAsync(S * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSubscriptionLevelByRegionNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2440,8 +2356,7 @@ private Mono> listSubscriptionLevelByRegionNextSingleP new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listSubscriptionLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + 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())); @@ -2458,8 +2373,7 @@ private Mono> listSubscriptionLevelByRegionNextSingleP * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSubscriptionLevelByRegionNextSinglePageAsync(String nextLink, - Context context) { + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2469,7 +2383,7 @@ private Mono> listSubscriptionLevelByRegionNextSingleP } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listSubscriptionLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, 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)); } @@ -2484,7 +2398,7 @@ private Mono> listSubscriptionLevelByRegionNextSingleP * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listResourceGroupLevelByRegionNextSinglePageAsync(String nextLink) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2493,8 +2407,9 @@ private Mono> listResourceGroupLevelByRegionNextSingle new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listResourceGroupLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(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())); @@ -2511,8 +2426,7 @@ private Mono> listResourceGroupLevelByRegionNextSingle * @return list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listResourceGroupLevelByRegionNextSinglePageAsync(String nextLink, - Context context) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2522,7 +2436,7 @@ private Mono> listResourceGroupLevelByRegionNextSingle } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listResourceGroupLevelByRegionNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByResourceGroupNext(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/AlertsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java index 9f38bcef7b92..92a3393b9eeb 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,58 +27,11 @@ public AlertsImpl(AlertsClient innerClient, com.azure.resourcemanager.security.S this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - - public PagedIterable listSubscriptionLevelByRegion(String ascLocation) { - PagedIterable inner = this.serviceClient().listSubscriptionLevelByRegion(ascLocation); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - - public PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context) { - PagedIterable inner = this.serviceClient().listSubscriptionLevelByRegion(ascLocation, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - - public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName) { - PagedIterable inner - = this.serviceClient().listResourceGroupLevelByRegion(ascLocation, resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - - public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, - Context context) { - PagedIterable inner - = this.serviceClient().listResourceGroupLevelByRegion(ascLocation, resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); - } - public Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context) { Response inner = this.serviceClient().getSubscriptionLevelWithResponse(ascLocation, alertName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new AlertImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AlertImpl(inner.getValue(), this.manager())); } public Alert getSubscriptionLevel(String ascLocation, String alertName) { @@ -90,25 +43,14 @@ public Alert getSubscriptionLevel(String ascLocation, String alertName) { } } - public Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, - String alertName, Context context) { - Response inner = this.serviceClient() - .getResourceGroupLevelWithResponse(resourceGroupName, ascLocation, alertName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new AlertImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable listSubscriptionLevelByRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listSubscriptionLevelByRegion(ascLocation); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); } - public Alert getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName) { - AlertInner inner = this.serviceClient().getResourceGroupLevel(resourceGroupName, ascLocation, alertName); - if (inner != null) { - return new AlertImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context) { + PagedIterable inner = this.serviceClient().listSubscriptionLevelByRegion(ascLocation, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); } public Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, @@ -148,6 +90,36 @@ public void updateSubscriptionLevelStateToInProgress(String ascLocation, String this.serviceClient().updateSubscriptionLevelStateToInProgress(ascLocation, alertName); } + public Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, + String alertName, Context context) { + Response inner = this.serviceClient() + .getResourceGroupLevelWithResponse(resourceGroupName, ascLocation, alertName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AlertImpl(inner.getValue(), this.manager())); + } + + public Alert getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName) { + AlertInner inner = this.serviceClient().getResourceGroupLevel(resourceGroupName, ascLocation, alertName); + if (inner != null) { + return new AlertImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listResourceGroupLevelByRegion(ascLocation, resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, + Context context) { + PagedIterable inner + = this.serviceClient().listResourceGroupLevelByRegion(ascLocation, resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + public Response updateResourceGroupLevelStateToResolveWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context) { return this.serviceClient() @@ -190,6 +162,26 @@ public void updateResourceGroupLevelStateToInProgress(String resourceGroupName, this.serviceClient().updateResourceGroupLevelStateToInProgress(resourceGroupName, ascLocation, alertName); } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertImpl(inner1, this.manager())); + } + public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { this.serviceClient().simulate(ascLocation, alertSimulatorRequestBody); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRuleImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRuleImpl.java new file mode 100644 index 000000000000..ac8a0cbae20d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRuleImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.models.AlertsSuppressionRule; +import com.azure.resourcemanager.security.models.RuleState; +import com.azure.resourcemanager.security.models.SuppressionAlertsScope; +import java.time.OffsetDateTime; + +public final class AlertsSuppressionRuleImpl implements AlertsSuppressionRule { + private AlertsSuppressionRuleInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AlertsSuppressionRuleImpl(AlertsSuppressionRuleInner 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 String alertType() { + return this.innerModel().alertType(); + } + + public OffsetDateTime lastModifiedUtc() { + return this.innerModel().lastModifiedUtc(); + } + + public OffsetDateTime expirationDateUtc() { + return this.innerModel().expirationDateUtc(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public RuleState state() { + return this.innerModel().state(); + } + + public String comment() { + return this.innerModel().comment(); + } + + public SuppressionAlertsScope suppressionAlertsScope() { + return this.innerModel().suppressionAlertsScope(); + } + + public AlertsSuppressionRuleInner 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/AlertsSuppressionRulesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java new file mode 100644 index 000000000000..a58a12a07fbb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java @@ -0,0 +1,637 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AlertsSuppressionRulesClient; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.implementation.models.AlertsSuppressionRulesList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AlertsSuppressionRulesClient. + */ +public final class AlertsSuppressionRulesClientImpl implements AlertsSuppressionRulesClient { + /** + * The proxy service used to perform REST calls. + */ + private final AlertsSuppressionRulesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AlertsSuppressionRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AlertsSuppressionRulesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(AlertsSuppressionRulesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAlertsSuppressionRules to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAlertsSuppressionRules") + public interface AlertsSuppressionRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AlertsSuppressionRuleInner alertsSuppressionRule, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("AlertType") String alertType, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String alertsSuppressionRuleName) { + 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 (alertsSuppressionRuleName == null) { + return Mono.error( + new IllegalArgumentException("Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertsSuppressionRuleName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String alertsSuppressionRuleName, + 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 (alertsSuppressionRuleName == null) { + return Mono.error( + new IllegalArgumentException("Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertsSuppressionRuleName, accept, context); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String alertsSuppressionRuleName) { + return getWithResponseAsync(alertsSuppressionRuleName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String alertsSuppressionRuleName, Context context) { + return getWithResponseAsync(alertsSuppressionRuleName, context).block(); + } + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertsSuppressionRuleInner get(String alertsSuppressionRuleName) { + return getWithResponse(alertsSuppressionRuleName, Context.NONE).getValue(); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 suppression rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule) { + 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 (alertsSuppressionRuleName == null) { + return Mono.error( + new IllegalArgumentException("Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + if (alertsSuppressionRule == null) { + return Mono + .error(new IllegalArgumentException("Parameter alertsSuppressionRule is required and cannot be null.")); + } else { + alertsSuppressionRule.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertsSuppressionRuleName, contentType, accept, alertsSuppressionRule, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @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 suppression rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule, 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 (alertsSuppressionRuleName == null) { + return Mono.error( + new IllegalArgumentException("Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + if (alertsSuppressionRule == null) { + return Mono + .error(new IllegalArgumentException("Parameter alertsSuppressionRule is required and cannot be null.")); + } else { + alertsSuppressionRule.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertsSuppressionRuleName, contentType, accept, alertsSuppressionRule, context); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 suppression rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule) { + return updateWithResponseAsync(alertsSuppressionRuleName, alertsSuppressionRule) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @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 suppression rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule, Context context) { + return updateWithResponseAsync(alertsSuppressionRuleName, alertsSuppressionRule, context).block(); + } + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 suppression rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertsSuppressionRuleInner update(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule) { + return updateWithResponse(alertsSuppressionRuleName, alertsSuppressionRule, Context.NONE).getValue(); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 alertsSuppressionRuleName) { + 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 (alertsSuppressionRuleName == null) { + return Mono.error( + new IllegalArgumentException("Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), alertsSuppressionRuleName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 alertsSuppressionRuleName, 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 (alertsSuppressionRuleName == null) { + return Mono.error( + new IllegalArgumentException("Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertsSuppressionRuleName, context); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 alertsSuppressionRuleName) { + return deleteWithResponseAsync(alertsSuppressionRuleName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 alertsSuppressionRuleName, Context context) { + return deleteWithResponseAsync(alertsSuppressionRuleName, context).block(); + } + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 alertsSuppressionRuleName) { + deleteWithResponse(alertsSuppressionRuleName, Context.NONE); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 suppression rules list for subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String alertType) { + 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 = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertType, 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())); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @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 suppression rules list for subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String alertType, 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 = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), alertType, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 suppression rules list for subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String alertType) { + return new PagedFlux<>(() -> listSinglePageAsync(alertType), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of all the dismiss rules for the given 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 suppression rules list for subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String alertType = null; + return new PagedFlux<>(() -> listSinglePageAsync(alertType), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @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 suppression rules list for subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String alertType, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(alertType, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of all the dismiss rules for the given 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 suppression rules list for subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String alertType = null; + return new PagedIterable<>(listAsync(alertType)); + } + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @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 suppression rules list for subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String alertType, Context context) { + return new PagedIterable<>(listAsync(alertType, 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 suppression rules list for subscription 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 suppression rules list for subscription 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/AlertsSuppressionRulesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesImpl.java new file mode 100644 index 000000000000..267333b0229a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AlertsSuppressionRulesClient; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.models.AlertsSuppressionRule; +import com.azure.resourcemanager.security.models.AlertsSuppressionRules; + +public final class AlertsSuppressionRulesImpl implements AlertsSuppressionRules { + private static final ClientLogger LOGGER = new ClientLogger(AlertsSuppressionRulesImpl.class); + + private final AlertsSuppressionRulesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AlertsSuppressionRulesImpl(AlertsSuppressionRulesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String alertsSuppressionRuleName, Context context) { + Response inner + = this.serviceClient().getWithResponse(alertsSuppressionRuleName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AlertsSuppressionRuleImpl(inner.getValue(), this.manager())); + } + + public AlertsSuppressionRule get(String alertsSuppressionRuleName) { + AlertsSuppressionRuleInner inner = this.serviceClient().get(alertsSuppressionRuleName); + if (inner != null) { + return new AlertsSuppressionRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule, Context context) { + Response inner + = this.serviceClient().updateWithResponse(alertsSuppressionRuleName, alertsSuppressionRule, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AlertsSuppressionRuleImpl(inner.getValue(), this.manager())); + } + + public AlertsSuppressionRule update(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule) { + AlertsSuppressionRuleInner inner + = this.serviceClient().update(alertsSuppressionRuleName, alertsSuppressionRule); + if (inner != null) { + return new AlertsSuppressionRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String alertsSuppressionRuleName, Context context) { + return this.serviceClient().deleteWithResponse(alertsSuppressionRuleName, context); + } + + public void delete(String alertsSuppressionRuleName) { + this.serviceClient().delete(alertsSuppressionRuleName); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertsSuppressionRuleImpl(inner1, this.manager())); + } + + public PagedIterable list(String alertType, Context context) { + PagedIterable inner = this.serviceClient().list(alertType, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AlertsSuppressionRuleImpl(inner1, this.manager())); + } + + private AlertsSuppressionRulesClient 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/AllowedConnectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java index 117dd00e903c..fd1bf3a159ea 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.AllowedConnectionsClient; import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; -import com.azure.resourcemanager.security.models.AllowedConnectionsList; +import com.azure.resourcemanager.security.implementation.models.AllowedConnectionsList; import com.azure.resourcemanager.security.models.ConnectionType; import reactor.core.publisher.Mono; @@ -60,61 +60,68 @@ public final class AllowedConnectionsClientImpl implements AllowedConnectionsCli * The interface defining all the services for SecurityCenterAllowedConnections to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterAllowe") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAllowedConnections") public interface AllowedConnectionsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("connectionType") ConnectionType connectionType, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegion(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> listByHomeRegion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("connectionType") ConnectionType connectionType, @QueryParam("api-version") String apiVersion, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @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); + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of all possible traffic between resources for the subscription along with {@link PagedResponse} - * on successful completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, ConnectionType connectionType) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -123,28 +130,42 @@ private Mono> listSinglePageAsync 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (connectionType == null) { + return Mono.error(new IllegalArgumentException("Parameter connectionType 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, - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, connectionType, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). * @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 list of all possible traffic between resources for the subscription along with {@link PagedResponse} - * on successful completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, ConnectionType connectionType, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -153,69 +174,83 @@ private Mono> listSinglePageAsync 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (connectionType == null) { + return Mono.error(new IllegalArgumentException("Parameter connectionType 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, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + ascLocation, connectionType, accept, context); } /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedFlux}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String ascLocation, + ConnectionType connectionType) { + return getWithResponseAsync(resourceGroupName, ascLocation, connectionType) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). * @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 list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets the list of all possible traffic between resources 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 the list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedIterable}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String ascLocation, + ConnectionType connectionType, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, connectionType, context).block(); } /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedIterable}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public AllowedConnectionsResourceInner get(String resourceGroupName, String ascLocation, + ConnectionType connectionType) { + return getWithResponse(resourceGroupName, ascLocation, connectionType, Context.NONE).getValue(); } /** @@ -245,8 +280,8 @@ private Mono> listByHomeRegionSin final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), - ascLocation, apiVersion, accept, context)) + .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, 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())); @@ -282,7 +317,7 @@ private Mono> listByHomeRegionSin final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, + .listByHomeRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); @@ -357,23 +392,15 @@ public PagedIterable listByHomeRegion(String as } /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type along with {@link Response} on successful completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, ConnectionType connectionType) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -382,43 +409,28 @@ private Mono> getWithResponseAsync(Str 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (connectionType == null) { - return Mono.error(new IllegalArgumentException("Parameter connectionType 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, ascLocation, connectionType, apiVersion, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type along with {@link Response} on successful completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, ConnectionType connectionType, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -427,86 +439,69 @@ private Mono> getWithResponseAsync(Str 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (connectionType == null) { - return Mono.error(new IllegalArgumentException("Parameter connectionType 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, ascLocation, - connectionType, apiVersion, accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type on successful completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String ascLocation, - ConnectionType connectionType) { - return getWithResponseAsync(resourceGroupName, ascLocation, connectionType) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type along with {@link Response}. + * @return the list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String ascLocation, - ConnectionType connectionType, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, connectionType, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). + * @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 list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the list of all possible traffic between resources for the subscription. + * + * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type. + * @return the list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AllowedConnectionsResourceInner get(String resourceGroupName, String ascLocation, - ConnectionType connectionType) { - return getWithResponse(resourceGroupName, ascLocation, connectionType, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** @@ -516,11 +511,11 @@ public AllowedConnectionsResourceInner get(String resourceGroupName, String ascL * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 all possible traffic between Azure resources along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription and location along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -529,7 +524,8 @@ private Mono> listNextSinglePageA 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)) + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(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())); @@ -543,11 +539,11 @@ private Mono> listNextSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 all possible traffic between Azure resources along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription and location along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -558,7 +554,7 @@ private Mono> listNextSinglePageA } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -570,11 +566,11 @@ private Mono> listNextSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 all possible traffic between Azure resources along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -583,8 +579,7 @@ private Mono> listByHomeRegionNex new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + 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())); @@ -598,11 +593,11 @@ private Mono> listByHomeRegionNex * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 all possible traffic between Azure resources along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -613,7 +608,7 @@ private Mono> listByHomeRegionNex } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, 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/AllowedConnectionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsImpl.java index 783c8fb12d19..0eacf2d892c5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -28,16 +28,22 @@ public AllowedConnectionsImpl(AllowedConnectionsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); + public Response getWithResponse(String resourceGroupName, String ascLocation, + ConnectionType connectionType, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, ascLocation, connectionType, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AllowedConnectionsResourceImpl(inner.getValue(), this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); + public AllowedConnectionsResource get(String resourceGroupName, String ascLocation, ConnectionType connectionType) { + AllowedConnectionsResourceInner inner + = this.serviceClient().get(resourceGroupName, ascLocation, connectionType); + if (inner != null) { + return new AllowedConnectionsResourceImpl(inner, this.manager()); + } else { + return null; + } } public PagedIterable listByHomeRegion(String ascLocation) { @@ -53,26 +59,16 @@ public PagedIterable listByHomeRegion(String ascLoca inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); } - public Response getWithResponse(String resourceGroupName, String ascLocation, - ConnectionType connectionType, Context context) { - Response inner - = this.serviceClient().getWithResponse(resourceGroupName, ascLocation, connectionType, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new AllowedConnectionsResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); } - public AllowedConnectionsResource get(String resourceGroupName, String ascLocation, ConnectionType connectionType) { - AllowedConnectionsResourceInner inner - = this.serviceClient().get(resourceGroupName, ascLocation, connectionType); - if (inner != null) { - return new AllowedConnectionsResourceImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new AllowedConnectionsResourceImpl(inner1, this.manager())); } private AllowedConnectionsClient serviceClient() { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsResourceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsResourceImpl.java index de4ec6bfedfd..c8d600916caa 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsResourceImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsResourceImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; import com.azure.resourcemanager.security.models.AllowedConnectionsResource; import com.azure.resourcemanager.security.models.ConnectableResource; @@ -38,6 +39,10 @@ public String location() { return this.innerModel().location(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public OffsetDateTime calculatedDateTime() { return this.innerModel().calculatedDateTime(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionImpl.java index 658835896f61..27b08ff50280 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.ApiCollectionInner; import com.azure.resourcemanager.security.models.ApiCollection; import com.azure.resourcemanager.security.models.ProvisioningState; @@ -31,6 +32,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } 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 1edb49e9f830..fa946ab5a361 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -32,7 +32,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.security.fluent.ApiCollectionsClient; import com.azure.resourcemanager.security.fluent.models.ApiCollectionInner; -import com.azure.resourcemanager.security.models.ApiCollectionList; +import com.azure.resourcemanager.security.implementation.models.ApiCollectionList; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -66,102 +66,109 @@ public final class ApiCollectionsClientImpl implements ApiCollectionsClient { * The interface defining all the services for SecurityCenterApiCollections to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterApiCol") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterApiCollections") public interface ApiCollectionsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> getByAzureApiManagementService(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("apiId") String apiId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections") - @ExpectedResponses({ 200 }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono>> onboardAzureApiManagementApi(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("apiId") String apiId, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections") - @ExpectedResponses({ 200 }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") + @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByAzureApiManagementService(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono> offboardAzureApiManagementApi(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @PathParam("apiId") String apiId, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByAzureApiManagementService(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono> listByAzureApiManagementService(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, - @PathParam("apiId") String apiId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") - @ExpectedResponses({ 200, 201 }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> onboardAzureApiManagementApi(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, - @PathParam("apiId") String apiId, @QueryParam("api-version") String apiVersion, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") - @ExpectedResponses({ 200, 204 }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> offboardAzureApiManagementApi(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, - @PathParam("apiId") String apiId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listByAzureApiManagementServiceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByAzureApiManagementServiceNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Gets a list of API collections within a subscription + * Gets an onboarded Azure API Management API * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with + * {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getByAzureApiManagementServiceWithResponseAsync(String resourceGroupName, + String serviceName, String apiId) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -170,30 +177,47 @@ private Mono> listSinglePageAsync() { 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (apiId == null) { + return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); + } final String apiVersion = "2023-11-15"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.getByAzureApiManagementService(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets a list of API collections within a subscription + * Gets an onboarded Azure API Management API * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with + * {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getByAzureApiManagementServiceWithResponseAsync(String resourceGroupName, + String serviceName, String apiId, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -202,94 +226,120 @@ private Mono> listSinglePageAsync(Context cont 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 (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (apiId == null) { + return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); + } final String apiVersion = "2023-11-15"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.getByAzureApiManagementService(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, accept, context); } /** - * Gets a list of API collections within a subscription + * Gets an onboarded Azure API Management API * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedFlux}. + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs on successful completion + * of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByAzureApiManagementServiceAsync(String resourceGroupName, String serviceName, + String apiId) { + return getByAzureApiManagementServiceWithResponseAsync(resourceGroupName, serviceName, apiId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Gets a list of API collections within a subscription + * Gets an onboarded Azure API Management API * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets a list of API collections within a subscription - * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * @return an onboarded Azure API Management API * - * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with + * {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByAzureApiManagementServiceWithResponse(String resourceGroupName, + String serviceName, String apiId, Context context) { + return getByAzureApiManagementServiceWithResponseAsync(resourceGroupName, serviceName, apiId, context).block(); } /** - * Gets a list of API collections within a subscription + * Gets an onboarded Azure API Management API * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiCollectionInner getByAzureApiManagementService(String resourceGroupName, String serviceName, + String apiId) { + return getByAzureApiManagementServiceWithResponse(resourceGroupName, serviceName, apiId, Context.NONE) + .getValue(); } /** - * Gets a list of API collections within a resource group + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an API collection as represented by Microsoft Defender for APIs along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + private Mono>> onboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, + String serviceName, String apiId) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -302,32 +352,41 @@ private Mono> listByResourceGroupSinglePageAsy return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (apiId == null) { + return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); + } final String apiVersion = "2023-11-15"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.onboardAzureApiManagementApi(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets a list of API collections within a resource group + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an API collection as represented by Microsoft Defender for APIs along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, - Context context) { + private Mono>> onboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, + String serviceName, String apiId, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -340,270 +399,213 @@ private Mono> listByResourceGroupSinglePageAsy return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (apiId == null) { + return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); + } final String apiVersion = "2023-11-15"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Gets a list of API collections within a resource group - * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); - } - - /** - * Gets a list of API collections within a resource group - * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + return service.onboardAzureApiManagementApi(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, accept, context); } /** - * Gets a list of API collections within a resource group + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * @return the {@link PollerFlux} for polling of an API collection as represented by Microsoft Defender for APIs. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApiCollectionInner> + beginOnboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, String apiId) { + Mono>> mono + = onboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ApiCollectionInner.class, ApiCollectionInner.class, this.client.getContext()); } /** - * Gets a list of API collections within a resource group + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * @return the {@link PollerFlux} for polling of an API collection as represented by Microsoft Defender for APIs. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApiCollectionInner> beginOnboardAzureApiManagementApiAsync( + String resourceGroupName, String serviceName, String apiId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = onboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ApiCollectionInner.class, ApiCollectionInner.class, context); } /** - * Gets a list of onboarded Azure API Management APIs + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of an API collection as represented by Microsoft Defender for APIs. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByAzureApiManagementServiceSinglePageAsync(String resourceGroupName, String serviceName) { - 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 (serviceName == null) { - return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); - } - final String apiVersion = "2023-11-15"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByAzureApiManagementService(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, serviceName, 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())); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApiCollectionInner> + beginOnboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { + return this.beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).getSyncPoller(); } /** - * Gets a list of onboarded Azure API Management APIs + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of an API collection as represented by Microsoft Defender for APIs. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByAzureApiManagementServiceSinglePageAsync(String resourceGroupName, String serviceName, 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 (serviceName == null) { - return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); - } - final String apiVersion = "2023-11-15"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByAzureApiManagementService(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, serviceName, apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApiCollectionInner> + beginOnboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId, Context context) { + return this.beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId, context) + .getSyncPoller(); } /** - * Gets a list of onboarded Azure API Management APIs + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedFlux}. + * @return an API collection as represented by Microsoft Defender for APIs on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByAzureApiManagementServiceAsync(String resourceGroupName, - String serviceName) { - return new PagedFlux<>(() -> listByAzureApiManagementServiceSinglePageAsync(resourceGroupName, serviceName), - nextLink -> listByAzureApiManagementServiceNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono onboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, + String apiId) { + return beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Gets a list of onboarded Azure API Management APIs + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedFlux}. + * @return an API collection as represented by Microsoft Defender for APIs on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByAzureApiManagementServiceAsync(String resourceGroupName, - String serviceName, Context context) { - return new PagedFlux<>( - () -> listByAzureApiManagementServiceSinglePageAsync(resourceGroupName, serviceName, context), - nextLink -> listByAzureApiManagementServiceNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono onboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, + String apiId, Context context) { + return beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId, context).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Gets a list of onboarded Azure API Management APIs + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedIterable}. + * @return an API collection as represented by Microsoft Defender for APIs. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByAzureApiManagementService(String resourceGroupName, - String serviceName) { - return new PagedIterable<>(listByAzureApiManagementServiceAsync(resourceGroupName, serviceName)); + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiCollectionInner onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { + return onboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).block(); } /** - * Gets a list of onboarded Azure API Management APIs + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedIterable}. + * @return an API collection as represented by Microsoft Defender for APIs. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByAzureApiManagementService(String resourceGroupName, - String serviceName, Context context) { - return new PagedIterable<>(listByAzureApiManagementServiceAsync(resourceGroupName, serviceName, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiCollectionInner onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId, + Context context) { + return onboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId, context).block(); } /** - * Gets an onboarded Azure API Management API + * Offboard an Azure API Management API from Microsoft Defender for APIs * - * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the + * operations within the Azure API Management API for intrusive behaviors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. @@ -612,11 +614,10 @@ public PagedIterable listByAzureApiManagementService(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with - * {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByAzureApiManagementServiceWithResponseAsync(String resourceGroupName, + private Mono> offboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, String serviceName, String apiId) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -637,19 +638,17 @@ private Mono> getByAzureApiManagementServiceWithRes return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); } final String apiVersion = "2023-11-15"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getByAzureApiManagementService(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, apiVersion, accept, context)) + .withContext(context -> service.offboardAzureApiManagementApi(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets an onboarded Azure API Management API + * Offboard an Azure API Management API from Microsoft Defender for APIs * - * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the + * operations within the Azure API Management API for intrusive behaviors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. @@ -659,11 +658,10 @@ private Mono> getByAzureApiManagementServiceWithRes * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with - * {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByAzureApiManagementServiceWithResponseAsync(String resourceGroupName, + private Mono> offboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, String serviceName, String apiId, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -684,18 +682,16 @@ private Mono> getByAzureApiManagementServiceWithRes return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); } final String apiVersion = "2023-11-15"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.getByAzureApiManagementService(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, serviceName, apiId, apiVersion, accept, context); + return service.offboardAzureApiManagementApi(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, context); } /** - * Gets an onboarded Azure API Management API + * Offboard an Azure API Management API from Microsoft Defender for APIs * - * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the + * operations within the Azure API Management API for intrusive behaviors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. @@ -704,22 +700,19 @@ private Mono> getByAzureApiManagementServiceWithRes * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs on successful - * completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByAzureApiManagementServiceAsync(String resourceGroupName, String serviceName, - String apiId) { - return getByAzureApiManagementServiceWithResponseAsync(resourceGroupName, serviceName, apiId) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono offboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, String apiId) { + return offboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId) + .flatMap(ignored -> Mono.empty()); } /** - * Gets an onboarded Azure API Management API + * Offboard an Azure API Management API from Microsoft Defender for APIs * - * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the + * operations within the Azure API Management API for intrusive behaviors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. @@ -729,21 +722,19 @@ private Mono getByAzureApiManagementServiceAsync(String reso * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with - * {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByAzureApiManagementServiceWithResponse(String resourceGroupName, - String serviceName, String apiId, Context context) { - return getByAzureApiManagementServiceWithResponseAsync(resourceGroupName, serviceName, apiId, context).block(); + public Response offboardAzureApiManagementApiWithResponse(String resourceGroupName, String serviceName, + String apiId, Context context) { + return offboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId, context).block(); } /** - * Gets an onboarded Azure API Management API + * Offboard an Azure API Management API from Microsoft Defender for APIs * - * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the + * operations within the Azure API Management API for intrusive behaviors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. @@ -752,35 +743,32 @@ public Response getByAzureApiManagementServiceWithResponse(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ApiCollectionInner getByAzureApiManagementService(String resourceGroupName, String serviceName, - String apiId) { - return getByAzureApiManagementServiceWithResponse(resourceGroupName, serviceName, apiId, Context.NONE) - .getValue(); + public void offboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { + offboardAzureApiManagementApiWithResponse(resourceGroupName, serviceName, apiId, Context.NONE); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of onboarded Azure API Management APIs * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collection as represented by Microsoft Defender for APIs along with {@link Response} on successful - * completion of {@link Mono}. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> onboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, - String serviceName, String apiId) { + private Mono> + listByAzureApiManagementServiceSinglePageAsync(String resourceGroupName, String serviceName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -796,38 +784,37 @@ private Mono>> onboardAzureApiManagementApiWithRespons if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (apiId == null) { - return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); - } final String apiVersion = "2023-11-15"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.onboardAzureApiManagementApi(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, apiVersion, accept, context)) + .withContext(context -> service.listByAzureApiManagementService(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, serviceName, 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())); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of onboarded Azure API Management APIs * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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 API collection as represented by Microsoft Defender for APIs along with {@link Response} on successful - * completion of {@link Mono}. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> onboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, - String serviceName, String apiId, Context context) { + private Mono> + listByAzureApiManagementServiceSinglePageAsync(String resourceGroupName, String serviceName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -843,223 +830,267 @@ private Mono>> onboardAzureApiManagementApiWithRespons if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (apiId == null) { - return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); - } final String apiVersion = "2023-11-15"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.onboardAzureApiManagementApi(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, serviceName, apiId, apiVersion, accept, context); + return service + .listByAzureApiManagementService(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, serviceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of onboarded Azure API Management APIs * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an API collection as represented by Microsoft Defender for APIs. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ApiCollectionInner> - beginOnboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, String apiId) { - Mono>> mono - = onboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ApiCollectionInner.class, ApiCollectionInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAzureApiManagementServiceAsync(String resourceGroupName, + String serviceName) { + return new PagedFlux<>(() -> listByAzureApiManagementServiceSinglePageAsync(resourceGroupName, serviceName), + nextLink -> listByAzureApiManagementServiceNextSinglePageAsync(nextLink)); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of onboarded Azure API Management APIs * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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 an API collection as represented by Microsoft Defender for APIs. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ApiCollectionInner> beginOnboardAzureApiManagementApiAsync( - String resourceGroupName, String serviceName, String apiId, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = onboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ApiCollectionInner.class, ApiCollectionInner.class, context); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAzureApiManagementServiceAsync(String resourceGroupName, + String serviceName, Context context) { + return new PagedFlux<>( + () -> listByAzureApiManagementServiceSinglePageAsync(resourceGroupName, serviceName, context), + nextLink -> listByAzureApiManagementServiceNextSinglePageAsync(nextLink, context)); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of onboarded Azure API Management APIs * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an API collection as represented by Microsoft Defender for APIs. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ApiCollectionInner> - beginOnboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { - return this.beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).getSyncPoller(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAzureApiManagementService(String resourceGroupName, + String serviceName) { + return new PagedIterable<>(listByAzureApiManagementServiceAsync(resourceGroupName, serviceName)); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of onboarded Azure API Management APIs * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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 an API collection as represented by Microsoft Defender for APIs. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ApiCollectionInner> - beginOnboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId, Context context) { - return this.beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId, context) - .getSyncPoller(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAzureApiManagementService(String resourceGroupName, + String serviceName, Context context) { + return new PagedIterable<>(listByAzureApiManagementServiceAsync(resourceGroupName, serviceName, context)); + } + + /** + * Gets a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * + * @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 API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2023-11-15"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * + * @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 API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2023-11-15"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of API collections within a subscription * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collection as represented by Microsoft Defender for APIs on successful completion of {@link Mono}. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono onboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, - String apiId) { - return beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).last() - .flatMap(this.client::getLroFinalResultOrError); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of API collections within a subscription * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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 API collection as represented by Microsoft Defender for APIs on successful completion of {@link Mono}. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono onboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, - String apiId, Context context) { - return beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId, context).last() - .flatMap(this.client::getLroFinalResultOrError); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of API collections within a subscription * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collection as represented by Microsoft Defender for APIs. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ApiCollectionInner onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { - return onboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); } /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of API collections within a subscription * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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 API collection as represented by Microsoft Defender for APIs. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ApiCollectionInner onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId, - Context context) { - return onboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** - * Offboard an Azure API Management API from Microsoft Defender for APIs + * Gets a list of API collections within a resource group * - * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the - * operations within the Azure API Management API for intrusive behaviors. + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> offboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, - String serviceName, String apiId) { + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1072,39 +1103,34 @@ private Mono> offboardAzureApiManagementApiWithResponseAsync(Stri return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (serviceName == null) { - return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); - } - if (apiId == null) { - return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); - } final String apiVersion = "2023-11-15"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.offboardAzureApiManagementApi(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, serviceName, apiId, apiVersion, accept, context)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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())); } /** - * Offboard an Azure API Management API from Microsoft Defender for APIs + * Gets a list of API collections within a resource group * - * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the - * operations within the Azure API Management API for intrusive behaviors. + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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}. + * @return a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> offboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, - String serviceName, String apiId, Context context) { + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1117,93 +1143,113 @@ private Mono> offboardAzureApiManagementApiWithResponseAsync(Stri return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (serviceName == null) { - return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); - } - if (apiId == null) { - return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); - } final String apiVersion = "2023-11-15"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.offboardAzureApiManagementApi(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, serviceName, apiId, apiVersion, accept, context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Offboard an Azure API Management API from Microsoft Defender for APIs + * Gets a list of API collections within a resource group * - * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the - * operations within the Azure API Management API for intrusive behaviors. + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono offboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, String apiId) { - return offboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId) - .flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** - * Offboard an Azure API Management API from Microsoft Defender for APIs + * Gets a list of API collections within a resource group * - * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the - * operations within the Azure API Management API for intrusive behaviors. + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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}. + * @return a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response offboardAzureApiManagementApiWithResponse(String resourceGroupName, String serviceName, - String apiId, Context context) { - return offboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** - * Offboard an Azure API Management API from Microsoft Defender for APIs + * Gets a list of API collections within a resource group * - * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the - * operations within the Azure API Management API for intrusive behaviors. + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void offboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { - offboardAzureApiManagementApiWithResponse(resourceGroupName, serviceName, apiId, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); } /** + * Gets a list of onboarded Azure API Management APIs + * * 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 list of API collections as represented by Microsoft Defender for APIs along with + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + private Mono> + listByAzureApiManagementServiceNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1213,14 +1259,16 @@ private Mono> listBySubscriptionNextSinglePage } final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .withContext(context -> service.listByAzureApiManagementServiceNext(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())); } /** + * Gets a list of onboarded Azure API Management APIs + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1228,11 +1276,13 @@ private Mono> listBySubscriptionNextSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of API collections as represented by Microsoft Defender for APIs along with + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + private Mono> listByAzureApiManagementServiceNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -1243,23 +1293,27 @@ private Mono> listBySubscriptionNextSinglePage } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByAzureApiManagementServiceNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** + * Gets a list of API collections within a subscription + * * 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 list of API collections as represented by Microsoft Defender for APIs along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1270,13 +1324,15 @@ private Mono> listByResourceGroupNextSinglePag final String accept = "application/json"; return FluxUtil .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + context -> service.listBySubscriptionNext(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())); } /** + * Gets a list of API collections within a subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1284,11 +1340,13 @@ private Mono> listByResourceGroupNextSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of API collections as represented by Microsoft Defender for APIs along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -1299,24 +1357,27 @@ private Mono> listByResourceGroupNextSinglePag } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** + * Gets a list of API collections within a resource group + * * 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 list of API collections as represented by Microsoft Defender for APIs along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByAzureApiManagementServiceNextSinglePageAsync(String nextLink) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1326,14 +1387,16 @@ private Mono> listByResourceGroupNextSinglePag } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByAzureApiManagementServiceNext(nextLink, this.client.getEndpoint(), - accept, context)) + .withContext( + context -> service.listByResourceGroupNext(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())); } /** + * Gets a list of API collections within a resource group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1341,11 +1404,13 @@ private Mono> listByResourceGroupNextSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of API collections as represented by Microsoft Defender for APIs along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs + * along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByAzureApiManagementServiceNextSinglePageAsync(String nextLink, + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -1356,7 +1421,7 @@ private Mono> listByAzureApiManagementServiceN } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByAzureApiManagementServiceNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByResourceGroupNext(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/ApiCollectionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionsImpl.java index 2f1614059e19..59b2d8d9ffee 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,49 +27,12 @@ public ApiCollectionsImpl(ApiCollectionsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); - } - - public PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName) { - PagedIterable inner - = this.serviceClient().listByAzureApiManagementService(resourceGroupName, serviceName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); - } - - public PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName, - Context context) { - PagedIterable inner - = this.serviceClient().listByAzureApiManagementService(resourceGroupName, serviceName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); - } - public Response getByAzureApiManagementServiceWithResponse(String resourceGroupName, String serviceName, String apiId, Context context) { Response inner = this.serviceClient() .getByAzureApiManagementServiceWithResponse(resourceGroupName, serviceName, apiId, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ApiCollectionImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApiCollectionImpl(inner.getValue(), this.manager())); } public ApiCollection getByAzureApiManagementService(String resourceGroupName, String serviceName, String apiId) { @@ -113,6 +76,39 @@ public void offboardAzureApiManagementApi(String resourceGroupName, String servi this.serviceClient().offboardAzureApiManagementApi(resourceGroupName, serviceName, apiId); } + public PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName) { + PagedIterable inner + = this.serviceClient().listByAzureApiManagementService(resourceGroupName, serviceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); + } + + public PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName, + Context context) { + PagedIterable inner + = this.serviceClient().listByAzureApiManagementService(resourceGroupName, serviceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiCollectionImpl(inner1, this.manager())); + } + private ApiCollectionsClient serviceClient() { return this.innerClient; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationImpl.java new file mode 100644 index 000000000000..19f01d03355c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ApplicationInner; +import com.azure.resourcemanager.security.models.Application; +import com.azure.resourcemanager.security.models.ApplicationSourceResourceType; +import java.util.Collections; +import java.util.List; + +public final class ApplicationImpl implements Application, Application.Definition, Application.Update { + private ApplicationInner 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 displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public ApplicationSourceResourceType sourceResourceType() { + return this.innerModel().sourceResourceType(); + } + + public List conditionSets() { + List inner = this.innerModel().conditionSets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplicationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String applicationId; + + public Application create() { + this.innerObject = serviceManager.serviceClient() + .getApplications() + .createOrUpdateWithResponse(applicationId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Application create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApplications() + .createOrUpdateWithResponse(applicationId, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new ApplicationInner(); + this.serviceManager = serviceManager; + this.applicationId = name; + } + + public ApplicationImpl update() { + return this; + } + + public Application apply() { + this.innerObject = serviceManager.serviceClient() + .getApplications() + .createOrUpdateWithResponse(applicationId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Application apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApplications() + .createOrUpdateWithResponse(applicationId, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationImpl(ApplicationInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.applicationId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "applications"); + } + + public Application refresh() { + this.innerObject + = serviceManager.serviceClient().getApplications().getWithResponse(applicationId, Context.NONE).getValue(); + return this; + } + + public Application refresh(Context context) { + this.innerObject + = serviceManager.serviceClient().getApplications().getWithResponse(applicationId, context).getValue(); + return this; + } + + public ApplicationImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public ApplicationImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public ApplicationImpl withSourceResourceType(ApplicationSourceResourceType sourceResourceType) { + this.innerModel().withSourceResourceType(sourceResourceType); + return this; + } + + public ApplicationImpl withConditionSets(List conditionSets) { + this.innerModel().withConditionSets(conditionSets); + return this; + } +} 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 new file mode 100644 index 000000000000..54030e0b8228 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsClientImpl.java @@ -0,0 +1,605 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ApplicationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import com.azure.resourcemanager.security.implementation.models.ApplicationsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ApplicationsClient. + */ +public final class ApplicationsClientImpl implements ApplicationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ApplicationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(ApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterApplications to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterApplications") + public interface ApplicationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationId") String applicationId, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationId") String applicationId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApplicationInner application, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationId") String applicationId, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 application for the requested scope by applicationId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String applicationId) { + 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + applicationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String applicationId, 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), applicationId, + accept, context); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 application for the requested scope by applicationId on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String applicationId) { + return getWithResponseAsync(applicationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String applicationId, Context context) { + return getWithResponseAsync(applicationId, context).block(); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 application for the requested scope by applicationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner get(String applicationId) { + return getWithResponse(applicationId, Context.NONE).getValue(); + } + + /** + * Creates or update a security application on the given subscription. + * + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String applicationId, + ApplicationInner application) { + 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + if (application == null) { + return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String apiVersion = "2022-07-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), applicationId, contentType, accept, application, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or update a security application on the given subscription. + * + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String applicationId, + ApplicationInner application, 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + if (application == null) { + return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String apiVersion = "2022-07-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + applicationId, contentType, accept, application, context); + } + + /** + * Creates or update a security application on the given subscription. + * + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String applicationId, ApplicationInner application) { + return createOrUpdateWithResponseAsync(applicationId, application) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or update a security application on the given subscription. + * + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String applicationId, ApplicationInner application, + Context context) { + return createOrUpdateWithResponseAsync(applicationId, application, context).block(); + } + + /** + * Creates or update a security application on the given subscription. + * + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner createOrUpdate(String applicationId, ApplicationInner application) { + return createOrUpdateWithResponse(applicationId, application, Context.NONE).getValue(); + } + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 applicationId) { + 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), applicationId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 applicationId, 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), applicationId, + context); + } + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 applicationId) { + return deleteWithResponseAsync(applicationId).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 applicationId, Context context) { + return deleteWithResponseAsync(applicationId, context).block(); + } + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 applicationId) { + deleteWithResponse(applicationId, Context.NONE); + } + + /** + * Get a list of all relevant applications over a subscription level scope. + * + * @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 applications over a subscription level scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2022-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 applications over a subscription level 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 a list of all relevant applications over a subscription level scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2022-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), 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 applications over a subscription level scope. + * + * @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 applications over a subscription level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant applications over a subscription level 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 a list of all relevant applications over a subscription level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant applications over a subscription level scope. + * + * @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 applications over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all relevant applications over a subscription level 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 a list of all relevant applications over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 a list of all relevant applications over a subscription level scope 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 all relevant applications over a subscription level scope 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/ApplicationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsImpl.java new file mode 100644 index 000000000000..d28156841200 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsImpl.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ApplicationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import com.azure.resourcemanager.security.models.Application; +import com.azure.resourcemanager.security.models.Applications; + +public final class ApplicationsImpl implements Applications { + private static final ClientLogger LOGGER = new ClientLogger(ApplicationsImpl.class); + + private final ApplicationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ApplicationsImpl(ApplicationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String applicationId, Context context) { + Response inner = this.serviceClient().getWithResponse(applicationId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } + + public Application get(String applicationId) { + ApplicationInner inner = this.serviceClient().get(applicationId); + if (inner != null) { + return new ApplicationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String applicationId, Context context) { + return this.serviceClient().deleteWithResponse(applicationId, context); + } + + public void delete(String applicationId) { + this.serviceClient().delete(applicationId); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public Application getById(String id) { + String applicationId = ResourceManagerUtils.getValueFromIdByName(id, "applications"); + if (applicationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(applicationId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String applicationId = ResourceManagerUtils.getValueFromIdByName(id, "applications"); + if (applicationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(applicationId, context); + } + + public void deleteById(String id) { + String applicationId = ResourceManagerUtils.getValueFromIdByName(id, "applications"); + if (applicationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.deleteWithResponse(applicationId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String applicationId = ResourceManagerUtils.getValueFromIdByName(id, "applications"); + if (applicationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.deleteWithResponse(applicationId, context); + } + + private ApplicationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public ApplicationImpl define(String name) { + return new ApplicationImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java new file mode 100644 index 000000000000..4a673acd5c1c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; +import com.azure.resourcemanager.security.models.AscLocation; + +public final class AscLocationImpl implements AscLocation { + private AscLocationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AscLocationImpl(AscLocationInner 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 Object properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AscLocationInner 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/AssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java index 9b63d28ebdfd..3601476d13e8 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,9 +30,9 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.AssessmentsClient; import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentResponseInner; +import com.azure.resourcemanager.security.implementation.models.SecurityAssessmentList; import com.azure.resourcemanager.security.models.ExpandEnum; import com.azure.resourcemanager.security.models.SecurityAssessment; -import com.azure.resourcemanager.security.models.SecurityAssessmentList; import reactor.core.publisher.Mono; /** @@ -64,183 +64,58 @@ public final class AssessmentsClientImpl implements AssessmentsClient { * The interface defining all the services for SecurityCenterAssessments to be used by the proxy service to perform * REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterAssess") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAssessments") public interface AssessmentsService { - @Headers({ "Content-Type: application/json" }) - @Get("/{scope}/providers/Microsoft.Security/assessments") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, - @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Get("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("assessmentName") String assessmentName, @QueryParam("$expand") ExpandEnum expand, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Put("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, - @PathParam("assessmentName") String assessmentName, - @BodyParam("application/json") SecurityAssessment assessment, @HeaderParam("Accept") String accept, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SecurityAssessment assessment, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, - @PathParam("assessmentName") String assessmentName, @HeaderParam("Accept") String accept, Context context); + @PathParam("assessmentName") String assessmentName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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); - } - - /** - * Get security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 assessments on all your scanned resources inside 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 = "2021-06-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 security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 assessments on all your scanned resources inside 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 = "2021-06-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 security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 assessments on all your scanned resources inside 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 security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 assessments on all your scanned resources inside 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 security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 assessments on all your scanned resources inside a scope as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String scope) { - return new PagedIterable<>(listAsync(scope)); - } - - /** - * Get security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 assessments on all your scanned resources inside 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)); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param expand OData expand. Optional. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -262,7 +137,7 @@ private Mono> getWithResponseAsync(Str if (assessmentName == null) { return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, @@ -273,7 +148,7 @@ private Mono> getWithResponseAsync(Str /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param expand OData expand. Optional. * @param context The context to associate with this operation. @@ -296,7 +171,7 @@ private Mono> getWithResponseAsync(Str if (assessmentName == null) { return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, expand, accept, context); @@ -305,7 +180,7 @@ private Mono> getWithResponseAsync(Str /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -322,7 +197,7 @@ private Mono getAsync(String resourceId, String /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param expand OData expand. Optional. * @param context The context to associate with this operation. @@ -340,7 +215,7 @@ public Response getWithResponse(String resource /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -357,7 +232,7 @@ public SecurityAssessmentResponseInner get(String resourceId, String assessmentN * Create a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param assessment Calculated assessment on a pre-defined assessment metadata. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -384,11 +259,12 @@ private Mono> createOrUpdateWithRespon } else { assessment.validate(); } - final String apiVersion = "2021-06-01"; + final String apiVersion = "2025-05-04"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, - assessmentName, assessment, accept, context)) + assessmentName, contentType, accept, assessment, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -396,7 +272,7 @@ private Mono> createOrUpdateWithRespon * Create a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param assessment Calculated assessment on a pre-defined assessment metadata. * @param context The context to associate with this operation. @@ -424,18 +300,19 @@ private Mono> createOrUpdateWithRespon } else { assessment.validate(); } - final String apiVersion = "2021-06-01"; + final String apiVersion = "2025-05-04"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, assessment, - accept, context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, contentType, + accept, assessment, context); } /** * Create a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param assessment Calculated assessment on a pre-defined assessment metadata. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -454,7 +331,7 @@ private Mono createOrUpdateAsync(String resourc * Create a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param assessment Calculated assessment on a pre-defined assessment metadata. * @param context The context to associate with this operation. @@ -473,7 +350,7 @@ public Response createOrUpdateWithResponse(Stri * Create a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param assessment Calculated assessment on a pre-defined assessment metadata. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -491,7 +368,7 @@ public SecurityAssessmentResponseInner createOrUpdate(String resourceId, String * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -510,11 +387,10 @@ private Mono> deleteWithResponseAsync(String resourceId, String a if (assessmentName == null) { return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; - final String accept = "application/json"; + final String apiVersion = "2025-05-04"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, - accept, context)) + .withContext( + context -> service.delete(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -522,7 +398,7 @@ private Mono> deleteWithResponseAsync(String resourceId, String a * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -542,17 +418,16 @@ private Mono> deleteWithResponseAsync(String resourceId, String a if (assessmentName == null) { return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; - final String accept = "application/json"; + final String apiVersion = "2025-05-04"; context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, accept, context); + return service.delete(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, context); } /** * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -568,7 +443,7 @@ private Mono deleteAsync(String resourceId, String assessmentName) { * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -585,7 +460,7 @@ public Response deleteWithResponse(String resourceId, String assessmentNam * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -596,6 +471,125 @@ public void delete(String resourceId, String assessmentName) { deleteWithResponse(resourceId, assessmentName, Context.NONE); } + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside 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 = "2025-05-04"; + 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 security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside 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 = "2025-05-04"; + 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 security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside 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 security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside 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 security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside 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. * @@ -603,8 +597,8 @@ public void delete(String resourceId, String assessmentName) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security assessments list along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return security assessments on all your scanned resources inside a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -630,8 +624,8 @@ private Mono> listNextSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security assessments list along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return security assessments on all your scanned resources inside a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsImpl.java index e0843e5ad750..1eebf9cb92f3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -28,28 +28,12 @@ public AssessmentsImpl(AssessmentsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list(String scope) { - PagedIterable inner = this.serviceClient().list(scope); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new SecurityAssessmentResponseImpl(inner1, this.manager())); - } - - public PagedIterable list(String scope, Context context) { - PagedIterable inner = this.serviceClient().list(scope, context); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new SecurityAssessmentResponseImpl(inner1, this.manager())); - } - public Response getWithResponse(String resourceId, String assessmentName, ExpandEnum expand, Context context) { Response inner = this.serviceClient().getWithResponse(resourceId, assessmentName, expand, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SecurityAssessmentResponseImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityAssessmentResponseImpl(inner.getValue(), this.manager())); } public SecurityAssessmentResponse get(String resourceId, String assessmentName) { @@ -69,6 +53,18 @@ public void deleteByResourceGroup(String resourceId, String assessmentName) { this.serviceClient().delete(resourceId, assessmentName); } + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SecurityAssessmentResponseImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SecurityAssessmentResponseImpl(inner1, this.manager())); + } + public SecurityAssessmentResponse getById(String id) { String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}", "resourceId"); 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 2f0395e28342..36ebdd8c78c3 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,7 +30,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.AssessmentsMetadatasClient; import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataResponseInner; -import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataResponseList; +import com.azure.resourcemanager.security.implementation.models.SecurityAssessmentMetadataResponseList; import reactor.core.publisher.Mono; /** @@ -62,290 +62,333 @@ public final class AssessmentsMetadatasClientImpl implements AssessmentsMetadata * The interface defining all the services for SecurityCenterAssessmentsMetadatas to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterAssess") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAssessmentsMetadatas") public interface AssessmentsMetadatasService { @Headers({ "Content-Type: application/json" }) - @Get("/providers/Microsoft.Security/assessmentMetadata") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> getInSubscription( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("assessmentMetadataName") String assessmentMetadataName, @HeaderParam("Accept") String accept, + Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("assessmentMetadataName") String assessmentMetadataName, @HeaderParam("Accept") String accept, - Context context); + Mono> createInSubscription( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("assessmentMetadataName") String assessmentMetadataName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SecurityAssessmentMetadataResponseInner assessmentMetadata, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata") + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscription(@HostParam("$host") String endpoint, + Mono> deleteInSubscription(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); + @PathParam("assessmentMetadataName") String assessmentMetadataName, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getInSubscription(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("assessmentMetadataName") String assessmentMetadataName, + Mono> listBySubscription( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @Get("/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createInSubscription( - @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("assessmentMetadataName") String assessmentMetadataName, - @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") SecurityAssessmentMetadataResponseInner assessmentMetadata, - @HeaderParam("Accept") String accept, Context context); + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @Get("/providers/Microsoft.Security/assessmentMetadata") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> deleteInSubscription(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("assessmentMetadataName") String assessmentMetadataName, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + Mono> list(@HostParam("endpoint") 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, @HostParam("$host") String endpoint, + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return metadata information on an assessment type in a specific subscription along with {@link Response} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> + getInSubscriptionWithResponseAsync(String assessmentMetadataName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono.error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + final String apiVersion = "2025-05-04"; 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(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)) + return FluxUtil + .withContext(context -> service.getInSubscription(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), assessmentMetadataName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return metadata information on an assessment type in a specific subscription along with {@link Response} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> + getInSubscriptionWithResponseAsync(String assessmentMetadataName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + return Mono.error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + final String apiVersion = "2025-05-04"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.getInSubscription(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + assessmentMetadataName, accept, context); } /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedFlux}. + * @return metadata information on an assessment type in a specific subscription on successful completion of + * {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getInSubscriptionAsync(String assessmentMetadataName) { + return getInSubscriptionWithResponseAsync(assessmentMetadataName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Get metadata information on all assessment types. - * - * @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 metadata information on all assessment types as paginated response with {@link PagedIterable}. + * @return metadata information on an assessment type in a specific subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + getInSubscriptionWithResponse(String assessmentMetadataName, Context context) { + return getInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); } /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * - * @param context The context to associate with this operation. + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedIterable}. + * @return metadata information on an assessment type in a specific subscription. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityAssessmentMetadataResponseInner getInSubscription(String assessmentMetadataName) { + return getInSubscriptionWithResponse(assessmentMetadataName, Context.NONE).getValue(); } /** - * Get metadata information on an assessment type. + * Create metadata information on an assessment type in a specific subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 metadata information on an assessment type along with {@link Response} on successful completion of + * @return security assessment metadata response along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getWithResponseAsync(String assessmentMetadataName) { + private Mono> createInSubscriptionWithResponseAsync( + String assessmentMetadataName, SecurityAssessmentMetadataResponseInner assessmentMetadata) { 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 (assessmentMetadataName == null) { return Mono.error( new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; + if (assessmentMetadata == null) { + return Mono + .error(new IllegalArgumentException("Parameter assessmentMetadata is required and cannot be null.")); + } else { + assessmentMetadata.validate(); + } + final String apiVersion = "2025-05-04"; + final String contentType = "application/json"; final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.get(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context)) + return FluxUtil.withContext(context -> service.createInSubscription(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), assessmentMetadataName, contentType, accept, assessmentMetadata, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get metadata information on an assessment type. + * Create metadata information on an assessment type in a specific subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. * @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 metadata information on an assessment type along with {@link Response} on successful completion of + * @return security assessment metadata response along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String assessmentMetadataName, - Context context) { + private Mono> createInSubscriptionWithResponseAsync( + String assessmentMetadataName, SecurityAssessmentMetadataResponseInner assessmentMetadata, 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 (assessmentMetadataName == null) { return Mono.error( new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; + if (assessmentMetadata == null) { + return Mono + .error(new IllegalArgumentException("Parameter assessmentMetadata is required and cannot be null.")); + } else { + assessmentMetadata.validate(); + } + final String apiVersion = "2025-05-04"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context); + return service.createInSubscription(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + assessmentMetadataName, contentType, accept, assessmentMetadata, context); } /** - * Get metadata information on an assessment type. + * Create metadata information on an assessment type in a specific subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 metadata information on an assessment type on successful completion of {@link Mono}. + * @return security assessment metadata response on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String assessmentMetadataName) { - return getWithResponseAsync(assessmentMetadataName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono createInSubscriptionAsync(String assessmentMetadataName, + SecurityAssessmentMetadataResponseInner assessmentMetadata) { + return createInSubscriptionWithResponseAsync(assessmentMetadataName, assessmentMetadata) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Get metadata information on an assessment type. + * Create metadata information on an assessment type in a specific subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. * @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 metadata information on an assessment type along with {@link Response}. + * @return security assessment metadata response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String assessmentMetadataName, - Context context) { - return getWithResponseAsync(assessmentMetadataName, context).block(); + public Response createInSubscriptionWithResponse( + String assessmentMetadataName, SecurityAssessmentMetadataResponseInner assessmentMetadata, Context context) { + return createInSubscriptionWithResponseAsync(assessmentMetadataName, assessmentMetadata, context).block(); } /** - * Get metadata information on an assessment type. + * Create metadata information on an assessment type in a specific subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @param assessmentMetadata AssessmentMetadata object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 metadata information on an assessment type. + * @return security assessment metadata response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SecurityAssessmentMetadataResponseInner get(String assessmentMetadataName) { - return getWithResponse(assessmentMetadataName, Context.NONE).getValue(); + public SecurityAssessmentMetadataResponseInner createInSubscription(String assessmentMetadataName, + SecurityAssessmentMetadataResponseInner assessmentMetadata) { + return createInSubscriptionWithResponse(assessmentMetadataName, assessmentMetadata, Context.NONE).getValue(); } /** - * Get metadata information on all assessment types in a specific subscription. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types in a specific subscription along with {@link PagedResponse} - * on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionSinglePageAsync() { + private Mono> deleteInSubscriptionWithResponseAsync(String assessmentMetadataName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -354,30 +397,30 @@ private Mono> listBySubsc return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; - final String accept = "application/json"; + if (assessmentMetadataName == null) { + return Mono.error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + final String apiVersion = "2025-05-04"; return FluxUtil - .withContext(context -> service.listBySubscription(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), accept, context)) - .>map( - res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.deleteInSubscription(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), assessmentMetadataName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get metadata information on all assessment types in a specific subscription. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types in a specific subscription along with {@link PagedResponse} - * on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listBySubscriptionSinglePageAsync(Context context) { + private Mono> deleteInSubscriptionWithResponseAsync(String assessmentMetadataName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -386,199 +429,191 @@ private Mono> listBySubsc return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2021-06-01"; - final String accept = "application/json"; + if (assessmentMetadataName == null) { + return Mono.error( + new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + final String apiVersion = "2025-05-04"; context = this.client.mergeContext(context); - return service - .listBySubscription(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.deleteInSubscription(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + assessmentMetadataName, context); } /** - * Get metadata information on all assessment types in a specific subscription. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types in a specific subscription as paginated response with - * {@link PagedFlux}. + * @return A {@link Mono} that completes when a successful response is received. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySubscriptionAsync() { - return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteInSubscriptionAsync(String assessmentMetadataName) { + return deleteInSubscriptionWithResponseAsync(assessmentMetadataName).flatMap(ignored -> Mono.empty()); } /** - * Get metadata information on all assessment types in a specific subscription. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types in a specific subscription as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySubscriptionAsync(Context context) { - return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); - } - - /** - * Get metadata information on all assessment types in a specific 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 metadata information on all assessment types in a specific subscription as paginated response with - * {@link PagedIterable}. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listBySubscription() { - return new PagedIterable<>(listBySubscriptionAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context) { + return deleteInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); } /** - * Get metadata information on all assessment types in a specific subscription. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * - * @param context The context to associate with this operation. + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types in a specific subscription as paginated response with - * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listBySubscription(Context context) { - return new PagedIterable<>(listBySubscriptionAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteInSubscription(String assessmentMetadataName) { + deleteInSubscriptionWithResponse(assessmentMetadataName, Context.NONE); } /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on all assessment types in a specific subscription. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription along with {@link Response} on - * successful completion of {@link Mono}. + * @return metadata information on all assessment types in a specific subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getInSubscriptionWithResponseAsync(String assessmentMetadataName) { + private Mono> listBySubscriptionSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (assessmentMetadataName == null) { - return Mono.error( - new IllegalArgumentException("Parameter assessmentMetadataName 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 = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getInSubscription(this.client.getEndpoint(), apiVersion, - assessmentMetadataName, this.client.getSubscriptionId(), accept, context)) + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), 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 metadata information on an assessment type in a specific subscription. + * Get metadata information on all assessment types in a specific subscription. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription along with {@link Response} on - * successful completion of {@link Mono}. + * @return metadata information on all assessment types in a specific subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getInSubscriptionWithResponseAsync(String assessmentMetadataName, Context context) { + private Mono> + listBySubscriptionSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (assessmentMetadataName == null) { - return Mono.error( - new IllegalArgumentException("Parameter assessmentMetadataName 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 = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.getInSubscription(this.client.getEndpoint(), apiVersion, assessmentMetadataName, - this.client.getSubscriptionId(), accept, context); + return service + .listBySubscription(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get metadata information on all assessment types in a specific 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 metadata information on all assessment types in a specific subscription as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on all assessment types in a specific subscription. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription on successful completion of - * {@link Mono}. + * @return metadata information on all assessment types in a specific subscription as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getInSubscriptionAsync(String assessmentMetadataName) { - return getInSubscriptionWithResponseAsync(assessmentMetadataName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); } /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on all assessment types in a specific subscription. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription along with {@link Response}. + * @return metadata information on all assessment types in a specific subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response - getInSubscriptionWithResponse(String assessmentMetadataName, Context context) { - return getInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription() { + return new PagedIterable<>(listBySubscriptionAsync()); } /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on all assessment types in a specific subscription. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription. + * @return metadata information on all assessment types in a specific subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SecurityAssessmentMetadataResponseInner getInSubscription(String assessmentMetadataName) { - return getInSubscriptionWithResponse(assessmentMetadataName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(Context context) { + return new PagedIterable<>(listBySubscriptionAsync(context)); } /** - * Create metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. - * @param assessmentMetadata AssessmentMetadata object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 assessment metadata response along with {@link Response} on successful completion of + * @return metadata information on an assessment type along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createInSubscriptionWithResponseAsync( - String assessmentMetadataName, SecurityAssessmentMetadataResponseInner assessmentMetadata) { + private Mono> + getWithResponseAsync(String assessmentMetadataName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -587,39 +622,28 @@ private Mono> createInSubscrip return Mono.error( new IllegalArgumentException("Parameter assessmentMetadataName 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 (assessmentMetadata == null) { - return Mono - .error(new IllegalArgumentException("Parameter assessmentMetadata is required and cannot be null.")); - } else { - assessmentMetadata.validate(); - } - final String apiVersion = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.createInSubscription(this.client.getEndpoint(), apiVersion, - assessmentMetadataName, this.client.getSubscriptionId(), assessmentMetadata, accept, context)) + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Create metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. - * @param assessmentMetadata AssessmentMetadata object. * @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 assessment metadata response along with {@link Response} on successful completion of + * @return metadata information on an assessment type along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createInSubscriptionWithResponseAsync( - String assessmentMetadataName, SecurityAssessmentMetadataResponseInner assessmentMetadata, Context context) { + private Mono> getWithResponseAsync(String assessmentMetadataName, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -628,180 +652,154 @@ private Mono> createInSubscrip return Mono.error( new IllegalArgumentException("Parameter assessmentMetadataName 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 (assessmentMetadata == null) { - return Mono - .error(new IllegalArgumentException("Parameter assessmentMetadata is required and cannot be null.")); - } else { - assessmentMetadata.validate(); - } - final String apiVersion = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createInSubscription(this.client.getEndpoint(), apiVersion, assessmentMetadataName, - this.client.getSubscriptionId(), assessmentMetadata, accept, context); + return service.get(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context); } /** - * Create metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. - * @param assessmentMetadata AssessmentMetadata object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 assessment metadata response on successful completion of {@link Mono}. + * @return metadata information on an assessment type on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createInSubscriptionAsync(String assessmentMetadataName, - SecurityAssessmentMetadataResponseInner assessmentMetadata) { - return createInSubscriptionWithResponseAsync(assessmentMetadataName, assessmentMetadata) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono getAsync(String assessmentMetadataName) { + return getWithResponseAsync(assessmentMetadataName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Create metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. - * @param assessmentMetadata AssessmentMetadata object. * @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 assessment metadata response along with {@link Response}. + * @return metadata information on an assessment type along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createInSubscriptionWithResponse( - String assessmentMetadataName, SecurityAssessmentMetadataResponseInner assessmentMetadata, Context context) { - return createInSubscriptionWithResponseAsync(assessmentMetadataName, assessmentMetadata, context).block(); + public Response getWithResponse(String assessmentMetadataName, + Context context) { + return getWithResponseAsync(assessmentMetadataName, context).block(); } /** - * Create metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. - * @param assessmentMetadata AssessmentMetadata object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 assessment metadata response. + * @return metadata information on an assessment type. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SecurityAssessmentMetadataResponseInner createInSubscription(String assessmentMetadataName, - SecurityAssessmentMetadataResponseInner assessmentMetadata) { - return createInSubscriptionWithResponse(assessmentMetadataName, assessmentMetadata, Context.NONE).getValue(); + public SecurityAssessmentMetadataResponseInner get(String assessmentMetadataName) { + return getWithResponse(assessmentMetadataName, Context.NONE).getValue(); } /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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}. + * @return metadata information on all assessment types along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteInSubscriptionWithResponseAsync(String assessmentMetadataName) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (assessmentMetadataName == null) { - return Mono.error( - new IllegalArgumentException("Parameter assessmentMetadataName 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 = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.deleteInSubscription(this.client.getEndpoint(), apiVersion, - assessmentMetadataName, this.client.getSubscriptionId(), accept, context)) + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), 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())); } /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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}. + * @return metadata information on all assessment types along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteInSubscriptionWithResponseAsync(String assessmentMetadataName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (assessmentMetadataName == null) { - return Mono.error( - new IllegalArgumentException("Parameter assessmentMetadataName 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 = "2021-06-01"; + final String apiVersion = "2025-05-04"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.deleteInSubscription(this.client.getEndpoint(), apiVersion, assessmentMetadataName, - this.client.getSubscriptionId(), accept, context); + return service.list(this.client.getEndpoint(), apiVersion, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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. + * @return metadata information on all assessment types as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteInSubscriptionAsync(String assessmentMetadataName) { - return deleteInSubscriptionWithResponseAsync(assessmentMetadataName).flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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}. + * @return metadata information on all assessment types as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context) { - return deleteInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type. + * @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 metadata information on all assessment types as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get metadata information on all assessment types. + * + * @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 metadata information on all assessment types as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteInSubscription(String assessmentMetadataName) { - deleteInSubscriptionWithResponse(assessmentMetadataName, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** @@ -811,11 +809,12 @@ public void deleteInSubscription(String assessmentMetadataName) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security assessment metadata along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return metadata information on all assessment types in a specific subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> + listBySubscriptionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -824,7 +823,9 @@ private Mono> listNextSin 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)) + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) .>map( res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) @@ -839,12 +840,12 @@ private Mono> listNextSin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security assessment metadata along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return metadata information on all assessment types in a specific subscription along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private Mono> + listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -854,7 +855,7 @@ private Mono> listNextSin } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -866,12 +867,11 @@ private Mono> listNextSin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security assessment metadata along with {@link PagedResponse} on successful completion of + * @return metadata information on all assessment types along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listBySubscriptionNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -880,9 +880,7 @@ private Mono> listNextSin new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + 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)) @@ -897,12 +895,12 @@ private Mono> listNextSin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security assessment metadata along with {@link PagedResponse} on successful completion of + * @return metadata information on all assessment types along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -912,7 +910,7 @@ private Mono> listNextSin } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, 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/AssessmentsMetadatasImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasImpl.java index 6ddb28434bef..536739f58efa 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,32 +27,16 @@ public AssessmentsMetadatasImpl(AssessmentsMetadatasClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new SecurityAssessmentMetadataResponseImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new SecurityAssessmentMetadataResponseImpl(inner1, this.manager())); - } - - public Response getWithResponse(String assessmentMetadataName, + public Response getInSubscriptionWithResponse(String assessmentMetadataName, Context context) { Response inner - = this.serviceClient().getWithResponse(assessmentMetadataName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SecurityAssessmentMetadataResponseImpl(inner.getValue(), this.manager())); - } else { - return null; - } + = this.serviceClient().getInSubscriptionWithResponse(assessmentMetadataName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityAssessmentMetadataResponseImpl(inner.getValue(), this.manager())); } - public SecurityAssessmentMetadataResponse get(String assessmentMetadataName) { - SecurityAssessmentMetadataResponseInner inner = this.serviceClient().get(assessmentMetadataName); + public SecurityAssessmentMetadataResponse getInSubscription(String assessmentMetadataName) { + SecurityAssessmentMetadataResponseInner inner = this.serviceClient().getInSubscription(assessmentMetadataName); if (inner != null) { return new SecurityAssessmentMetadataResponseImpl(inner, this.manager()); } else { @@ -60,6 +44,14 @@ public SecurityAssessmentMetadataResponse get(String assessmentMetadataName) { } } + public Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context) { + return this.serviceClient().deleteInSubscriptionWithResponse(assessmentMetadataName, context); + } + + public void deleteInSubscription(String assessmentMetadataName) { + this.serviceClient().deleteInSubscription(assessmentMetadataName); + } + public PagedIterable listBySubscription() { PagedIterable inner = this.serviceClient().listBySubscription(); return ResourceManagerUtils.mapPage(inner, @@ -72,20 +64,16 @@ public PagedIterable listBySubscription(Cont inner1 -> new SecurityAssessmentMetadataResponseImpl(inner1, this.manager())); } - public Response getInSubscriptionWithResponse(String assessmentMetadataName, + public Response getWithResponse(String assessmentMetadataName, Context context) { Response inner - = this.serviceClient().getInSubscriptionWithResponse(assessmentMetadataName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SecurityAssessmentMetadataResponseImpl(inner.getValue(), this.manager())); - } else { - return null; - } + = this.serviceClient().getWithResponse(assessmentMetadataName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityAssessmentMetadataResponseImpl(inner.getValue(), this.manager())); } - public SecurityAssessmentMetadataResponse getInSubscription(String assessmentMetadataName) { - SecurityAssessmentMetadataResponseInner inner = this.serviceClient().getInSubscription(assessmentMetadataName); + public SecurityAssessmentMetadataResponse get(String assessmentMetadataName) { + SecurityAssessmentMetadataResponseInner inner = this.serviceClient().get(assessmentMetadataName); if (inner != null) { return new SecurityAssessmentMetadataResponseImpl(inner, this.manager()); } else { @@ -93,12 +81,16 @@ public SecurityAssessmentMetadataResponse getInSubscription(String assessmentMet } } - public Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context) { - return this.serviceClient().deleteInSubscriptionWithResponse(assessmentMetadataName, context); + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SecurityAssessmentMetadataResponseImpl(inner1, this.manager())); } - public void deleteInSubscription(String assessmentMetadataName) { - this.serviceClient().deleteInSubscription(assessmentMetadataName); + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SecurityAssessmentMetadataResponseImpl(inner1, this.manager())); } public SecurityAssessmentMetadataResponse getInSubscriptionById(String id) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentImpl.java new file mode 100644 index 000000000000..2736eacf5677 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentImpl.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AssignmentInner; +import com.azure.resourcemanager.security.models.AssignedComponentItem; +import com.azure.resourcemanager.security.models.AssignedStandardItem; +import com.azure.resourcemanager.security.models.Assignment; +import com.azure.resourcemanager.security.models.AssignmentPropertiesAdditionalData; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class AssignmentImpl implements Assignment, Assignment.Definition, Assignment.Update { + private AssignmentInner 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 Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public AssignedStandardItem assignedStandard() { + return this.innerModel().assignedStandard(); + } + + public AssignedComponentItem assignedComponent() { + return this.innerModel().assignedComponent(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public String effect() { + return this.innerModel().effect(); + } + + public OffsetDateTime expiresOn() { + return this.innerModel().expiresOn(); + } + + public AssignmentPropertiesAdditionalData additionalData() { + return this.innerModel().additionalData(); + } + + public Object metadata() { + return this.innerModel().metadata(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String assignmentId; + + public AssignmentImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Assignment create() { + this.innerObject = serviceManager.serviceClient() + .getAssignments() + .createOrUpdateWithResponse(resourceGroupName, assignmentId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Assignment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAssignments() + .createOrUpdateWithResponse(resourceGroupName, assignmentId, this.innerModel(), context) + .getValue(); + return this; + } + + AssignmentImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AssignmentInner(); + this.serviceManager = serviceManager; + this.assignmentId = name; + } + + public AssignmentImpl update() { + return this; + } + + public Assignment apply() { + this.innerObject = serviceManager.serviceClient() + .getAssignments() + .createOrUpdateWithResponse(resourceGroupName, assignmentId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Assignment apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAssignments() + .createOrUpdateWithResponse(resourceGroupName, assignmentId, this.innerModel(), context) + .getValue(); + return this; + } + + AssignmentImpl(AssignmentInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.assignmentId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "assignments"); + } + + public Assignment refresh() { + this.innerObject = serviceManager.serviceClient() + .getAssignments() + .getByResourceGroupWithResponse(resourceGroupName, assignmentId, Context.NONE) + .getValue(); + return this; + } + + public Assignment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAssignments() + .getByResourceGroupWithResponse(resourceGroupName, assignmentId, context) + .getValue(); + return this; + } + + public AssignmentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AssignmentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AssignmentImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public AssignmentImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public AssignmentImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public AssignmentImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public AssignmentImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public AssignmentImpl withAssignedStandard(AssignedStandardItem assignedStandard) { + this.innerModel().withAssignedStandard(assignedStandard); + return this; + } + + public AssignmentImpl withAssignedComponent(AssignedComponentItem assignedComponent) { + this.innerModel().withAssignedComponent(assignedComponent); + return this; + } + + public AssignmentImpl withScope(String scope) { + this.innerModel().withScope(scope); + return this; + } + + public AssignmentImpl withEffect(String effect) { + this.innerModel().withEffect(effect); + return this; + } + + public AssignmentImpl withExpiresOn(OffsetDateTime expiresOn) { + this.innerModel().withExpiresOn(expiresOn); + return this; + } + + public AssignmentImpl withAdditionalData(AssignmentPropertiesAdditionalData additionalData) { + this.innerModel().withAdditionalData(additionalData); + return this; + } + + public AssignmentImpl withMetadata(Object metadata) { + this.innerModel().withMetadata(metadata); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentsClientImpl.java new file mode 100644 index 000000000000..c8948deb7942 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentsClientImpl.java @@ -0,0 +1,860 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.AssignmentInner; +import com.azure.resourcemanager.security.implementation.models.AssignmentList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AssignmentsClient. + */ +public final class AssignmentsClientImpl implements AssignmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AssignmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AssignmentsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(AssignmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAssignments to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAssignments") + public interface AssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments/{assignmentId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("assignmentId") String assignmentId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments/{assignmentId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("assignmentId") String assignmentId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AssignmentInner assignment, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments/{assignmentId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("assignmentId") String assignmentId, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 specific standard assignment for the requested scope by resourceId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String assignmentId) { + 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 (assignmentId == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, assignmentId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 a specific standard assignment for the requested scope by resourceId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String assignmentId, 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 (assignmentId == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, assignmentId, accept, context); + } + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 specific standard assignment for the requested scope by resourceId on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String assignmentId) { + return getByResourceGroupWithResponseAsync(resourceGroupName, assignmentId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 a specific standard assignment for the requested scope by resourceId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String assignmentId, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, assignmentId, context).block(); + } + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 specific standard assignment for the requested scope by resourceId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AssignmentInner getByResourceGroup(String resourceGroupName, String assignmentId) { + return getByResourceGroupWithResponse(resourceGroupName, assignmentId, Context.NONE).getValue(); + } + + /** + * Create a security assignment on the given scope. Will create/update the required standard assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security assignment key - unique key for the standard assignment. + * @param assignment 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> createOrUpdateWithResponseAsync(String resourceGroupName, + String assignmentId, AssignmentInner assignment) { + 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 (assignmentId == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentId is required and cannot be null.")); + } + if (assignment == null) { + return Mono.error(new IllegalArgumentException("Parameter assignment is required and cannot be null.")); + } else { + assignment.validate(); + } + final String apiVersion = "2021-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, assignmentId, contentType, accept, assignment, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a security assignment on the given scope. Will create/update the required standard assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security assignment key - unique key for the standard assignment. + * @param assignment 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> createOrUpdateWithResponseAsync(String resourceGroupName, + String assignmentId, AssignmentInner assignment, 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 (assignmentId == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentId is required and cannot be null.")); + } + if (assignment == null) { + return Mono.error(new IllegalArgumentException("Parameter assignment is required and cannot be null.")); + } else { + assignment.validate(); + } + final String apiVersion = "2021-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, assignmentId, contentType, accept, assignment, context); + } + + /** + * Create a security assignment on the given scope. Will create/update the required standard assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security assignment key - unique key for the standard assignment. + * @param assignment 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 createOrUpdateAsync(String resourceGroupName, String assignmentId, + AssignmentInner assignment) { + return createOrUpdateWithResponseAsync(resourceGroupName, assignmentId, assignment) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a security assignment on the given scope. Will create/update the required standard assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security assignment key - unique key for the standard assignment. + * @param assignment 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 createOrUpdateWithResponse(String resourceGroupName, String assignmentId, + AssignmentInner assignment, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, assignmentId, assignment, context).block(); + } + + /** + * Create a security assignment on the given scope. Will create/update the required standard assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security assignment key - unique key for the standard assignment. + * @param assignment 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 AssignmentInner createOrUpdate(String resourceGroupName, String assignmentId, AssignmentInner assignment) { + return createOrUpdateWithResponse(resourceGroupName, assignmentId, assignment, Context.NONE).getValue(); + } + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 resourceGroupName, String assignmentId) { + 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 (assignmentId == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, assignmentId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 resourceGroupName, String assignmentId, + 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 (assignmentId == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + assignmentId, context); + } + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 resourceGroupName, String assignmentId) { + return deleteWithResponseAsync(resourceGroupName, assignmentId).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 resourceGroupName, String assignmentId, Context context) { + return deleteWithResponseAsync(resourceGroupName, assignmentId, context).block(); + } + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 resourceGroupName, String assignmentId) { + deleteWithResponse(resourceGroupName, assignmentId, Context.NONE); + } + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 standardAssignments available for scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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 standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standardAssignments available for scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, 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 standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a list of all relevant standardAssignments over a subscription level scope. + * + * @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 standardAssignments over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 standardAssignments over a subscription level 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 a list of all relevant standardAssignments over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2021-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) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get a list of all relevant standardAssignments over a subscription level scope. + * + * @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 standardAssignments over a subscription level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant standardAssignments over a subscription level 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 a list of all relevant standardAssignments over a subscription level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant standardAssignments over a subscription level scope. + * + * @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 standardAssignments over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all relevant standardAssignments over a subscription level 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 a list of all relevant standardAssignments over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 a list of all relevant standardAssignments available for scope 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 all relevant standardAssignments available for scope 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)); + } + + /** + * 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 all relevant standardAssignments over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 all relevant standardAssignments over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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/AssignmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentsImpl.java new file mode 100644 index 000000000000..cffe7e601502 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssignmentsImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.AssignmentInner; +import com.azure.resourcemanager.security.models.Assignment; +import com.azure.resourcemanager.security.models.Assignments; + +public final class AssignmentsImpl implements Assignments { + private static final ClientLogger LOGGER = new ClientLogger(AssignmentsImpl.class); + + private final AssignmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AssignmentsImpl(AssignmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String assignmentId, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, assignmentId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AssignmentImpl(inner.getValue(), this.manager())); + } + + public Assignment getByResourceGroup(String resourceGroupName, String assignmentId) { + AssignmentInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, assignmentId); + if (inner != null) { + return new AssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String assignmentId, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, assignmentId, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String assignmentId) { + this.serviceClient().delete(resourceGroupName, assignmentId); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssignmentImpl(inner1, this.manager())); + } + + public Assignment 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 assignmentId = ResourceManagerUtils.getValueFromIdByName(id, "assignments"); + if (assignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assignments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, assignmentId, 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 assignmentId = ResourceManagerUtils.getValueFromIdByName(id, "assignments"); + if (assignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assignments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, assignmentId, 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 assignmentId = ResourceManagerUtils.getValueFromIdByName(id, "assignments"); + if (assignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assignments'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, assignmentId, Context.NONE); + } + + public Response 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 assignmentId = ResourceManagerUtils.getValueFromIdByName(id, "assignments"); + if (assignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assignments'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, assignmentId, context); + } + + private AssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AssignmentImpl define(String name) { + return new AssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingImpl.java new file mode 100644 index 000000000000..942b0193ec03 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutoProvisioningSettingInner; +import com.azure.resourcemanager.security.models.AutoProvision; +import com.azure.resourcemanager.security.models.AutoProvisioningSetting; + +public final class AutoProvisioningSettingImpl implements AutoProvisioningSetting, AutoProvisioningSetting.Definition { + private AutoProvisioningSettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AutoProvisioningSettingImpl(AutoProvisioningSettingInner 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 AutoProvision autoProvision() { + return this.innerModel().autoProvision(); + } + + public AutoProvisioningSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String settingName; + + public AutoProvisioningSetting create() { + this.innerObject = serviceManager.serviceClient() + .getAutoProvisioningSettings() + .createWithResponse(settingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AutoProvisioningSetting create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAutoProvisioningSettings() + .createWithResponse(settingName, this.innerModel(), context) + .getValue(); + return this; + } + + AutoProvisioningSettingImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AutoProvisioningSettingInner(); + this.serviceManager = serviceManager; + this.settingName = name; + } + + public AutoProvisioningSetting refresh() { + this.innerObject = serviceManager.serviceClient() + .getAutoProvisioningSettings() + .getWithResponse(settingName, Context.NONE) + .getValue(); + return this; + } + + public AutoProvisioningSetting refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAutoProvisioningSettings() + .getWithResponse(settingName, context) + .getValue(); + return this; + } + + public AutoProvisioningSettingImpl withAutoProvision(AutoProvision autoProvision) { + this.innerModel().withAutoProvision(autoProvision); + return this; + } +} 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 new file mode 100644 index 000000000000..36b3ad7a7303 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.AutoProvisioningSettingsClient; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; +import com.azure.resourcemanager.security.implementation.models.AutoProvisioningSettingList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AutoProvisioningSettingsClient. + */ +public final class AutoProvisioningSettingsClientImpl implements AutoProvisioningSettingsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AutoProvisioningSettingsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AutoProvisioningSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AutoProvisioningSettingsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(AutoProvisioningSettingsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAutoProvisioningSettings to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAutoProvisioningSettings") + public interface AutoProvisioningSettingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") AutoProvisioningSettingInner setting, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 auto provisioning setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String settingName) { + 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 (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + settingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @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 auto provisioning setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String settingName, 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 (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, accept, + context); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 auto provisioning setting on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String settingName) { + return getWithResponseAsync(settingName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @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 auto provisioning setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String settingName, Context context) { + return getWithResponseAsync(settingName, context).block(); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoProvisioningSettingInner get(String settingName) { + return getWithResponse(settingName, Context.NONE).getValue(); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 auto provisioning setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String settingName, + AutoProvisioningSettingInner setting) { + 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 (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + return Mono.error(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), settingName, contentType, accept, setting, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @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 auto provisioning setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String settingName, + AutoProvisioningSettingInner setting, 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 (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + return Mono.error(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, + contentType, accept, setting, context); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 auto provisioning setting on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String settingName, AutoProvisioningSettingInner setting) { + return createWithResponseAsync(settingName, setting).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @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 auto provisioning setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String settingName, + AutoProvisioningSettingInner setting, Context context) { + return createWithResponseAsync(settingName, setting, context).block(); + } + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @param setting Auto provisioning setting key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 auto provisioning setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoProvisioningSettingInner create(String settingName, AutoProvisioningSettingInner setting) { + return createWithResponse(settingName, setting, Context.NONE).getValue(); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2017-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) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 list of all the auto provisioning settings response 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 all the auto provisioning settings response 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/AutoProvisioningSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsImpl.java new file mode 100644 index 000000000000..5e72cd217440 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutoProvisioningSettingsClient; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; +import com.azure.resourcemanager.security.models.AutoProvisioningSetting; +import com.azure.resourcemanager.security.models.AutoProvisioningSettings; + +public final class AutoProvisioningSettingsImpl implements AutoProvisioningSettings { + private static final ClientLogger LOGGER = new ClientLogger(AutoProvisioningSettingsImpl.class); + + private final AutoProvisioningSettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AutoProvisioningSettingsImpl(AutoProvisioningSettingsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String settingName, Context context) { + Response inner = this.serviceClient().getWithResponse(settingName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AutoProvisioningSettingImpl(inner.getValue(), this.manager())); + } + + public AutoProvisioningSetting get(String settingName) { + AutoProvisioningSettingInner inner = this.serviceClient().get(settingName); + if (inner != null) { + return new AutoProvisioningSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AutoProvisioningSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AutoProvisioningSettingImpl(inner1, this.manager())); + } + + public AutoProvisioningSetting getById(String id) { + String settingName = ResourceManagerUtils.getValueFromIdByName(id, "autoProvisioningSettings"); + if (settingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'autoProvisioningSettings'.", id))); + } + return this.getWithResponse(settingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String settingName = ResourceManagerUtils.getValueFromIdByName(id, "autoProvisioningSettings"); + if (settingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'autoProvisioningSettings'.", id))); + } + return this.getWithResponse(settingName, context); + } + + private AutoProvisioningSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AutoProvisioningSettingImpl define(String name) { + return new AutoProvisioningSettingImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationImpl.java new file mode 100644 index 000000000000..67e912488df0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationImpl.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.models.Automation; +import com.azure.resourcemanager.security.models.AutomationAction; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.azure.resourcemanager.security.models.AutomationUpdateModel; +import com.azure.resourcemanager.security.models.AutomationValidationStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class AutomationImpl implements Automation, Automation.Definition, Automation.Update { + private AutomationInner 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 Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public List scopes() { + List inner = this.innerModel().scopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List sources() { + List inner = this.innerModel().sources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List actions() { + List inner = this.innerModel().actions(); + 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 String resourceGroupName() { + return resourceGroupName; + } + + public AutomationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String automationName; + + private AutomationUpdateModel updateAutomation; + + public AutomationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Automation create() { + this.innerObject = serviceManager.serviceClient() + .getAutomations() + .createOrUpdateWithResponse(resourceGroupName, automationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Automation create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAutomations() + .createOrUpdateWithResponse(resourceGroupName, automationName, this.innerModel(), context) + .getValue(); + return this; + } + + AutomationImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AutomationInner(); + this.serviceManager = serviceManager; + this.automationName = name; + } + + public AutomationImpl update() { + this.updateAutomation = new AutomationUpdateModel(); + return this; + } + + public Automation apply() { + this.innerObject = serviceManager.serviceClient() + .getAutomations() + .updateWithResponse(resourceGroupName, automationName, updateAutomation, Context.NONE) + .getValue(); + return this; + } + + public Automation apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAutomations() + .updateWithResponse(resourceGroupName, automationName, updateAutomation, context) + .getValue(); + return this; + } + + AutomationImpl(AutomationInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.automationName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "automations"); + } + + public Automation refresh() { + this.innerObject = serviceManager.serviceClient() + .getAutomations() + .getByResourceGroupWithResponse(resourceGroupName, automationName, Context.NONE) + .getValue(); + return this; + } + + public Automation refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAutomations() + .getByResourceGroupWithResponse(resourceGroupName, automationName, context) + .getValue(); + return this; + } + + public Response validateWithResponse(AutomationInner automation, Context context) { + return serviceManager.automations() + .validateWithResponse(resourceGroupName, automationName, automation, context); + } + + public AutomationValidationStatus validate(AutomationInner automation) { + return serviceManager.automations().validate(resourceGroupName, automationName, automation); + } + + public AutomationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AutomationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AutomationImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateAutomation.withTags(tags); + return this; + } + } + + public AutomationImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public AutomationImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public AutomationImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateAutomation.withDescription(description); + return this; + } + } + + public AutomationImpl withIsEnabled(Boolean isEnabled) { + if (isInCreateMode()) { + this.innerModel().withIsEnabled(isEnabled); + return this; + } else { + this.updateAutomation.withIsEnabled(isEnabled); + return this; + } + } + + public AutomationImpl withScopes(List scopes) { + if (isInCreateMode()) { + this.innerModel().withScopes(scopes); + return this; + } else { + this.updateAutomation.withScopes(scopes); + return this; + } + } + + public AutomationImpl withSources(List sources) { + if (isInCreateMode()) { + this.innerModel().withSources(sources); + return this; + } else { + this.updateAutomation.withSources(sources); + return this; + } + } + + public AutomationImpl withActions(List actions) { + if (isInCreateMode()) { + this.innerModel().withActions(actions); + return this; + } else { + this.updateAutomation.withActions(actions); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationValidationStatusImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationValidationStatusImpl.java new file mode 100644 index 000000000000..aae13a4b156c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationValidationStatusImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; +import com.azure.resourcemanager.security.models.AutomationValidationStatus; + +public final class AutomationValidationStatusImpl implements AutomationValidationStatus { + private AutomationValidationStatusInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AutomationValidationStatusImpl(AutomationValidationStatusInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isValid() { + return this.innerModel().isValid(); + } + + public String message() { + return this.innerModel().message(); + } + + public AutomationValidationStatusInner 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/AutomationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java new file mode 100644 index 000000000000..2131279ec2e2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java @@ -0,0 +1,1176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.Post; +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.AutomationsClient; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; +import com.azure.resourcemanager.security.implementation.models.AutomationList; +import com.azure.resourcemanager.security.models.AutomationUpdateModel; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AutomationsClient. + */ +public final class AutomationsClientImpl implements AutomationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AutomationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AutomationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AutomationsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(AutomationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAutomations to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAutomations") + public interface AutomationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") AutomationInner automation, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") AutomationUpdateModel automation, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") AutomationInner automation, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String automationName) { + 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, automationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String automationName, 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, accept, context); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String automationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, automationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String automationName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, automationName, context).block(); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutomationInner getByResourceGroup(String resourceGroupName, String automationName) { + return getByResourceGroupWithResponse(resourceGroupName, automationName, Context.NONE).getValue(); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String automationName, AutomationInner automation) { + 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, automationName, contentType, accept, automation, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String automationName, AutomationInner automation, 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, contentType, accept, automation, context); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String automationName, + AutomationInner automation) { + return createOrUpdateWithResponseAsync(resourceGroupName, automationName, automation) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String automationName, + AutomationInner automation, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, automationName, automation, context).block(); + } + + /** + * Creates or updates a security automation. If a security automation is already created and a subsequent request is + * issued for the same automation id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutomationInner createOrUpdate(String resourceGroupName, String automationName, AutomationInner automation) { + return createOrUpdateWithResponse(resourceGroupName, automationName, automation, Context.NONE).getValue(); + } + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The update model of security automation 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 the security automation resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String automationName, + AutomationUpdateModel automation) { + 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, contentType, accept, automation, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The update model of security automation 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 the security automation resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String automationName, + AutomationUpdateModel automation, 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + automationName, contentType, accept, automation, context); + } + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The update model of security automation 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 the security automation resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String automationName, + AutomationUpdateModel automation) { + return updateWithResponseAsync(resourceGroupName, automationName, automation) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The update model of security automation 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 the security automation resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String automationName, + AutomationUpdateModel automation, Context context) { + return updateWithResponseAsync(resourceGroupName, automationName, automation, context).block(); + } + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The update model of security automation 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 the security automation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutomationInner update(String resourceGroupName, String automationName, AutomationUpdateModel automation) { + return updateWithResponse(resourceGroupName, automationName, automation, Context.NONE).getValue(); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String automationName) { + 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, automationName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String automationName, + 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + automationName, context); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String automationName) { + return deleteWithResponseAsync(resourceGroupName, automationName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String automationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, automationName, context).block(); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String automationName) { + deleteWithResponse(resourceGroupName, automationName, Context.NONE); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security automations response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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())); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security automations response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security automations response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security automations response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified 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 list of security automations response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2023-12-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @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 security automations response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2023-12-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified 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 list of security automations response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @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 security automations response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified 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 list of security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync(String resourceGroupName, + String automationName, AutomationInner automation) { + 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.validate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, contentType, accept, automation, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync(String resourceGroupName, + String automationName, AutomationInner automation, 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 (automationName == null) { + return Mono.error(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + return Mono.error(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.validate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, contentType, accept, automation, context); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync(String resourceGroupName, String automationName, + AutomationInner automation) { + return validateWithResponseAsync(resourceGroupName, automationName, automation) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateWithResponse(String resourceGroupName, + String automationName, AutomationInner automation, Context context) { + return validateWithResponseAsync(resourceGroupName, automationName, automation, context).block(); + } + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutomationValidationStatusInner validate(String resourceGroupName, String automationName, + AutomationInner automation) { + return validateWithResponse(resourceGroupName, automationName, automation, 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 security automations response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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 security automations response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * 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 security automations response 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 security automations response 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/AutomationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java new file mode 100644 index 000000000000..a64479ac260c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutomationsClient; +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.AutomationValidationStatus; +import com.azure.resourcemanager.security.models.Automations; + +public final class AutomationsImpl implements Automations { + private static final ClientLogger LOGGER = new ClientLogger(AutomationsImpl.class); + + private final AutomationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AutomationsImpl(AutomationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String automationName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, automationName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AutomationImpl(inner.getValue(), this.manager())); + } + + public Automation getByResourceGroup(String resourceGroupName, String automationName) { + AutomationInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, automationName); + if (inner != null) { + return new AutomationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String automationName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, automationName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String automationName) { + this.serviceClient().delete(resourceGroupName, automationName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AutomationImpl(inner1, this.manager())); + } + + public Response validateWithResponse(String resourceGroupName, String automationName, + AutomationInner automation, Context context) { + Response inner + = this.serviceClient().validateWithResponse(resourceGroupName, automationName, automation, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AutomationValidationStatusImpl(inner.getValue(), this.manager())); + } + + public AutomationValidationStatus validate(String resourceGroupName, String automationName, + AutomationInner automation) { + AutomationValidationStatusInner inner + = this.serviceClient().validate(resourceGroupName, automationName, automation); + if (inner != null) { + return new AutomationValidationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Automation 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 automationName = ResourceManagerUtils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, automationName, 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 automationName = ResourceManagerUtils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, automationName, 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 automationName = ResourceManagerUtils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, automationName, Context.NONE); + } + + public Response 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 automationName = ResourceManagerUtils.getValueFromIdByName(id, "automations"); + if (automationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'automations'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, automationName, context); + } + + private AutomationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AutomationImpl define(String name) { + return new AutomationImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgImpl.java new file mode 100644 index 000000000000..8730205750ea --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsOrgInner; +import com.azure.resourcemanager.security.models.AzureDevOpsOrg; +import com.azure.resourcemanager.security.models.AzureDevOpsOrgProperties; + +public final class AzureDevOpsOrgImpl implements AzureDevOpsOrg, AzureDevOpsOrg.Definition, AzureDevOpsOrg.Update { + private AzureDevOpsOrgInner 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 AzureDevOpsOrgProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AzureDevOpsOrgInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String securityConnectorName; + + private String orgName; + + public AzureDevOpsOrgImpl withExistingSecurityConnector(String resourceGroupName, String securityConnectorName) { + this.resourceGroupName = resourceGroupName; + this.securityConnectorName = securityConnectorName; + return this; + } + + public AzureDevOpsOrg create() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsOrgs() + .createOrUpdate(resourceGroupName, securityConnectorName, orgName, this.innerModel(), Context.NONE); + return this; + } + + public AzureDevOpsOrg create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsOrgs() + .createOrUpdate(resourceGroupName, securityConnectorName, orgName, this.innerModel(), context); + return this; + } + + AzureDevOpsOrgImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AzureDevOpsOrgInner(); + this.serviceManager = serviceManager; + this.orgName = name; + } + + public AzureDevOpsOrgImpl update() { + return this; + } + + public AzureDevOpsOrg apply() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsOrgs() + .update(resourceGroupName, securityConnectorName, orgName, this.innerModel(), Context.NONE); + return this; + } + + public AzureDevOpsOrg apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsOrgs() + .update(resourceGroupName, securityConnectorName, orgName, this.innerModel(), context); + return this; + } + + AzureDevOpsOrgImpl(AzureDevOpsOrgInner 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.orgName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "azureDevOpsOrgs"); + } + + public AzureDevOpsOrg refresh() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsOrgs() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, Context.NONE) + .getValue(); + return this; + } + + public AzureDevOpsOrg refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsOrgs() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, context) + .getValue(); + return this; + } + + public AzureDevOpsOrgImpl withProperties(AzureDevOpsOrgProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgListResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgListResponseImpl.java new file mode 100644 index 000000000000..e980eb0390d7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgListResponseImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgInner; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgListResponseInner; +import com.azure.resourcemanager.security.models.AzureDevOpsOrg; +import com.azure.resourcemanager.security.models.AzureDevOpsOrgListResponse; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class AzureDevOpsOrgListResponseImpl implements AzureDevOpsOrgListResponse { + private AzureDevOpsOrgListResponseInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + AzureDevOpsOrgListResponseImpl(AzureDevOpsOrgListResponseInner 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 AzureDevOpsOrgImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public AzureDevOpsOrgListResponseInner 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/AzureDevOpsOrgsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsClientImpl.java new file mode 100644 index 000000000000..aa01a6d8d8fc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsClientImpl.java @@ -0,0 +1,1108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.Patch; +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; +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.AzureDevOpsOrgsClient; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgInner; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgListResponseInner; +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 AzureDevOpsOrgsClient. + */ +public final class AzureDevOpsOrgsClientImpl implements AzureDevOpsOrgsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AzureDevOpsOrgsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AzureDevOpsOrgsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureDevOpsOrgsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(AzureDevOpsOrgsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAzureDevOpsOrgs to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAzureDevOpsOrgs") + public interface AzureDevOpsOrgsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureDevOpsOrgInner azureDevOpsOrg, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureDevOpsOrgInner azureDevOpsOrg, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableAzureDevOpsOrgs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAvailable(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, accept, context); + } + + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, String orgName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, orgName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, orgName, context).block(); + } + + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsOrgInner get(String resourceGroupName, String securityConnectorName, String orgName) { + return getWithResponse(resourceGroupName, securityConnectorName, orgName, Context.NONE).getValue(); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + return Mono.error(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, orgName, contentType, accept, + azureDevOpsOrg, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + return Mono.error(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, contentType, accept, azureDevOpsOrg, context); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsOrgInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + AzureDevOpsOrgInner.class, AzureDevOpsOrgInner.class, this.client.getContext()); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsOrgInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + securityConnectorName, orgName, azureDevOpsOrg, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + AzureDevOpsOrgInner.class, AzureDevOpsOrgInner.class, context); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsOrgInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + return this.beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg) + .getSyncPoller(); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsOrgInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, + Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context) + .getSyncPoller(); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsOrgInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg).block(); + } + + /** + * Creates or updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsOrgInner createOrUpdate(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context).block(); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + return Mono.error(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, contentType, accept, azureDevOpsOrg, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + return Mono.error(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, contentType, accept, azureDevOpsOrg, context); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsOrgInner> beginUpdateAsync(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + AzureDevOpsOrgInner.class, AzureDevOpsOrgInner.class, this.client.getContext()); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsOrgInner> beginUpdateAsync(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + AzureDevOpsOrgInner.class, AzureDevOpsOrgInner.class, context); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsOrgInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + return this.beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg).getSyncPoller(); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsOrgInner> beginUpdate(String resourceGroupName, + String securityConnectorName, String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + return this.beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context) + .getSyncPoller(); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsOrgInner update(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg) { + return updateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg).block(); + } + + /** + * Updates monitored Azure DevOps organization details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param azureDevOpsOrg The Azure DevOps organization resource payload. + * @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 azure DevOps Organization resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsOrgInner update(String resourceGroupName, String securityConnectorName, String orgName, + AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + return updateAsync(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context).block(); + } + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, 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 Azure DevOps organizations onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 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, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * @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) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * @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) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName)); + } + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, context)); + } + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableWithResponseAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAvailable(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableWithResponseAsync(String resourceGroupName, + String securityConnectorName, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listAvailable(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, accept, context); + } + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAvailableAsync(String resourceGroupName, + String securityConnectorName) { + return listAvailableWithResponseAsync(resourceGroupName, securityConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + return listAvailableWithResponseAsync(resourceGroupName, securityConnectorName, context).block(); + } + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsOrgListResponseInner listAvailable(String resourceGroupName, String securityConnectorName) { + return listAvailableWithResponse(resourceGroupName, securityConnectorName, Context.NONE).getValue(); + } + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * 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())); + } + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * 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/AzureDevOpsOrgsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsImpl.java new file mode 100644 index 000000000000..a0b313a1a491 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsOrgsClient; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgInner; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgListResponseInner; +import com.azure.resourcemanager.security.models.AzureDevOpsOrg; +import com.azure.resourcemanager.security.models.AzureDevOpsOrgListResponse; +import com.azure.resourcemanager.security.models.AzureDevOpsOrgs; + +public final class AzureDevOpsOrgsImpl implements AzureDevOpsOrgs { + private static final ClientLogger LOGGER = new ClientLogger(AzureDevOpsOrgsImpl.class); + + private final AzureDevOpsOrgsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AzureDevOpsOrgsImpl(AzureDevOpsOrgsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, orgName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsOrgImpl(inner.getValue(), this.manager())); + } + + public AzureDevOpsOrg get(String resourceGroupName, String securityConnectorName, String orgName) { + AzureDevOpsOrgInner inner = this.serviceClient().get(resourceGroupName, securityConnectorName, orgName); + if (inner != null) { + return new AzureDevOpsOrgImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, securityConnectorName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AzureDevOpsOrgImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AzureDevOpsOrgImpl(inner1, this.manager())); + } + + public Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().listAvailableWithResponse(resourceGroupName, securityConnectorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsOrgListResponseImpl(inner.getValue(), this.manager())); + } + + public AzureDevOpsOrgListResponse listAvailable(String resourceGroupName, String securityConnectorName) { + AzureDevOpsOrgListResponseInner inner + = this.serviceClient().listAvailable(resourceGroupName, securityConnectorName); + if (inner != null) { + return new AzureDevOpsOrgListResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public AzureDevOpsOrg 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 orgName = ResourceManagerUtils.getValueFromIdByName(id, "azureDevOpsOrgs"); + if (orgName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'azureDevOpsOrgs'.", id))); + } + return this.getWithResponse(resourceGroupName, securityConnectorName, orgName, 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 orgName = ResourceManagerUtils.getValueFromIdByName(id, "azureDevOpsOrgs"); + if (orgName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'azureDevOpsOrgs'.", id))); + } + return this.getWithResponse(resourceGroupName, securityConnectorName, orgName, context); + } + + private AzureDevOpsOrgsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AzureDevOpsOrgImpl define(String name) { + return new AzureDevOpsOrgImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectImpl.java new file mode 100644 index 000000000000..4c313f4da2c6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsProjectInner; +import com.azure.resourcemanager.security.models.AzureDevOpsProject; +import com.azure.resourcemanager.security.models.AzureDevOpsProjectProperties; + +public final class AzureDevOpsProjectImpl + implements AzureDevOpsProject, AzureDevOpsProject.Definition, AzureDevOpsProject.Update { + private AzureDevOpsProjectInner 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 AzureDevOpsProjectProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AzureDevOpsProjectInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String securityConnectorName; + + private String orgName; + + private String projectName; + + public AzureDevOpsProjectImpl withExistingAzureDevOpsOrg(String resourceGroupName, String securityConnectorName, + String orgName) { + this.resourceGroupName = resourceGroupName; + this.securityConnectorName = securityConnectorName; + this.orgName = orgName; + return this; + } + + public AzureDevOpsProject create() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsProjects() + .createOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, this.innerModel(), + Context.NONE); + return this; + } + + public AzureDevOpsProject create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsProjects() + .createOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, this.innerModel(), context); + return this; + } + + AzureDevOpsProjectImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AzureDevOpsProjectInner(); + this.serviceManager = serviceManager; + this.projectName = name; + } + + public AzureDevOpsProjectImpl update() { + return this; + } + + public AzureDevOpsProject apply() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsProjects() + .update(resourceGroupName, securityConnectorName, orgName, projectName, this.innerModel(), Context.NONE); + return this; + } + + public AzureDevOpsProject apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsProjects() + .update(resourceGroupName, securityConnectorName, orgName, projectName, this.innerModel(), context); + return this; + } + + AzureDevOpsProjectImpl(AzureDevOpsProjectInner 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.orgName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "azureDevOpsOrgs"); + this.projectName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "projects"); + } + + public AzureDevOpsProject refresh() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsProjects() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, Context.NONE) + .getValue(); + return this; + } + + public AzureDevOpsProject refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsProjects() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, context) + .getValue(); + return this; + } + + public AzureDevOpsProjectImpl withProperties(AzureDevOpsProjectProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} 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 new file mode 100644 index 000000000000..bd7e5f0d203b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsClientImpl.java @@ -0,0 +1,1058 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.AzureDevOpsProjectsClient; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsProjectInner; +import com.azure.resourcemanager.security.implementation.models.AzureDevOpsProjectListResponse; +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 AzureDevOpsProjectsClient. + */ +public final class AzureDevOpsProjectsClientImpl implements AzureDevOpsProjectsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AzureDevOpsProjectsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AzureDevOpsProjectsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureDevOpsProjectsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(AzureDevOpsProjectsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAzureDevOpsProjects to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAzureDevOpsProjects") + public interface AzureDevOpsProjectsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureDevOpsProjectInner azureDevOpsProject, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureDevOpsProjectInner azureDevOpsProject, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, accept, context); + } + + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, orgName, projectName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, orgName, projectName, context).block(); + } + + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsProjectInner get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName) { + return getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, Context.NONE).getValue(); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, orgName, projectName, + contentType, accept, azureDevOpsProject, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, contentType, accept, azureDevOpsProject, + context); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsProjectInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + securityConnectorName, orgName, projectName, azureDevOpsProject); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsProjectInner.class, AzureDevOpsProjectInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsProjectInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + securityConnectorName, orgName, projectName, azureDevOpsProject, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsProjectInner.class, AzureDevOpsProjectInner.class, context); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsProjectInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, + azureDevOpsProject) + .getSyncPoller(); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsProjectInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, + azureDevOpsProject, context) + .getSyncPoller(); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, + azureDevOpsProject).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, + azureDevOpsProject, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsProjectInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject) + .block(); + } + + /** + * Creates or updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsProjectInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, + context).block(); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, orgName, projectName, + contentType, accept, azureDevOpsProject, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, contentType, accept, azureDevOpsProject, context); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsProjectInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, securityConnectorName, + orgName, projectName, azureDevOpsProject); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsProjectInner.class, AzureDevOpsProjectInner.class, + this.client.getContext()); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsProjectInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, securityConnectorName, + orgName, projectName, azureDevOpsProject, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsProjectInner.class, AzureDevOpsProjectInner.class, context); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsProjectInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject) { + return this.beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject) + .getSyncPoller(); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsProjectInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, + AzureDevOpsProjectInner azureDevOpsProject, Context context) { + return this + .beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, + context) + .getSyncPoller(); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsProjectInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + return updateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject).block(); + } + + /** + * Updates a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param azureDevOpsProject The Azure DevOps project resource payload. + * @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 azure DevOps Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsProjectInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context) { + return updateAsync(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, context) + .block(); + } + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 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 orgName) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, 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 Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 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 orgName, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 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 orgName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, orgName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 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 orgName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, orgName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 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 orgName) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, orgName)); + } + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 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 orgName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, orgName, context)); + } + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * 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())); + } + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * 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/AzureDevOpsProjectsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsImpl.java new file mode 100644 index 000000000000..057a61841b67 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsProjectsClient; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsProjectInner; +import com.azure.resourcemanager.security.models.AzureDevOpsProject; +import com.azure.resourcemanager.security.models.AzureDevOpsProjects; + +public final class AzureDevOpsProjectsImpl implements AzureDevOpsProjects { + private static final ClientLogger LOGGER = new ClientLogger(AzureDevOpsProjectsImpl.class); + + private final AzureDevOpsProjectsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AzureDevOpsProjectsImpl(AzureDevOpsProjectsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsProjectImpl(inner.getValue(), this.manager())); + } + + public AzureDevOpsProject get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName) { + AzureDevOpsProjectInner inner + = this.serviceClient().get(resourceGroupName, securityConnectorName, orgName, projectName); + if (inner != null) { + return new AzureDevOpsProjectImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String orgName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, orgName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AzureDevOpsProjectImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String orgName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, orgName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AzureDevOpsProjectImpl(inner1, this.manager())); + } + + public AzureDevOpsProject 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 orgName = ResourceManagerUtils.getValueFromIdByName(id, "azureDevOpsOrgs"); + if (orgName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'azureDevOpsOrgs'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, 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 orgName = ResourceManagerUtils.getValueFromIdByName(id, "azureDevOpsOrgs"); + if (orgName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'azureDevOpsOrgs'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, context); + } + + private AzureDevOpsProjectsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AzureDevOpsProjectImpl define(String name) { + return new AzureDevOpsProjectImpl(name, this.manager()); + } +} 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 new file mode 100644 index 000000000000..81cd5a8b4898 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposClientImpl.java @@ -0,0 +1,1125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.AzureDevOpsReposClient; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsRepositoryInner; +import com.azure.resourcemanager.security.implementation.models.AzureDevOpsRepositoryListResponse; +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 AzureDevOpsReposClient. + */ +public final class AzureDevOpsReposClientImpl implements AzureDevOpsReposClient { + /** + * The proxy service used to perform REST calls. + */ + private final AzureDevOpsReposService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of AzureDevOpsReposClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureDevOpsReposClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(AzureDevOpsReposService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterAzureDevOpsRepos to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterAzureDevOpsRepos") + public interface AzureDevOpsReposService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureDevOpsRepositoryInner azureDevOpsRepository, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureDevOpsRepositoryInner azureDevOpsRepository, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, repoName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, repoName, accept, context); + } + + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, context) + .block(); + } + + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsRepositoryInner get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName) { + return getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, repoName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, orgName, projectName, + repoName, contentType, accept, azureDevOpsRepository, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, repoName, contentType, accept, + azureDevOpsRepository, context); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsRepositoryInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + securityConnectorName, orgName, projectName, repoName, azureDevOpsRepository); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsRepositoryInner.class, AzureDevOpsRepositoryInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsRepositoryInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + securityConnectorName, orgName, projectName, repoName, azureDevOpsRepository, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsRepositoryInner.class, AzureDevOpsRepositoryInner.class, context); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsRepositoryInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository) + .getSyncPoller(); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsRepositoryInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context) + .getSyncPoller(); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsRepositoryInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository).block(); + } + + /** + * Creates or updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsRepositoryInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, + Context context) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context).block(); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, orgName, projectName, + repoName, contentType, accept, azureDevOpsRepository, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + return Mono + .error(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, repoName, contentType, accept, azureDevOpsRepository, context); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsRepositoryInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, securityConnectorName, + orgName, projectName, repoName, azureDevOpsRepository); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsRepositoryInner.class, AzureDevOpsRepositoryInner.class, + this.client.getContext()); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureDevOpsRepositoryInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, securityConnectorName, + orgName, projectName, repoName, azureDevOpsRepository, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AzureDevOpsRepositoryInner.class, AzureDevOpsRepositoryInner.class, context); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsRepositoryInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository) { + return this + .beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository) + .getSyncPoller(); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureDevOpsRepositoryInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String orgName, String projectName, String repoName, + AzureDevOpsRepositoryInner azureDevOpsRepository, Context context) { + return this + .beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context) + .getSyncPoller(); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, + Context context) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsRepositoryInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository) { + return updateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository).block(); + } + + /** + * Updates a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName parameter. + * @param azureDevOpsRepository The Azure DevOps repository resource payload. + * @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 azure DevOps Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureDevOpsRepositoryInner update(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, Context context) { + return updateAsync(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context).block(); + } + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 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 orgName, String projectName) { + 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, 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 Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 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 orgName, String projectName, 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 (orgName == null) { + return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 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 orgName, String projectName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, securityConnectorName, orgName, projectName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 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 orgName, String projectName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, securityConnectorName, orgName, projectName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 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 orgName, String projectName) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, orgName, projectName)); + } + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 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 orgName, String projectName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, orgName, projectName, context)); + } + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * 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())); + } + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * 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/AzureDevOpsReposImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposImpl.java new file mode 100644 index 000000000000..cc7f0dcc1130 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsReposClient; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsRepositoryInner; +import com.azure.resourcemanager.security.models.AzureDevOpsRepos; +import com.azure.resourcemanager.security.models.AzureDevOpsRepository; + +public final class AzureDevOpsReposImpl implements AzureDevOpsRepos { + private static final ClientLogger LOGGER = new ClientLogger(AzureDevOpsReposImpl.class); + + private final AzureDevOpsReposClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public AzureDevOpsReposImpl(AzureDevOpsReposClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, repoName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsRepositoryImpl(inner.getValue(), this.manager())); + } + + public AzureDevOpsRepository get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName) { + AzureDevOpsRepositoryInner inner + = this.serviceClient().get(resourceGroupName, securityConnectorName, orgName, projectName, repoName); + if (inner != null) { + return new AzureDevOpsRepositoryImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String orgName, String projectName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, orgName, projectName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AzureDevOpsRepositoryImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, orgName, projectName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AzureDevOpsRepositoryImpl(inner1, this.manager())); + } + + public AzureDevOpsRepository 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 orgName = ResourceManagerUtils.getValueFromIdByName(id, "azureDevOpsOrgs"); + if (orgName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'azureDevOpsOrgs'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String repoName = ResourceManagerUtils.getValueFromIdByName(id, "repos"); + if (repoName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'repos'.", id))); + } + return this + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, repoName, 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 orgName = ResourceManagerUtils.getValueFromIdByName(id, "azureDevOpsOrgs"); + if (orgName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'azureDevOpsOrgs'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String repoName = ResourceManagerUtils.getValueFromIdByName(id, "repos"); + if (repoName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'repos'.", id))); + } + return this.getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, repoName, context); + } + + private AzureDevOpsReposClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public AzureDevOpsRepositoryImpl define(String name) { + return new AzureDevOpsRepositoryImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsRepositoryImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsRepositoryImpl.java new file mode 100644 index 000000000000..e71d4329baf2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsRepositoryImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsRepositoryInner; +import com.azure.resourcemanager.security.models.AzureDevOpsRepository; +import com.azure.resourcemanager.security.models.AzureDevOpsRepositoryProperties; + +public final class AzureDevOpsRepositoryImpl + implements AzureDevOpsRepository, AzureDevOpsRepository.Definition, AzureDevOpsRepository.Update { + private AzureDevOpsRepositoryInner 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 AzureDevOpsRepositoryProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AzureDevOpsRepositoryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String securityConnectorName; + + private String orgName; + + private String projectName; + + private String repoName; + + public AzureDevOpsRepositoryImpl withExistingProject(String resourceGroupName, String securityConnectorName, + String orgName, String projectName) { + this.resourceGroupName = resourceGroupName; + this.securityConnectorName = securityConnectorName; + this.orgName = orgName; + this.projectName = projectName; + return this; + } + + public AzureDevOpsRepository create() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsRepos() + .createOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, repoName, this.innerModel(), + Context.NONE); + return this; + } + + public AzureDevOpsRepository create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsRepos() + .createOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, repoName, this.innerModel(), + context); + return this; + } + + AzureDevOpsRepositoryImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new AzureDevOpsRepositoryInner(); + this.serviceManager = serviceManager; + this.repoName = name; + } + + public AzureDevOpsRepositoryImpl update() { + return this; + } + + public AzureDevOpsRepository apply() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsRepos() + .update(resourceGroupName, securityConnectorName, orgName, projectName, repoName, this.innerModel(), + Context.NONE); + return this; + } + + public AzureDevOpsRepository apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsRepos() + .update(resourceGroupName, securityConnectorName, orgName, projectName, repoName, this.innerModel(), + context); + return this; + } + + AzureDevOpsRepositoryImpl(AzureDevOpsRepositoryInner 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.orgName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "azureDevOpsOrgs"); + this.projectName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "projects"); + this.repoName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "repos"); + } + + public AzureDevOpsRepository refresh() { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsRepos() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, repoName, Context.NONE) + .getValue(); + return this; + } + + public AzureDevOpsRepository refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureDevOpsRepos() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, repoName, context) + .getValue(); + return this; + } + + public AzureDevOpsRepositoryImpl withProperties(AzureDevOpsRepositoryProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceImpl.java new file mode 100644 index 000000000000..4ee1433818d0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import com.azure.resourcemanager.security.models.Compliance; +import com.azure.resourcemanager.security.models.ComplianceSegment; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ComplianceImpl implements Compliance { + private ComplianceInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ComplianceImpl(ComplianceInner 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 OffsetDateTime assessmentTimestampUtcDate() { + return this.innerModel().assessmentTimestampUtcDate(); + } + + public Integer resourceCount() { + return this.innerModel().resourceCount(); + } + + public List assessmentResult() { + List inner = this.innerModel().assessmentResult(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ComplianceInner 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/ComplianceResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultImpl.java index 1d8255952a27..b1166a5951ec 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; import com.azure.resourcemanager.security.models.ComplianceResult; import com.azure.resourcemanager.security.models.ResourceStatus; @@ -31,6 +32,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public ResourceStatus resourceStatus() { return this.innerModel().resourceStatus(); } 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 1409b6b9ba75..bc5a3cda2417 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.ComplianceResultsClient; import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; -import com.azure.resourcemanager.security.models.ComplianceResultList; +import com.azure.resourcemanager.security.implementation.models.ComplianceResultList; import reactor.core.publisher.Mono; /** @@ -59,263 +59,257 @@ public final class ComplianceResultsClientImpl implements ComplianceResultsClien * The interface defining all the services for SecurityCenterComplianceResults to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterCompli") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterComplianceResults") public interface ComplianceResultsService { - @Headers({ "Content-Type: application/json" }) - @Get("/{scope}/providers/Microsoft.Security/complianceResults") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, - @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Get("/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("complianceResultName") String complianceResultName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/complianceResults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 compliance results response along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a compliance result along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String scope) { + private Mono> getWithResponseAsync(String resourceId, String complianceResultName) { 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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (complianceResultName == null) { + return Mono + .error(new IllegalArgumentException("Parameter complianceResultName is required and cannot be null.")); } final String apiVersion = "2017-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)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, + accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. * @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 compliance results response along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a compliance result along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String scope, Context context) { + private Mono> getWithResponseAsync(String resourceId, String complianceResultName, + 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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (complianceResultName == null) { + return Mono + .error(new IllegalArgumentException("Parameter complianceResultName is required and cannot be null.")); } final String apiVersion = "2017-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)); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, accept, context); } /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 compliance results response as paginated response with {@link PagedFlux}. + * @return a compliance result on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String scope) { - return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String complianceResultName) { + return getWithResponseAsync(resourceId, complianceResultName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. * @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 compliance results response as paginated response with {@link PagedFlux}. + * @return a compliance result along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String scope, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(scope, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, String complianceResultName, + Context context) { + return getWithResponseAsync(resourceId, complianceResultName, context).block(); } /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 compliance results response as paginated response with {@link PagedIterable}. + * @return a compliance result. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String scope) { - return new PagedIterable<>(listAsync(scope)); + @ServiceMethod(returns = ReturnType.SINGLE) + public ComplianceResultInner get(String resourceId, String complianceResultName) { + return getWithResponse(resourceId, complianceResultName, Context.NONE).getValue(); } /** * Security compliance results in the subscription. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 compliance results response as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String scope, Context context) { - return new PagedIterable<>(listAsync(scope, context)); - } - - /** - * Security Compliance Result. - * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result along with {@link Response} on successful completion of {@link Mono}. + * @return list of compliance results response along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceId, String complianceResultName) { + 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 (resourceId == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); - } - if (complianceResultName == null) { - return Mono - .error(new IllegalArgumentException("Parameter complianceResultName 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 = "2017-08-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, - accept, context)) + .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())); } /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result along with {@link Response} on successful completion of {@link Mono}. + * @return list of compliance results response along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceId, String complianceResultName, - Context context) { + 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 (resourceId == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); - } - if (complianceResultName == null) { - return Mono - .error(new IllegalArgumentException("Parameter complianceResultName 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 = "2017-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, accept, 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)); } /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result on successful completion of {@link Mono}. + * @return list of compliance results response as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceId, String complianceResultName) { - return getWithResponseAsync(resourceId, complianceResultName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result along with {@link Response}. + * @return list of compliance results response as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceId, String complianceResultName, - Context context) { - return getWithResponseAsync(resourceId, complianceResultName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result. + * @return list of compliance results response as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ComplianceResultInner get(String resourceId, String complianceResultName) { - return getWithResponse(resourceId, complianceResultName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Security compliance results in the subscription. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of compliance results response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); } /** diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsImpl.java index ec52ed5b3f21..4d5bc808f879 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,25 +27,11 @@ public ComplianceResultsImpl(ComplianceResultsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list(String scope) { - PagedIterable inner = this.serviceClient().list(scope); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ComplianceResultImpl(inner1, this.manager())); - } - - public PagedIterable list(String scope, Context context) { - PagedIterable inner = this.serviceClient().list(scope, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ComplianceResultImpl(inner1, this.manager())); - } - public Response getWithResponse(String resourceId, String complianceResultName, Context context) { Response inner = this.serviceClient().getWithResponse(resourceId, complianceResultName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ComplianceResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ComplianceResultImpl(inner.getValue(), this.manager())); } public ComplianceResult get(String resourceId, String complianceResultName) { @@ -57,6 +43,16 @@ public ComplianceResult get(String resourceId, String complianceResultName) { } } + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ComplianceResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ComplianceResultImpl(inner1, this.manager())); + } + private ComplianceResultsClient serviceClient() { return this.innerClient; } 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 new file mode 100644 index 000000000000..1c2f4016e127 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.CompliancesClient; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import com.azure.resourcemanager.security.implementation.models.ComplianceList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CompliancesClient. + */ +public final class CompliancesClientImpl implements CompliancesClient { + /** + * The proxy service used to perform REST calls. + */ + private final CompliancesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of CompliancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CompliancesClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(CompliancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterCompliances to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterCompliances") + public interface CompliancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/compliances/{complianceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("complianceName") String complianceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/compliances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 compliance of a scope along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String complianceName) { + 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 (complianceName == null) { + return Mono.error(new IllegalArgumentException("Parameter complianceName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, scope, complianceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @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 compliance of a scope along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String complianceName, 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 (complianceName == null) { + return Mono.error(new IllegalArgumentException("Parameter complianceName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, complianceName, accept, context); + } + + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 compliance of a scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String complianceName) { + return getWithResponseAsync(scope, complianceName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @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 compliance of a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String complianceName, Context context) { + return getWithResponseAsync(scope, complianceName, context).block(); + } + + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 compliance of a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ComplianceInner get(String scope, String complianceName) { + return getWithResponse(scope, complianceName, Context.NONE).getValue(); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response 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 = "2017-08-01-preview"; + 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())); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response 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 = "2017-08-01-preview"; + 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)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response 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)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response 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 list of Compliance objects response 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 Compliance objects response 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/CompliancesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesImpl.java new file mode 100644 index 000000000000..9bf91a382612 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.CompliancesClient; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import com.azure.resourcemanager.security.models.Compliance; +import com.azure.resourcemanager.security.models.Compliances; + +public final class CompliancesImpl implements Compliances { + private static final ClientLogger LOGGER = new ClientLogger(CompliancesImpl.class); + + private final CompliancesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public CompliancesImpl(CompliancesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String scope, String complianceName, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, complianceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ComplianceImpl(inner.getValue(), this.manager())); + } + + public Compliance get(String scope, String complianceName) { + ComplianceInner inner = this.serviceClient().get(scope, complianceName); + if (inner != null) { + return new ComplianceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ComplianceImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ComplianceImpl(inner1, this.manager())); + } + + private CompliancesClient 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/CustomRecommendationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationImpl.java index b2af11290562..7ed223a7a2c7 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; 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 index a9cd5e36890c..7303ba93e228 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,7 +30,7 @@ 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 com.azure.resourcemanager.security.implementation.models.CustomRecommendationsList; import reactor.core.publisher.Mono; /** @@ -62,42 +62,41 @@ public final class CustomRecommendationsClientImpl implements CustomRecommendati * The interface defining all the services for SecurityCenterCustomRecommendations to be used by the proxy service * to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterCustom") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterCustomRecommendations") 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, + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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, + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, @PathParam("customRecommendationName") String customRecommendationName, - @BodyParam("application/json") CustomRecommendationInner customRecommendationBody, - @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CustomRecommendationInner customRecommendationBody, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "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, + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("customRecommendationName") String customRecommendationName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/customRecommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -105,152 +104,14 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -283,10 +144,7 @@ private Mono> getWithResponseAsync(String sc /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -318,10 +176,7 @@ private Mono> getWithResponseAsync(String sc /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -337,10 +192,7 @@ private Mono getAsync(String scope, String customReco /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -358,10 +210,7 @@ public Response getWithResponse(String scope, String /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -376,10 +225,7 @@ public CustomRecommendationInner get(String scope, String customRecommendationNa /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param customRecommendationBody Custom Recommendation body. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -408,20 +254,18 @@ private Mono> createOrUpdateWithResponseAsyn customRecommendationBody.validate(); } final String apiVersion = "2024-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, - customRecommendationName, customRecommendationBody, accept, context)) + customRecommendationName, contentType, accept, customRecommendationBody, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param customRecommendationBody Custom Recommendation body. * @param context The context to associate with this operation. @@ -451,19 +295,17 @@ private Mono> createOrUpdateWithResponseAsyn customRecommendationBody.validate(); } final String apiVersion = "2024-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, - customRecommendationBody, accept, context); + contentType, accept, customRecommendationBody, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param customRecommendationBody Custom Recommendation body. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -481,10 +323,7 @@ private Mono createOrUpdateAsync(String scope, String /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param customRecommendationBody Custom Recommendation body. * @param context The context to associate with this operation. @@ -503,10 +342,7 @@ public Response createOrUpdateWithResponse(String sco /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param customRecommendationBody Custom Recommendation body. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -524,10 +360,7 @@ public CustomRecommendationInner createOrUpdate(String scope, String customRecom /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -548,20 +381,15 @@ private Mono> deleteWithResponseAsync(String scope, String custom 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)) + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -584,18 +412,14 @@ private Mono> deleteWithResponseAsync(String scope, String custom 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); + return service.delete(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -610,10 +434,7 @@ private Mono deleteAsync(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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -629,10 +450,7 @@ public Response deleteWithResponse(String scope, String customRecommendati /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -643,6 +461,123 @@ public void delete(String scope, String customRecommendationName) { deleteWithResponse(scope, customRecommendationName, Context.NONE); } + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 the next page of items. * @@ -650,8 +585,8 @@ public void delete(String scope, String customRecommendationName) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @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> listNextSinglePageAsync(String nextLink) { @@ -677,8 +612,8 @@ private Mono> listNextSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @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> listNextSinglePageAsync(String nextLink, Context context) { 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 index 0f06b04bd943..86e1a0177fa1 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,26 +27,12 @@ public CustomRecommendationsImpl(CustomRecommendationsClient 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; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CustomRecommendationImpl(inner.getValue(), this.manager())); } public CustomRecommendation get(String scope, String customRecommendationName) { @@ -67,6 +53,16 @@ public void deleteByResourceGroup(String scope, String customRecommendationName) this.serviceClient().delete(scope, customRecommendationName); } + 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 CustomRecommendation getById(String id) { String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", "scope"); 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 new file mode 100644 index 000000000000..4f1a5f67f24c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStorageSettingImpl.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +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.DefenderForStorageSettingProperties; +import com.azure.resourcemanager.security.models.MalwareScan; +import com.azure.resourcemanager.security.models.SettingName; + +public final class DefenderForStorageSettingImpl + implements DefenderForStorageSetting, DefenderForStorageSetting.Definition { + private DefenderForStorageSettingInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + DefenderForStorageSettingImpl(DefenderForStorageSettingInner 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 DefenderForStorageSettingProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public DefenderForStorageSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceId; + + private SettingName settingName; + + public DefenderForStorageSettingImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public DefenderForStorageSetting create() { + this.innerObject = serviceManager.serviceClient() + .getDefenderForStorages() + .createWithResponse(resourceId, settingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DefenderForStorageSetting create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDefenderForStorages() + .createWithResponse(resourceId, settingName, this.innerModel(), context) + .getValue(); + return this; + } + + DefenderForStorageSettingImpl(SettingName name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new DefenderForStorageSettingInner(); + this.serviceManager = serviceManager; + this.settingName = name; + } + + public DefenderForStorageSetting refresh() { + this.innerObject = serviceManager.serviceClient() + .getDefenderForStorages() + .getWithResponse(resourceId, settingName, Context.NONE) + .getValue(); + return this; + } + + public DefenderForStorageSetting refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDefenderForStorages() + .getWithResponse(resourceId, settingName, context) + .getValue(); + return this; + } + + public Response startMalwareScanWithResponse(Context context) { + return serviceManager.defenderForStorages().startMalwareScanWithResponse(resourceId, settingName, context); + } + + public MalwareScan startMalwareScan() { + return serviceManager.defenderForStorages().startMalwareScan(resourceId, settingName); + } + + 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 new file mode 100644 index 000000000000..37a28aaa6d44 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesClientImpl.java @@ -0,0 +1,911 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.DefenderForStoragesClient; +import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; +import com.azure.resourcemanager.security.implementation.models.DefenderForStorageSettingList; +import com.azure.resourcemanager.security.models.SettingName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DefenderForStoragesClient. + */ +public final class DefenderForStoragesClientImpl implements DefenderForStoragesClient { + /** + * The proxy service used to perform REST calls. + */ + private final DefenderForStoragesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DefenderForStoragesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DefenderForStoragesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(DefenderForStoragesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDefenderForStorages to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterDefenderForStorages") + public interface DefenderForStoragesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context); + + @Put("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingName settingName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") DefenderForStorageSettingInner defenderForStorageSetting, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @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("endpoint") 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("endpoint") 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("endpoint") 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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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 = "2025-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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 = "2025-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context); + } + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, SettingName settingName) { + return getWithResponseAsync(resourceId, settingName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, SettingName settingName, + Context context) { + return getWithResponseAsync(resourceId, settingName, context).block(); + } + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DefenderForStorageSettingInner get(String resourceId, SettingName settingName) { + return getWithResponse(resourceId, settingName, Context.NONE).getValue(); + } + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The defender for storage setting name. + * @param defenderForStorageSetting Defender for Storage Settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceId, + SettingName settingName, DefenderForStorageSettingInner defenderForStorageSetting) { + 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 (defenderForStorageSetting == null) { + return Mono.error( + new IllegalArgumentException("Parameter defenderForStorageSetting is required and cannot be null.")); + } else { + defenderForStorageSetting.validate(); + } + final String apiVersion = "2025-09-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, + contentType, accept, defenderForStorageSetting, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The defender for storage setting name. + * @param defenderForStorageSetting Defender for Storage Settings. + * @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 resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceId, + SettingName settingName, DefenderForStorageSettingInner defenderForStorageSetting, 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 (defenderForStorageSetting == null) { + return Mono.error( + new IllegalArgumentException("Parameter defenderForStorageSetting is required and cannot be null.")); + } else { + defenderForStorageSetting.validate(); + } + final String apiVersion = "2025-09-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, contentType, accept, + defenderForStorageSetting, context); + } + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The defender for storage setting name. + * @param defenderForStorageSetting Defender for Storage Settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceId, SettingName settingName, + DefenderForStorageSettingInner defenderForStorageSetting) { + return createWithResponseAsync(resourceId, settingName, defenderForStorageSetting) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The defender for storage setting name. + * @param defenderForStorageSetting Defender for Storage Settings. + * @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 resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceId, SettingName settingName, + DefenderForStorageSettingInner defenderForStorageSetting, Context context) { + return createWithResponseAsync(resourceId, settingName, defenderForStorageSetting, context).block(); + } + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The defender for storage setting name. + * @param defenderForStorageSetting Defender for Storage Settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DefenderForStorageSettingInner create(String resourceId, SettingName settingName, + DefenderForStorageSettingInner defenderForStorageSetting) { + return createWithResponse(resourceId, settingName, defenderForStorageSetting, Context.NONE).getValue(); + } + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId) { + 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.")); + } + final String apiVersion = "2025-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, 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())); + } + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2025-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, resourceId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId) { + return new PagedIterable<>(listAsync(resourceId)); + } + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId, Context context) { + return new PagedIterable<>(listAsync(resourceId, context)); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 = "2025-09-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. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 = "2025-09-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. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 = "2025-09-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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 = "2025-09-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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 = "2025-09-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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 = "2025-09-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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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(); + } + + /** + * 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 Defender for Storage settings 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 Defender for Storage settings 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/DefenderForStoragesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesImpl.java new file mode 100644 index 000000000000..084697426ec2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.DefenderForStoragesClient; +import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; +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 { + private static final ClientLogger LOGGER = new ClientLogger(DefenderForStoragesImpl.class); + + private final DefenderForStoragesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DefenderForStoragesImpl(DefenderForStoragesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceId, SettingName settingName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceId, settingName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DefenderForStorageSettingImpl(inner.getValue(), this.manager())); + } + + public DefenderForStorageSetting get(String resourceId, SettingName settingName) { + DefenderForStorageSettingInner inner = this.serviceClient().get(resourceId, settingName); + if (inner != null) { + return new DefenderForStorageSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceId) { + PagedIterable inner = this.serviceClient().list(resourceId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DefenderForStorageSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceId, Context context) { + PagedIterable inner = this.serviceClient().list(resourceId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DefenderForStorageSettingImpl(inner1, this.manager())); + } + + public Response startMalwareScanWithResponse(String resourceId, SettingName settingName, + Context context) { + Response inner + = this.serviceClient().startMalwareScanWithResponse(resourceId, settingName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } + + 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); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } + + 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); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } + + 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"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String settingNameLocal = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}", "settingName"); + if (settingNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'defenderForStorageSettings'.", id))); + } + SettingName settingName = SettingName.fromString(settingNameLocal); + return this.getWithResponse(resourceId, settingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}", "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String settingNameLocal = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}", "settingName"); + if (settingNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'defenderForStorageSettings'.", id))); + } + SettingName settingName = SettingName.fromString(settingNameLocal); + return this.getWithResponse(resourceId, settingName, context); + } + + private DefenderForStoragesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public DefenderForStorageSettingImpl define(SettingName name) { + return new DefenderForStorageSettingImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationImpl.java new file mode 100644 index 000000000000..b7813646d495 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; +import com.azure.resourcemanager.security.models.DevOpsConfiguration; +import com.azure.resourcemanager.security.models.DevOpsConfigurationProperties; + +public final class DevOpsConfigurationImpl implements DevOpsConfiguration { + private DevOpsConfigurationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + DevOpsConfigurationImpl(DevOpsConfigurationInner 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 DevOpsConfigurationProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public DevOpsConfigurationInner 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/DevOpsConfigurationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsClientImpl.java new file mode 100644 index 000000000000..f471088a416b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsClientImpl.java @@ -0,0 +1,1151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.DevOpsConfigurationsClient; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; +import com.azure.resourcemanager.security.implementation.models.DevOpsConfigurationListResponse; +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 DevOpsConfigurationsClient. + */ +public final class DevOpsConfigurationsClientImpl implements DevOpsConfigurationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DevOpsConfigurationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DevOpsConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevOpsConfigurationsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(DevOpsConfigurationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDevOpsConfigurations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterDevOpsConfigurations") + public interface DevOpsConfigurationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DevOpsConfigurationInner devOpsConfiguration, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DevOpsConfigurationInner devOpsConfiguration, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a DevOps Configuration. + * + * @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 a DevOps Configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a DevOps Configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, accept, context); + } + + /** + * Gets a DevOps Configuration. + * + * @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 a DevOps Configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a DevOps Configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, context).block(); + } + + /** + * Gets a DevOps Configuration. + * + * @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 a DevOps Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsConfigurationInner get(String resourceGroupName, String securityConnectorName) { + return getWithResponse(resourceGroupName, securityConnectorName, Context.NONE).getValue(); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration) { + 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 (devOpsConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, contentType, accept, + devOpsConfiguration, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, 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 (devOpsConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, contentType, accept, devOpsConfiguration, context); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsConfigurationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, devOpsConfiguration); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsConfigurationInner.class, DevOpsConfigurationInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsConfigurationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsConfigurationInner.class, DevOpsConfigurationInner.class, context); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration) { + return this.beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration) + .getSyncPoller(); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, + Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context) + .getSyncPoller(); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsConfigurationInner createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration).block(); + } + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsConfigurationInner createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context).block(); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration) { + 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 (devOpsConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, contentType, accept, devOpsConfiguration, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, 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 (devOpsConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-11-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, contentType, accept, devOpsConfiguration, context); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsConfigurationInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, securityConnectorName, devOpsConfiguration); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsConfigurationInner.class, DevOpsConfigurationInner.class, + this.client.getContext()); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsConfigurationInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsConfigurationInner.class, DevOpsConfigurationInner.class, context); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsConfigurationInner> beginUpdate( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration) { + return this.beginUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration).getSyncPoller(); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsConfigurationInner> beginUpdate( + String resourceGroupName, String securityConnectorName, DevOpsConfigurationInner devOpsConfiguration, + Context context) { + return this.beginUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context) + .getSyncPoller(); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsConfigurationInner update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + return updateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration).block(); + } + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsConfigurationInner update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + return updateAsync(resourceGroupName, securityConnectorName, devOpsConfiguration, context).block(); + } + + /** + * Deletes a DevOps Connector. + * + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String securityConnectorName, 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 = "2025-11-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, context); + } + + /** + * Deletes a DevOps Connector. + * + * @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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String securityConnectorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, securityConnectorName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String securityConnectorName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, securityConnectorName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a DevOps Connector. + * + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName) { + return this.beginDeleteAsync(resourceGroupName, securityConnectorName).getSyncPoller(); + } + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, securityConnectorName, context).getSyncPoller(); + } + + /** + * Deletes a DevOps Connector. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String securityConnectorName) { + return beginDeleteAsync(resourceGroupName, securityConnectorName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String securityConnectorName, Context context) { + return beginDeleteAsync(resourceGroupName, securityConnectorName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a DevOps Connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String securityConnectorName) { + deleteAsync(resourceGroupName, securityConnectorName).block(); + } + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String securityConnectorName, Context context) { + deleteAsync(resourceGroupName, securityConnectorName, context).block(); + } + + /** + * List DevOps Configurations. + * + * @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, 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())); + } + + /** + * List DevOps Configurations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 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, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List DevOps Configurations. + * + * @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) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List DevOps Configurations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List DevOps Configurations. + * + * @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) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName)); + } + + /** + * List DevOps Configurations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, context)); + } + + /** + * List DevOps Configurations. + * + * 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())); + } + + /** + * List DevOps Configurations. + * + * 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/DevOpsConfigurationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsImpl.java new file mode 100644 index 000000000000..ef81d5b43e3a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.DevOpsConfigurationsClient; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; +import com.azure.resourcemanager.security.models.DevOpsConfiguration; +import com.azure.resourcemanager.security.models.DevOpsConfigurations; + +public final class DevOpsConfigurationsImpl implements DevOpsConfigurations { + private static final ClientLogger LOGGER = new ClientLogger(DevOpsConfigurationsImpl.class); + + private final DevOpsConfigurationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DevOpsConfigurationsImpl(DevOpsConfigurationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DevOpsConfigurationImpl(inner.getValue(), this.manager())); + } + + public DevOpsConfiguration get(String resourceGroupName, String securityConnectorName) { + DevOpsConfigurationInner inner = this.serviceClient().get(resourceGroupName, securityConnectorName); + if (inner != null) { + return new DevOpsConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public DevOpsConfiguration createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + DevOpsConfigurationInner inner + = this.serviceClient().createOrUpdate(resourceGroupName, securityConnectorName, devOpsConfiguration); + if (inner != null) { + return new DevOpsConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public DevOpsConfiguration createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + DevOpsConfigurationInner inner = this.serviceClient() + .createOrUpdate(resourceGroupName, securityConnectorName, devOpsConfiguration, context); + if (inner != null) { + return new DevOpsConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public DevOpsConfiguration update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + DevOpsConfigurationInner inner + = this.serviceClient().update(resourceGroupName, securityConnectorName, devOpsConfiguration); + if (inner != null) { + return new DevOpsConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public DevOpsConfiguration update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + DevOpsConfigurationInner inner + = this.serviceClient().update(resourceGroupName, securityConnectorName, devOpsConfiguration, context); + if (inner != null) { + return new DevOpsConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String securityConnectorName) { + this.serviceClient().delete(resourceGroupName, securityConnectorName); + } + + public void delete(String resourceGroupName, String securityConnectorName, Context context) { + this.serviceClient().delete(resourceGroupName, securityConnectorName, context); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DevOpsConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DevOpsConfigurationImpl(inner1, this.manager())); + } + + private DevOpsConfigurationsClient 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/DevOpsOperationResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsClientImpl.java new file mode 100644 index 000000000000..2257866b7426 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsClientImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.DevOpsOperationResultsClient; +import com.azure.resourcemanager.security.fluent.models.OperationStatusResultInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DevOpsOperationResultsClient. + */ +public final class DevOpsOperationResultsClientImpl implements DevOpsOperationResultsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DevOpsOperationResultsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DevOpsOperationResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevOpsOperationResultsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(DevOpsOperationResultsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDevOpsOperationResults to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterDevOpsOperationResults") + public interface DevOpsOperationResultsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/operationResults/{operationResultId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("operationResultId") String operationResultId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String operationResultId) { + 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 (operationResultId == null) { + return Mono + .error(new IllegalArgumentException("Parameter operationResultId is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, operationResultId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String operationResultId, 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 (operationResultId == null) { + return Mono + .error(new IllegalArgumentException("Parameter operationResultId is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, operationResultId, accept, context); + } + + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String operationResultId) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, operationResultId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String operationResultId, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, operationResultId, context).block(); + } + + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResultInner get(String resourceGroupName, String securityConnectorName, + String operationResultId) { + return getWithResponse(resourceGroupName, securityConnectorName, operationResultId, Context.NONE).getValue(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsImpl.java new file mode 100644 index 000000000000..2f845f1f68ec --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.DevOpsOperationResultsClient; +import com.azure.resourcemanager.security.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.security.models.DevOpsOperationResults; +import com.azure.resourcemanager.security.models.OperationStatusResult; + +public final class DevOpsOperationResultsImpl implements DevOpsOperationResults { + private static final ClientLogger LOGGER = new ClientLogger(DevOpsOperationResultsImpl.class); + + private final DevOpsOperationResultsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DevOpsOperationResultsImpl(DevOpsOperationResultsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String operationResultId, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, operationResultId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperationStatusResultImpl(inner.getValue(), this.manager())); + } + + public OperationStatusResult get(String resourceGroupName, String securityConnectorName, String operationResultId) { + OperationStatusResultInner inner + = this.serviceClient().get(resourceGroupName, securityConnectorName, operationResultId); + if (inner != null) { + return new OperationStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private DevOpsOperationResultsClient 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/DeviceSecurityGroupImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupImpl.java index 11505d2d5124..a1ec1e9e342d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.DeviceSecurityGroupInner; import com.azure.resourcemanager.security.models.AllowlistCustomAlertRule; @@ -32,6 +33,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public List thresholdRules() { List inner = this.innerModel().thresholdRules(); if (inner != null) { 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 4d9dc359fb6a..6372d0cbabbd 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,7 +30,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.DeviceSecurityGroupsClient; import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; -import com.azure.resourcemanager.security.models.DeviceSecurityGroupList; +import com.azure.resourcemanager.security.implementation.models.DeviceSecurityGroupList; import reactor.core.publisher.Mono; /** @@ -62,46 +62,45 @@ public final class DeviceSecurityGroupsClientImpl implements DeviceSecurityGroup * The interface defining all the services for SecurityCenterDeviceSecurityGroups to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterDevice") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterDeviceSecurityGroups") public interface DeviceSecurityGroupsService { - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, - Context context); - @Headers({ "Content-Type: application/json" }) @Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Put("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, - @BodyParam("application/json") DeviceSecurityGroupInner deviceSecurityGroup, - @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DeviceSecurityGroupInner deviceSecurityGroup, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, - @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, @HeaderParam("Accept") String accept, + @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -109,126 +108,13 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceId) { - 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.")); - } - final String apiVersion = "2019-08-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, 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())); - } - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(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 (resourceId == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); - } - final String apiVersion = "2019-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, resourceId, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceId) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceId), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceId, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceId, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceId) { - return new PagedIterable<>(listAsync(resourceId)); - } - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceId, Context context) { - return new PagedIterable<>(listAsync(resourceId, context)); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -261,7 +147,7 @@ private Mono> getWithResponseAsync(String res /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -293,7 +179,7 @@ private Mono> getWithResponseAsync(String res /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -310,7 +196,7 @@ private Mono getAsync(String resourceId, String device /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -328,7 +214,7 @@ public Response getWithResponse(String resourceId, Str /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -344,7 +230,7 @@ public DeviceSecurityGroupInner get(String resourceId, String deviceSecurityGrou /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param deviceSecurityGroup Security group object. @@ -374,17 +260,18 @@ private Mono> createOrUpdateWithResponseAsync deviceSecurityGroup.validate(); } final String apiVersion = "2019-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, - deviceSecurityGroupName, deviceSecurityGroup, accept, context)) + deviceSecurityGroupName, contentType, accept, deviceSecurityGroup, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param deviceSecurityGroup Security group object. @@ -415,16 +302,17 @@ private Mono> createOrUpdateWithResponseAsync deviceSecurityGroup.validate(); } final String apiVersion = "2019-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, - deviceSecurityGroup, accept, context); + contentType, accept, deviceSecurityGroup, context); } /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param deviceSecurityGroup Security group object. @@ -443,7 +331,7 @@ private Mono createOrUpdateAsync(String resourceId, St /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param deviceSecurityGroup Security group object. @@ -463,7 +351,7 @@ public Response createOrUpdateWithResponse(String reso /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param deviceSecurityGroup Security group object. @@ -482,7 +370,7 @@ public DeviceSecurityGroupInner createOrUpdate(String resourceId, String deviceS /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -504,17 +392,16 @@ private Mono> deleteWithResponseAsync(String resourceId, String d new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); } final String apiVersion = "2019-08-01"; - final String accept = "application/json"; return FluxUtil .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, resourceId, - deviceSecurityGroupName, accept, context)) + deviceSecurityGroupName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -538,16 +425,14 @@ private Mono> deleteWithResponseAsync(String resourceId, String d new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); } final String apiVersion = "2019-08-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept, - context); + return service.delete(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, context); } /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -563,7 +448,7 @@ private Mono deleteAsync(String resourceId, String deviceSecurityGroupName /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -580,7 +465,7 @@ public Response deleteWithResponse(String resourceId, String deviceSecurit /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -592,6 +477,119 @@ public void delete(String resourceId, String deviceSecurityGroupName) { deleteWithResponse(resourceId, deviceSecurityGroupName, Context.NONE); } + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId) { + 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.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, 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())); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, resourceId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId) { + return new PagedIterable<>(listAsync(resourceId)); + } + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId, Context context) { + return new PagedIterable<>(listAsync(resourceId, context)); + } + /** * Get the next page of items. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsImpl.java index d2941c4ea197..7b5f7dfb893a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,26 +27,12 @@ public DeviceSecurityGroupsImpl(DeviceSecurityGroupsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list(String resourceId) { - PagedIterable inner = this.serviceClient().list(resourceId); - return ResourceManagerUtils.mapPage(inner, inner1 -> new DeviceSecurityGroupImpl(inner1, this.manager())); - } - - public PagedIterable list(String resourceId, Context context) { - PagedIterable inner = this.serviceClient().list(resourceId, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new DeviceSecurityGroupImpl(inner1, this.manager())); - } - public Response getWithResponse(String resourceId, String deviceSecurityGroupName, Context context) { Response inner = this.serviceClient().getWithResponse(resourceId, deviceSecurityGroupName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new DeviceSecurityGroupImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeviceSecurityGroupImpl(inner.getValue(), this.manager())); } public DeviceSecurityGroup get(String resourceId, String deviceSecurityGroupName) { @@ -67,6 +53,16 @@ public void deleteByResourceGroup(String resourceId, String deviceSecurityGroupN this.serviceClient().delete(resourceId, deviceSecurityGroupName); } + public PagedIterable list(String resourceId) { + PagedIterable inner = this.serviceClient().list(resourceId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeviceSecurityGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceId, Context context) { + PagedIterable inner = this.serviceClient().list(resourceId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeviceSecurityGroupImpl(inner1, this.manager())); + } + public DeviceSecurityGroup getById(String id) { String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", "resourceId"); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionImpl.java index 55df609e646e..3e9f30e34db7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; import com.azure.resourcemanager.security.models.DiscoveredSecuritySolution; import com.azure.resourcemanager.security.models.SecurityFamily; @@ -35,6 +36,10 @@ public String location() { return this.innerModel().location(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public SecurityFamily securityFamily() { return this.innerModel().securityFamily(); } 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 ef03c35e4d1c..3a2e53f49d84 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.DiscoveredSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; -import com.azure.resourcemanager.security.models.DiscoveredSecuritySolutionList; +import com.azure.resourcemanager.security.implementation.models.DiscoveredSecuritySolutionList; import reactor.core.publisher.Mono; /** @@ -59,62 +59,68 @@ public final class DiscoveredSecuritySolutionsClientImpl implements DiscoveredSe * The interface defining all the services for SecurityCenterDiscoveredSecuritySolutions to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterDiscov") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterDiscoveredSecuritySolutions") public interface DiscoveredSecuritySolutionsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("discoveredSecuritySolutionName") String discoveredSecuritySolutionName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegion(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> listByHomeRegion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("discoveredSecuritySolutionName") String discoveredSecuritySolutionName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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, + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 discovered Security Solutions for the subscription along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return a specific discovered Security Solution along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, String discoveredSecuritySolutionName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -123,28 +129,42 @@ private Mono> listSinglePageAsync 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (discoveredSecuritySolutionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredSecuritySolutionName 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, - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, discoveredSecuritySolutionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. * @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 discovered Security Solutions for the subscription along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return a specific discovered Security Solution along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, String discoveredSecuritySolutionName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -153,69 +173,78 @@ private Mono> listSinglePageAsync 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (discoveredSecuritySolutionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredSecuritySolutionName 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, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + ascLocation, discoveredSecuritySolutionName, accept, context); } /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedFlux}. + * @return a specific discovered Security Solution on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName) { + return getWithResponseAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. * @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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets a list of discovered Security Solutions 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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific discovered Security Solution along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName, context).block(); } /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific discovered Security Solution. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredSecuritySolutionInner get(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName) { + return getWithResponse(resourceGroupName, ascLocation, discoveredSecuritySolutionName, Context.NONE).getValue(); } /** @@ -245,8 +274,8 @@ private Mono> listByHomeRegionSin final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), - ascLocation, apiVersion, accept, context)) + .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, 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())); @@ -282,7 +311,7 @@ private Mono> listByHomeRegionSin final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, + .listByHomeRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); @@ -357,22 +386,15 @@ public PagedIterable listByHomeRegion(String as } /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 discovered Security Solution along with {@link Response} on successful completion of - * {@link Mono}. + * @return a list of discovered Security Solutions for the subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, String discoveredSecuritySolutionName) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -381,43 +403,28 @@ private Mono> getWithResponseAsync(Str 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (discoveredSecuritySolutionName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter discoveredSecuritySolutionName 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, ascLocation, discoveredSecuritySolutionName, apiVersion, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. * @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 discovered Security Solution along with {@link Response} on successful completion of - * {@link Mono}. + * @return a list of discovered Security Solutions for the subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, String discoveredSecuritySolutionName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -426,81 +433,69 @@ private Mono> getWithResponseAsync(Str 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (discoveredSecuritySolutionName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter discoveredSecuritySolutionName 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, ascLocation, - discoveredSecuritySolutionName, apiVersion, accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 discovered Security Solution on successful completion of {@link Mono}. + * @return a list of discovered Security Solutions for the subscription as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName) { - return getWithResponseAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. * @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 discovered Security Solution along with {@link Response}. + * @return a list of discovered Security Solutions for the subscription as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @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 discovered Security Solutions for the subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of discovered Security Solutions for the subscription. + * + * @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 discovered Security Solution. + * @return a list of discovered Security Solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DiscoveredSecuritySolutionInner get(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName) { - return getWithResponse(resourceGroupName, ascLocation, discoveredSecuritySolutionName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** @@ -510,10 +505,11 @@ public DiscoveredSecuritySolutionInner get(String resourceGroupName, String ascL * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of discovered Security Solutions for the subscription and location along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -522,7 +518,8 @@ private Mono> listNextSinglePageA 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)) + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(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())); @@ -536,10 +533,11 @@ private Mono> listNextSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of discovered Security Solutions for the subscription and location along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -550,7 +548,7 @@ private Mono> listNextSinglePageA } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -562,10 +560,11 @@ private Mono> listNextSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of discovered Security Solutions for the subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -574,8 +573,7 @@ private Mono> listByHomeRegionNex new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + 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())); @@ -589,10 +587,11 @@ private Mono> listByHomeRegionNex * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of discovered Security Solutions for the subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -603,7 +602,7 @@ private Mono> listByHomeRegionNex } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, 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/DiscoveredSecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsImpl.java index b1716b5d66bd..649aa0c5e03f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,16 +27,23 @@ public DiscoveredSecuritySolutionsImpl(DiscoveredSecuritySolutionsClient innerCl this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); + public Response getWithResponse(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, ascLocation, discoveredSecuritySolutionName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DiscoveredSecuritySolutionImpl(inner.getValue(), this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); + public DiscoveredSecuritySolution get(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName) { + DiscoveredSecuritySolutionInner inner + = this.serviceClient().get(resourceGroupName, ascLocation, discoveredSecuritySolutionName); + if (inner != null) { + return new DiscoveredSecuritySolutionImpl(inner, this.manager()); + } else { + return null; + } } public PagedIterable listByHomeRegion(String ascLocation) { @@ -52,27 +59,16 @@ public PagedIterable listByHomeRegion(String ascLoca inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); } - public Response getWithResponse(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName, Context context) { - Response inner = this.serviceClient() - .getWithResponse(resourceGroupName, ascLocation, discoveredSecuritySolutionName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new DiscoveredSecuritySolutionImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); } - public DiscoveredSecuritySolution get(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName) { - DiscoveredSecuritySolutionInner inner - = this.serviceClient().get(resourceGroupName, ascLocation, discoveredSecuritySolutionName); - if (inner != null) { - return new DiscoveredSecuritySolutionImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new DiscoveredSecuritySolutionImpl(inner1, this.manager())); } private DiscoveredSecuritySolutionsClient serviceClient() { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionImpl.java index 644146723815..437d7a545997 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; import com.azure.resourcemanager.security.models.ExternalSecuritySolution; import com.azure.resourcemanager.security.models.ExternalSecuritySolutionKind; @@ -35,10 +36,18 @@ public ExternalSecuritySolutionKind kind() { return this.innerModel().kind(); } + public Object properties() { + return this.innerModel().properties(); + } + public String location() { return this.innerModel().location(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public ExternalSecuritySolutionInner innerModel() { return this.innerObject; } 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 ef067c359ecd..5511ff4a4006 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.ExternalSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; -import com.azure.resourcemanager.security.models.ExternalSecuritySolutionList; +import com.azure.resourcemanager.security.implementation.models.ExternalSecuritySolutionList; import reactor.core.publisher.Mono; /** @@ -59,62 +59,68 @@ public final class ExternalSecuritySolutionsClientImpl implements ExternalSecuri * The interface defining all the services for SecurityCenterExternalSecuritySolutions to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterExtern") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterExternalSecuritySolutions") public interface ExternalSecuritySolutionsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("externalSecuritySolutionsName") String externalSecuritySolutionsName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegion(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> listByHomeRegion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("externalSecuritySolutionsName") String externalSecuritySolutionsName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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, + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 external security solutions for the subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a specific external Security Solution along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, String externalSecuritySolutionsName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -123,28 +129,42 @@ private Mono> listSinglePageAsync() 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (externalSecuritySolutionsName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter externalSecuritySolutionsName 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(), apiVersion, this.client.getSubscriptionId(), - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, externalSecuritySolutionsName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. * @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 external security solutions for the subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a specific external Security Solution along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, String externalSecuritySolutionsName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -153,67 +173,78 @@ private Mono> listSinglePageAsync(C 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (externalSecuritySolutionsName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter externalSecuritySolutionsName 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(), apiVersion, this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + ascLocation, externalSecuritySolutionsName, accept, context); } /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 external security solutions for the subscription as paginated response with {@link PagedFlux}. + * @return a specific external Security Solution on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName) { + return getWithResponseAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. * @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 external security solutions for the subscription as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets a list of external security solutions 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 external security solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific external Security Solution along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName, context).block(); } /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 external security solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific external Security Solution. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public ExternalSecuritySolutionInner get(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName) { + return getWithResponse(resourceGroupName, ascLocation, externalSecuritySolutionsName, Context.NONE).getValue(); } /** @@ -243,8 +274,8 @@ private Mono> listByHomeRegionSingl final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), - ascLocation, apiVersion, accept, context)) + .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, 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())); @@ -280,7 +311,7 @@ private Mono> listByHomeRegionSingl final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, + .listByHomeRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); @@ -355,22 +386,15 @@ public PagedIterable listByHomeRegion(String ascL } /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 external Security Solution along with {@link Response} on successful completion of - * {@link Mono}. + * @return a list of external security solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, String externalSecuritySolutionsName) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -379,43 +403,28 @@ private Mono> getWithResponseAsync(Strin 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (externalSecuritySolutionsName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter externalSecuritySolutionsName 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, ascLocation, externalSecuritySolutionsName, apiVersion, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. * @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 external Security Solution along with {@link Response} on successful completion of - * {@link Mono}. + * @return a list of external security solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, String externalSecuritySolutionsName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -424,81 +433,67 @@ private Mono> getWithResponseAsync(Strin 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (externalSecuritySolutionsName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter externalSecuritySolutionsName 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, ascLocation, - externalSecuritySolutionsName, apiVersion, accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 external Security Solution on successful completion of {@link Mono}. + * @return a list of external security solutions for the subscription as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName) { - return getWithResponseAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. * @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 external Security Solution along with {@link Response}. + * @return a list of external security solutions for the subscription as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. + * @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 external security solutions for the subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of external security solutions for the subscription. + * + * @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 external Security Solution. + * @return a list of external security solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExternalSecuritySolutionInner get(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName) { - return getWithResponse(resourceGroupName, ascLocation, externalSecuritySolutionsName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** @@ -508,10 +503,11 @@ public ExternalSecuritySolutionInner get(String resourceGroupName, String ascLoc * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of external Security Solutions for the subscription and location along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -520,7 +516,8 @@ private Mono> listNextSinglePageAsy 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)) + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(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())); @@ -534,10 +531,11 @@ private Mono> listNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of external Security Solutions for the subscription and location along with {@link PagedResponse} + * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -548,7 +546,7 @@ private Mono> listNextSinglePageAsy } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -560,10 +558,11 @@ private Mono> listNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of external security solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -572,8 +571,7 @@ private Mono> listByHomeRegionNextS new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + 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())); @@ -587,10 +585,11 @@ private Mono> listByHomeRegionNextS * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of external security solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -601,7 +600,7 @@ private Mono> listByHomeRegionNextS } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, 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/ExternalSecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsImpl.java index 771e7ea7f32e..83bff50f0ae0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,14 +27,23 @@ public ExternalSecuritySolutionsImpl(ExternalSecuritySolutionsClient innerClient this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); + public Response getWithResponse(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, ascLocation, externalSecuritySolutionsName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ExternalSecuritySolutionImpl(inner.getValue(), this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); + public ExternalSecuritySolution get(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName) { + ExternalSecuritySolutionInner inner + = this.serviceClient().get(resourceGroupName, ascLocation, externalSecuritySolutionsName); + if (inner != null) { + return new ExternalSecuritySolutionImpl(inner, this.manager()); + } else { + return null; + } } public PagedIterable listByHomeRegion(String ascLocation) { @@ -48,27 +57,14 @@ public PagedIterable listByHomeRegion(String ascLocati return ResourceManagerUtils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); } - public Response getWithResponse(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName, Context context) { - Response inner = this.serviceClient() - .getWithResponse(resourceGroupName, ascLocation, externalSecuritySolutionsName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ExternalSecuritySolutionImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); } - public ExternalSecuritySolution get(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName) { - ExternalSecuritySolutionInner inner - = this.serviceClient().get(resourceGroupName, ascLocation, externalSecuritySolutionsName); - if (inner != null) { - return new ExternalSecuritySolutionImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExternalSecuritySolutionImpl(inner1, this.manager())); } private ExternalSecuritySolutionsClient serviceClient() { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GetSensitivitySettingsListResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GetSensitivitySettingsListResponseImpl.java new file mode 100644 index 000000000000..70d5872b67c5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GetSensitivitySettingsListResponseImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsListResponseInner; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner; +import com.azure.resourcemanager.security.models.GetSensitivitySettingsListResponse; +import com.azure.resourcemanager.security.models.GetSensitivitySettingsResponse; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class GetSensitivitySettingsListResponseImpl implements GetSensitivitySettingsListResponse { + private GetSensitivitySettingsListResponseInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GetSensitivitySettingsListResponseImpl(GetSensitivitySettingsListResponseInner 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 GetSensitivitySettingsResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public GetSensitivitySettingsListResponseInner 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/GetSensitivitySettingsResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GetSensitivitySettingsResponseImpl.java new file mode 100644 index 000000000000..349bf2c2d34c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GetSensitivitySettingsResponseImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner; +import com.azure.resourcemanager.security.models.GetSensitivitySettingsResponse; +import com.azure.resourcemanager.security.models.GetSensitivitySettingsResponseProperties; + +public final class GetSensitivitySettingsResponseImpl implements GetSensitivitySettingsResponse { + private GetSensitivitySettingsResponseInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GetSensitivitySettingsResponseImpl(GetSensitivitySettingsResponseInner 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 GetSensitivitySettingsResponseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GetSensitivitySettingsResponseInner 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/GitHubIssuesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubIssuesClientImpl.java new file mode 100644 index 000000000000..019707257b0b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubIssuesClientImpl.java @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.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.GitHubIssuesClient; +import com.azure.resourcemanager.security.models.IssueCreationRequest; +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 GitHubIssuesClient. + */ +public final class GitHubIssuesClientImpl implements GitHubIssuesClient { + /** + * The proxy service used to perform REST calls. + */ + private final GitHubIssuesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GitHubIssuesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GitHubIssuesClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(GitHubIssuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGitHubIssues to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGitHubIssues") + public interface GitHubIssuesService { + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}/issues") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @PathParam("repoName") String repoName, + @BodyParam("application/json") IssueCreationRequest createIssueRequest, Context context); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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>> createWithResponseAsync(String resourceGroupName, + String securityConnectorName, String ownerName, String repoName, IssueCreationRequest createIssueRequest) { + 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (createIssueRequest != null) { + createIssueRequest.validate(); + } + final String apiVersion = "2025-11-01-preview"; + return FluxUtil + .withContext( + context -> service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @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>> createWithResponseAsync(String resourceGroupName, + String securityConnectorName, String ownerName, String repoName, IssueCreationRequest createIssueRequest, + 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (createIssueRequest != null) { + createIssueRequest.validate(); + } + final String apiVersion = "2025-11-01-preview"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, repoName, createIssueRequest, context); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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> beginCreateAsync(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, IssueCreationRequest createIssueRequest) { + Mono>> mono = createWithResponseAsync(resourceGroupName, securityConnectorName, + ownerName, repoName, createIssueRequest); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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> beginCreateAsync(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName) { + final IssueCreationRequest createIssueRequest = null; + Mono>> mono = createWithResponseAsync(resourceGroupName, securityConnectorName, + ownerName, repoName, createIssueRequest); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @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> beginCreateAsync(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, IssueCreationRequest createIssueRequest, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, securityConnectorName, + ownerName, repoName, createIssueRequest, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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> beginCreate(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName) { + final IssueCreationRequest createIssueRequest = null; + return this.beginCreateAsync(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest) + .getSyncPoller(); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @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> beginCreate(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, IssueCreationRequest createIssueRequest, Context context) { + return this + .beginCreateAsync(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest, + context) + .getSyncPoller(); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createAsync(String resourceGroupName, String securityConnectorName, String ownerName, + String repoName, IssueCreationRequest createIssueRequest) { + return beginCreateAsync(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 createAsync(String resourceGroupName, String securityConnectorName, String ownerName, + String repoName) { + final IssueCreationRequest createIssueRequest = null; + return beginCreateAsync(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @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 createAsync(String resourceGroupName, String securityConnectorName, String ownerName, + String repoName, IssueCreationRequest createIssueRequest, Context context) { + return beginCreateAsync(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 create(String resourceGroupName, String securityConnectorName, String ownerName, String repoName) { + final IssueCreationRequest createIssueRequest = null; + createAsync(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest).block(); + } + + /** + * Creates a GitHub issue for the specified repository and assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName parameter. + * @param createIssueRequest The request model containing details for creating the GitHub issue. + * @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 create(String resourceGroupName, String securityConnectorName, String ownerName, String repoName, + IssueCreationRequest createIssueRequest, Context context) { + createAsync(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest, context).block(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubIssuesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubIssuesImpl.java new file mode 100644 index 000000000000..75e455faad37 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubIssuesImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.GitHubIssuesClient; +import com.azure.resourcemanager.security.models.GitHubIssues; +import com.azure.resourcemanager.security.models.IssueCreationRequest; + +public final class GitHubIssuesImpl implements GitHubIssues { + private static final ClientLogger LOGGER = new ClientLogger(GitHubIssuesImpl.class); + + private final GitHubIssuesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GitHubIssuesImpl(GitHubIssuesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void create(String resourceGroupName, String securityConnectorName, String ownerName, String repoName) { + this.serviceClient().create(resourceGroupName, securityConnectorName, ownerName, repoName); + } + + public void create(String resourceGroupName, String securityConnectorName, String ownerName, String repoName, + IssueCreationRequest createIssueRequest, Context context) { + this.serviceClient() + .create(resourceGroupName, securityConnectorName, ownerName, repoName, createIssueRequest, context); + } + + private GitHubIssuesClient 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/GitHubOwnerImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnerImpl.java new file mode 100644 index 000000000000..e0fab31d0f05 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnerImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerInner; +import com.azure.resourcemanager.security.models.GitHubOwner; +import com.azure.resourcemanager.security.models.GitHubOwnerProperties; + +public final class GitHubOwnerImpl implements GitHubOwner { + private GitHubOwnerInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GitHubOwnerImpl(GitHubOwnerInner 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 GitHubOwnerProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitHubOwnerInner 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/GitHubOwnerListResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnerListResponseImpl.java new file mode 100644 index 000000000000..47683f605bee --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnerListResponseImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerInner; +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerListResponseInner; +import com.azure.resourcemanager.security.models.GitHubOwner; +import com.azure.resourcemanager.security.models.GitHubOwnerListResponse; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class GitHubOwnerListResponseImpl implements GitHubOwnerListResponse { + private GitHubOwnerListResponseInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GitHubOwnerListResponseImpl(GitHubOwnerListResponseInner 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 GitHubOwnerImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public GitHubOwnerListResponseInner 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/GitHubOwnersClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersClientImpl.java new file mode 100644 index 000000000000..766ac41899c0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersClientImpl.java @@ -0,0 +1,566 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.GitHubOwnersClient; +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerInner; +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerListResponseInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GitHubOwnersClient. + */ +public final class GitHubOwnersClientImpl implements GitHubOwnersClient { + /** + * The proxy service used to perform REST calls. + */ + private final GitHubOwnersService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GitHubOwnersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GitHubOwnersClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(GitHubOwnersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGitHubOwners to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGitHubOwners") + public interface GitHubOwnersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitHubOwners") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAvailable(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a monitored GitHub owner. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 gitHub Owner resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String ownerName) { + 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, ownerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a monitored GitHub owner. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 gitHub Owner resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String ownerName, 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, accept, context); + } + + /** + * Returns a monitored GitHub owner. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 gitHub Owner resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, String ownerName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, ownerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a monitored GitHub owner. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 gitHub Owner resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, ownerName, context).block(); + } + + /** + * Returns a monitored GitHub owner. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 gitHub Owner resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitHubOwnerInner get(String resourceGroupName, String securityConnectorName, String ownerName) { + return getWithResponse(resourceGroupName, securityConnectorName, ownerName, Context.NONE).getValue(); + } + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, 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 GitHub owners onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 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, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * @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) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * @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) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName)); + } + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, context)); + } + + /** + * Returns a list of all GitHub owners accessible by the user token consumed by the connector. + * + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableWithResponseAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAvailable(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of all GitHub owners accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableWithResponseAsync(String resourceGroupName, + String securityConnectorName, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listAvailable(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, accept, context); + } + + /** + * Returns a list of all GitHub owners accessible by the user token consumed by the connector. + * + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAvailableAsync(String resourceGroupName, + String securityConnectorName) { + return listAvailableWithResponseAsync(resourceGroupName, securityConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a list of all GitHub owners accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + return listAvailableWithResponseAsync(resourceGroupName, securityConnectorName, context).block(); + } + + /** + * Returns a list of all GitHub owners accessible by the user token consumed by the connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitHubOwnerListResponseInner listAvailable(String resourceGroupName, String securityConnectorName) { + return listAvailableWithResponse(resourceGroupName, securityConnectorName, Context.NONE).getValue(); + } + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * 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())); + } + + /** + * Returns a list of GitHub owners onboarded to the connector. + * + * 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/GitHubOwnersImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersImpl.java new file mode 100644 index 000000000000..a38e6dfeee81 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitHubOwnersClient; +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerInner; +import com.azure.resourcemanager.security.fluent.models.GitHubOwnerListResponseInner; +import com.azure.resourcemanager.security.models.GitHubOwner; +import com.azure.resourcemanager.security.models.GitHubOwnerListResponse; +import com.azure.resourcemanager.security.models.GitHubOwners; + +public final class GitHubOwnersImpl implements GitHubOwners { + private static final ClientLogger LOGGER = new ClientLogger(GitHubOwnersImpl.class); + + private final GitHubOwnersClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GitHubOwnersImpl(GitHubOwnersClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, ownerName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitHubOwnerImpl(inner.getValue(), this.manager())); + } + + public GitHubOwner get(String resourceGroupName, String securityConnectorName, String ownerName) { + GitHubOwnerInner inner = this.serviceClient().get(resourceGroupName, securityConnectorName, ownerName); + if (inner != null) { + return new GitHubOwnerImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, securityConnectorName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitHubOwnerImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitHubOwnerImpl(inner1, this.manager())); + } + + public Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().listAvailableWithResponse(resourceGroupName, securityConnectorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitHubOwnerListResponseImpl(inner.getValue(), this.manager())); + } + + public GitHubOwnerListResponse listAvailable(String resourceGroupName, String securityConnectorName) { + GitHubOwnerListResponseInner inner + = this.serviceClient().listAvailable(resourceGroupName, securityConnectorName); + if (inner != null) { + return new GitHubOwnerListResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private GitHubOwnersClient 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/GitHubReposClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposClientImpl.java new file mode 100644 index 000000000000..f2f65589cc5a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposClientImpl.java @@ -0,0 +1,457 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitHubReposClient; +import com.azure.resourcemanager.security.fluent.models.GitHubRepositoryInner; +import com.azure.resourcemanager.security.implementation.models.GitHubRepositoryListResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GitHubReposClient. + */ +public final class GitHubReposClientImpl implements GitHubReposClient { + /** + * The proxy service used to perform REST calls. + */ + private final GitHubReposService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GitHubReposClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GitHubReposClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(GitHubReposService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGitHubRepos to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGitHubRepos") + public interface GitHubReposService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @PathParam("repoName") String repoName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a monitored GitHub repository. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 gitHub Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String ownerName, String repoName) { + 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, ownerName, repoName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a monitored GitHub repository. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 gitHub Repository resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String ownerName, String repoName, 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + if (repoName == null) { + return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, repoName, accept, context); + } + + /** + * Returns a monitored GitHub repository. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 gitHub Repository resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, ownerName, repoName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a monitored GitHub repository. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 gitHub Repository resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, ownerName, repoName, context).block(); + } + + /** + * Returns a monitored GitHub repository. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName parameter. + * @param repoName The repoName 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 gitHub Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitHubRepositoryInner get(String resourceGroupName, String securityConnectorName, String ownerName, + String repoName) { + return getWithResponse(resourceGroupName, securityConnectorName, ownerName, repoName, Context.NONE).getValue(); + } + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 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 ownerName) { + 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, ownerName, 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 GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 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 ownerName, 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 (ownerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 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 ownerName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, ownerName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 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 ownerName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, ownerName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 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 ownerName) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, ownerName)); + } + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param ownerName The ownerName 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 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 ownerName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, ownerName, context)); + } + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * 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())); + } + + /** + * Returns a list of GitHub repositories onboarded to the connector. + * + * 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/GitHubReposImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposImpl.java new file mode 100644 index 000000000000..d8ea616d8d99 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitHubReposClient; +import com.azure.resourcemanager.security.fluent.models.GitHubRepositoryInner; +import com.azure.resourcemanager.security.models.GitHubRepos; +import com.azure.resourcemanager.security.models.GitHubRepository; + +public final class GitHubReposImpl implements GitHubRepos { + private static final ClientLogger LOGGER = new ClientLogger(GitHubReposImpl.class); + + private final GitHubReposClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GitHubReposImpl(GitHubReposClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, ownerName, repoName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitHubRepositoryImpl(inner.getValue(), this.manager())); + } + + public GitHubRepository get(String resourceGroupName, String securityConnectorName, String ownerName, + String repoName) { + GitHubRepositoryInner inner + = this.serviceClient().get(resourceGroupName, securityConnectorName, ownerName, repoName); + if (inner != null) { + return new GitHubRepositoryImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String ownerName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, ownerName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitHubRepositoryImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String ownerName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, ownerName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitHubRepositoryImpl(inner1, this.manager())); + } + + private GitHubReposClient 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/GitHubRepositoryImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubRepositoryImpl.java new file mode 100644 index 000000000000..6944d1b9aafb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubRepositoryImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.GitHubRepositoryInner; +import com.azure.resourcemanager.security.models.GitHubRepository; +import com.azure.resourcemanager.security.models.GitHubRepositoryProperties; + +public final class GitHubRepositoryImpl implements GitHubRepository { + private GitHubRepositoryInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GitHubRepositoryImpl(GitHubRepositoryInner 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 GitHubRepositoryProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitHubRepositoryInner 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/GitLabGroupImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupImpl.java new file mode 100644 index 000000000000..7209e107c997 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupInner; +import com.azure.resourcemanager.security.models.GitLabGroup; +import com.azure.resourcemanager.security.models.GitLabGroupProperties; + +public final class GitLabGroupImpl implements GitLabGroup { + private GitLabGroupInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GitLabGroupImpl(GitLabGroupInner 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 GitLabGroupProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitLabGroupInner 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/GitLabGroupListResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupListResponseImpl.java new file mode 100644 index 000000000000..7f47a50f2527 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupListResponseImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.GitLabGroupInner; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupListResponseInner; +import com.azure.resourcemanager.security.models.GitLabGroup; +import com.azure.resourcemanager.security.models.GitLabGroupListResponse; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class GitLabGroupListResponseImpl implements GitLabGroupListResponse { + private GitLabGroupListResponseInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GitLabGroupListResponseImpl(GitLabGroupListResponseInner 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 GitLabGroupImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public GitLabGroupListResponseInner 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/GitLabGroupsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsClientImpl.java new file mode 100644 index 000000000000..e936ff7e2489 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsClientImpl.java @@ -0,0 +1,567 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.GitLabGroupsClient; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupInner; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupListResponseInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GitLabGroupsClient. + */ +public final class GitLabGroupsClientImpl implements GitLabGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GitLabGroupsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GitLabGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GitLabGroupsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(GitLabGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGitLabGroups to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGitLabGroups") + public interface GitLabGroupsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitLabGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAvailable(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a monitored GitLab Group resource for a given fully-qualified name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 gitLab Group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String groupFQName) { + 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a monitored GitLab Group resource for a given fully-qualified name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 gitLab Group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String groupFQName, 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, accept, context); + } + + /** + * Returns a monitored GitLab Group resource for a given fully-qualified name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 gitLab Group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String groupFQName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, groupFQName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a monitored GitLab Group resource for a given fully-qualified name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 gitLab Group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, groupFQName, context).block(); + } + + /** + * Returns a monitored GitLab Group resource for a given fully-qualified name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 gitLab Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitLabGroupInner get(String resourceGroupName, String securityConnectorName, String groupFQName) { + return getWithResponse(resourceGroupName, securityConnectorName, groupFQName, Context.NONE).getValue(); + } + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, 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 GitLab groups onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 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, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * @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) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * @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) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName)); + } + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, context)); + } + + /** + * Returns a list of all GitLab groups accessible by the user token consumed by the connector. + * + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableWithResponseAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAvailable(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of all GitLab groups accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableWithResponseAsync(String resourceGroupName, + String securityConnectorName, 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 = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listAvailable(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, accept, context); + } + + /** + * Returns a list of all GitLab groups accessible by the user token consumed by the connector. + * + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAvailableAsync(String resourceGroupName, + String securityConnectorName) { + return listAvailableWithResponseAsync(resourceGroupName, securityConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a list of all GitLab groups accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + return listAvailableWithResponseAsync(resourceGroupName, securityConnectorName, context).block(); + } + + /** + * Returns a list of all GitLab groups accessible by the user token consumed by the connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitLabGroupListResponseInner listAvailable(String resourceGroupName, String securityConnectorName) { + return listAvailableWithResponse(resourceGroupName, securityConnectorName, Context.NONE).getValue(); + } + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * 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())); + } + + /** + * Returns a list of GitLab groups onboarded to the connector. + * + * 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/GitLabGroupsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsImpl.java new file mode 100644 index 000000000000..a20f25209be8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitLabGroupsClient; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupInner; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupListResponseInner; +import com.azure.resourcemanager.security.models.GitLabGroup; +import com.azure.resourcemanager.security.models.GitLabGroupListResponse; +import com.azure.resourcemanager.security.models.GitLabGroups; + +public final class GitLabGroupsImpl implements GitLabGroups { + private static final ClientLogger LOGGER = new ClientLogger(GitLabGroupsImpl.class); + + private final GitLabGroupsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GitLabGroupsImpl(GitLabGroupsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, groupFQName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabGroupImpl(inner.getValue(), this.manager())); + } + + public GitLabGroup get(String resourceGroupName, String securityConnectorName, String groupFQName) { + GitLabGroupInner inner = this.serviceClient().get(resourceGroupName, securityConnectorName, groupFQName); + if (inner != null) { + return new GitLabGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, securityConnectorName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitLabGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitLabGroupImpl(inner1, this.manager())); + } + + public Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().listAvailableWithResponse(resourceGroupName, securityConnectorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabGroupListResponseImpl(inner.getValue(), this.manager())); + } + + public GitLabGroupListResponse listAvailable(String resourceGroupName, String securityConnectorName) { + GitLabGroupListResponseInner inner + = this.serviceClient().listAvailable(resourceGroupName, securityConnectorName); + if (inner != null) { + return new GitLabGroupListResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private GitLabGroupsClient 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/GitLabProjectImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectImpl.java new file mode 100644 index 000000000000..a6e6bbd566d4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.GitLabProjectInner; +import com.azure.resourcemanager.security.models.GitLabProject; +import com.azure.resourcemanager.security.models.GitLabProjectProperties; + +public final class GitLabProjectImpl implements GitLabProject { + private GitLabProjectInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + GitLabProjectImpl(GitLabProjectInner 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 GitLabProjectProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitLabProjectInner 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/GitLabProjectsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsClientImpl.java new file mode 100644 index 000000000000..4003f983e28c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsClientImpl.java @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitLabProjectsClient; +import com.azure.resourcemanager.security.fluent.models.GitLabProjectInner; +import com.azure.resourcemanager.security.implementation.models.GitLabProjectListResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GitLabProjectsClient. + */ +public final class GitLabProjectsClientImpl implements GitLabProjectsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GitLabProjectsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GitLabProjectsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GitLabProjectsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(GitLabProjectsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGitLabProjects to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGitLabProjects") + public interface GitLabProjectsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName parameter. + * @param projectName The projectName 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 gitLab Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String groupFQName, String projectName) { + 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, projectName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName parameter. + * @param projectName The projectName 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 gitLab Project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String groupFQName, String projectName, 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + if (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, projectName, accept, context); + } + + /** + * Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName parameter. + * @param projectName The projectName 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 gitLab Project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String groupFQName, String projectName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, groupFQName, projectName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName parameter. + * @param projectName The projectName 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 gitLab Project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, String projectName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, groupFQName, projectName, context) + .block(); + } + + /** + * Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName parameter. + * @param projectName The projectName 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 gitLab Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitLabProjectInner get(String resourceGroupName, String securityConnectorName, String groupFQName, + String projectName) { + return getWithResponse(resourceGroupName, securityConnectorName, groupFQName, projectName, Context.NONE) + .getValue(); + } + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 list of GitLab projects that are directly owned by given group and onboarded to the connector along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName, String groupFQName) { + 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, 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 GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 list of GitLab projects that are directly owned by given group and onboarded to the connector along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName, String groupFQName, 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 list of GitLab projects that are directly owned by given group and onboarded to the connector as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + String groupFQName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, groupFQName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 list of GitLab projects that are directly owned by given group and onboarded to the connector as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, securityConnectorName, groupFQName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 list of GitLab projects that are directly owned by given group and onboarded to the connector as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String groupFQName) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, groupFQName)); + } + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 list of GitLab projects that are directly owned by given group and onboarded to the connector as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, groupFQName, context)); + } + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * 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 GitLab projects that are directly owned by given group and onboarded to the connector 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())); + } + + /** + * Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. + * + * 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 GitLab projects that are directly owned by given group and onboarded to the connector 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/GitLabProjectsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsImpl.java new file mode 100644 index 000000000000..bdf74b2bd4a8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitLabProjectsClient; +import com.azure.resourcemanager.security.fluent.models.GitLabProjectInner; +import com.azure.resourcemanager.security.models.GitLabProject; +import com.azure.resourcemanager.security.models.GitLabProjects; + +public final class GitLabProjectsImpl implements GitLabProjects { + private static final ClientLogger LOGGER = new ClientLogger(GitLabProjectsImpl.class); + + private final GitLabProjectsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GitLabProjectsImpl(GitLabProjectsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, String projectName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, groupFQName, projectName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabProjectImpl(inner.getValue(), this.manager())); + } + + public GitLabProject get(String resourceGroupName, String securityConnectorName, String groupFQName, + String projectName) { + GitLabProjectInner inner + = this.serviceClient().get(resourceGroupName, securityConnectorName, groupFQName, projectName); + if (inner != null) { + return new GitLabProjectImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String groupFQName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, groupFQName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitLabProjectImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, String groupFQName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, groupFQName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GitLabProjectImpl(inner1, this.manager())); + } + + private GitLabProjectsClient 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/GitLabSubgroupsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsClientImpl.java new file mode 100644 index 000000000000..aa9fd3449e06 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsClientImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.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.GitLabSubgroupsClient; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupListResponseInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GitLabSubgroupsClient. + */ +public final class GitLabSubgroupsClientImpl implements GitLabSubgroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GitLabSubgroupsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GitLabSubgroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GitLabSubgroupsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(GitLabSubgroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGitLabSubgroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGitLabSubgroups") + public interface GitLabSubgroupsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/listSubgroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets nested subgroups of given GitLab Group which are onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 nested subgroups of given GitLab Group which are onboarded to the connector along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String resourceGroupName, + String securityConnectorName, String groupFQName) { + 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets nested subgroups of given GitLab Group which are onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 nested subgroups of given GitLab Group which are onboarded to the connector along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String resourceGroupName, + String securityConnectorName, String groupFQName, 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 (groupFQName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, accept, context); + } + + /** + * Gets nested subgroups of given GitLab Group which are onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 nested subgroups of given GitLab Group which are onboarded to the connector on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String securityConnectorName, + String groupFQName) { + return listWithResponseAsync(resourceGroupName, securityConnectorName, groupFQName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets nested subgroups of given GitLab Group which are onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 nested subgroups of given GitLab Group which are onboarded to the connector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String resourceGroupName, + String securityConnectorName, String groupFQName, Context context) { + return listWithResponseAsync(resourceGroupName, securityConnectorName, groupFQName, context).block(); + } + + /** + * Gets nested subgroups of given GitLab Group which are onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param groupFQName The groupFQName 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 nested subgroups of given GitLab Group which are onboarded to the connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitLabGroupListResponseInner list(String resourceGroupName, String securityConnectorName, + String groupFQName) { + return listWithResponse(resourceGroupName, securityConnectorName, groupFQName, Context.NONE).getValue(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsImpl.java new file mode 100644 index 000000000000..c10d111ed591 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GitLabSubgroupsClient; +import com.azure.resourcemanager.security.fluent.models.GitLabGroupListResponseInner; +import com.azure.resourcemanager.security.models.GitLabGroupListResponse; +import com.azure.resourcemanager.security.models.GitLabSubgroups; + +public final class GitLabSubgroupsImpl implements GitLabSubgroups { + private static final ClientLogger LOGGER = new ClientLogger(GitLabSubgroupsImpl.class); + + private final GitLabSubgroupsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GitLabSubgroupsImpl(GitLabSubgroupsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + Response inner + = this.serviceClient().listWithResponse(resourceGroupName, securityConnectorName, groupFQName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabGroupListResponseImpl(inner.getValue(), this.manager())); + } + + public GitLabGroupListResponse list(String resourceGroupName, String securityConnectorName, String groupFQName) { + GitLabGroupListResponseInner inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, groupFQName); + if (inner != null) { + return new GitLabGroupListResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private GitLabSubgroupsClient 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/GovernanceAssignmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentImpl.java new file mode 100644 index 000000000000..a44e7c1575d6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceAssignmentInner; +import com.azure.resourcemanager.security.models.GovernanceAssignment; +import com.azure.resourcemanager.security.models.GovernanceAssignmentAdditionalData; +import com.azure.resourcemanager.security.models.GovernanceEmailNotification; +import com.azure.resourcemanager.security.models.RemediationEta; +import java.time.OffsetDateTime; + +public final class GovernanceAssignmentImpl + implements GovernanceAssignment, GovernanceAssignment.Definition, GovernanceAssignment.Update { + private GovernanceAssignmentInner 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 owner() { + return this.innerModel().owner(); + } + + public OffsetDateTime remediationDueDate() { + return this.innerModel().remediationDueDate(); + } + + public RemediationEta remediationEta() { + return this.innerModel().remediationEta(); + } + + public Boolean isGracePeriod() { + return this.innerModel().isGracePeriod(); + } + + public GovernanceEmailNotification governanceEmailNotification() { + return this.innerModel().governanceEmailNotification(); + } + + public GovernanceAssignmentAdditionalData additionalData() { + return this.innerModel().additionalData(); + } + + public GovernanceAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String scope; + + private String assessmentName; + + private String assignmentKey; + + public GovernanceAssignmentImpl withExistingAssessment(String scope, String assessmentName) { + this.scope = scope; + this.assessmentName = assessmentName; + return this; + } + + public GovernanceAssignment create() { + this.innerObject = serviceManager.serviceClient() + .getGovernanceAssignments() + .createOrUpdateWithResponse(scope, assessmentName, assignmentKey, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GovernanceAssignment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGovernanceAssignments() + .createOrUpdateWithResponse(scope, assessmentName, assignmentKey, this.innerModel(), context) + .getValue(); + return this; + } + + GovernanceAssignmentImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new GovernanceAssignmentInner(); + this.serviceManager = serviceManager; + this.assignmentKey = name; + } + + public GovernanceAssignmentImpl update() { + return this; + } + + public GovernanceAssignment apply() { + this.innerObject = serviceManager.serviceClient() + .getGovernanceAssignments() + .createOrUpdateWithResponse(scope, assessmentName, assignmentKey, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GovernanceAssignment apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGovernanceAssignments() + .createOrUpdateWithResponse(scope, assessmentName, assignmentKey, this.innerModel(), context) + .getValue(); + return this; + } + + GovernanceAssignmentImpl(GovernanceAssignmentInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "scope"); + this.assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assessmentName"); + this.assignmentKey = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assignmentKey"); + } + + public GovernanceAssignment refresh() { + this.innerObject = serviceManager.serviceClient() + .getGovernanceAssignments() + .getWithResponse(scope, assessmentName, assignmentKey, Context.NONE) + .getValue(); + return this; + } + + public GovernanceAssignment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGovernanceAssignments() + .getWithResponse(scope, assessmentName, assignmentKey, context) + .getValue(); + return this; + } + + public GovernanceAssignmentImpl withOwner(String owner) { + this.innerModel().withOwner(owner); + return this; + } + + public GovernanceAssignmentImpl withRemediationDueDate(OffsetDateTime remediationDueDate) { + this.innerModel().withRemediationDueDate(remediationDueDate); + return this; + } + + public GovernanceAssignmentImpl withRemediationEta(RemediationEta remediationEta) { + this.innerModel().withRemediationEta(remediationEta); + return this; + } + + public GovernanceAssignmentImpl withIsGracePeriod(Boolean isGracePeriod) { + this.innerModel().withIsGracePeriod(isGracePeriod); + return this; + } + + public GovernanceAssignmentImpl + withGovernanceEmailNotification(GovernanceEmailNotification governanceEmailNotification) { + this.innerModel().withGovernanceEmailNotification(governanceEmailNotification); + return this; + } + + public GovernanceAssignmentImpl withAdditionalData(GovernanceAssignmentAdditionalData additionalData) { + this.innerModel().withAdditionalData(additionalData); + return this; + } +} 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 new file mode 100644 index 000000000000..a99524c9e19d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsClientImpl.java @@ -0,0 +1,683 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.GovernanceAssignmentInner; +import com.azure.resourcemanager.security.implementation.models.GovernanceAssignmentsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GovernanceAssignmentsClient. + */ +public final class GovernanceAssignmentsClientImpl implements GovernanceAssignmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GovernanceAssignmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GovernanceAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GovernanceAssignmentsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(GovernanceAssignmentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGovernanceAssignments to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGovernanceAssignments") + public interface GovernanceAssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, @PathParam("assignmentKey") String assignmentKey, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, @PathParam("assignmentKey") String assignmentKey, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GovernanceAssignmentInner governanceAssignment, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, @PathParam("assignmentKey") String assignmentKey, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 governanceAssignment for the requested scope by AssignmentKey along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String assessmentName, + String assignmentKey) { + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, scope, assessmentName, + assignmentKey, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 governanceAssignment for the requested scope by AssignmentKey along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String assessmentName, + String assignmentKey, 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, assessmentName, assignmentKey, accept, + context); + } + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 governanceAssignment for the requested scope by AssignmentKey on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String assessmentName, String assignmentKey) { + return getWithResponseAsync(scope, assessmentName, assignmentKey) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 governanceAssignment for the requested scope by AssignmentKey along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String assessmentName, + String assignmentKey, Context context) { + return getWithResponseAsync(scope, assessmentName, assignmentKey, context).block(); + } + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 governanceAssignment for the requested scope by AssignmentKey. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GovernanceAssignmentInner get(String scope, String assessmentName, String assignmentKey) { + return getWithResponse(scope, assessmentName, assignmentKey, Context.NONE).getValue(); + } + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @param governanceAssignment Governance assignment over a subscription 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 governance assignment over a given scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, + String assessmentName, String assignmentKey, GovernanceAssignmentInner governanceAssignment) { + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + if (governanceAssignment == null) { + return Mono + .error(new IllegalArgumentException("Parameter governanceAssignment is required and cannot be null.")); + } else { + governanceAssignment.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, assessmentName, + assignmentKey, contentType, accept, governanceAssignment, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @param governanceAssignment Governance assignment over a subscription 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 governance assignment over a given scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, + String assessmentName, String assignmentKey, GovernanceAssignmentInner governanceAssignment, 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + if (governanceAssignment == null) { + return Mono + .error(new IllegalArgumentException("Parameter governanceAssignment is required and cannot be null.")); + } else { + governanceAssignment.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, assessmentName, assignmentKey, + contentType, accept, governanceAssignment, context); + } + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @param governanceAssignment Governance assignment over a subscription 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 governance assignment over a given scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String scope, String assessmentName, + String assignmentKey, GovernanceAssignmentInner governanceAssignment) { + return createOrUpdateWithResponseAsync(scope, assessmentName, assignmentKey, governanceAssignment) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @param governanceAssignment Governance assignment over a subscription 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 governance assignment over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String scope, String assessmentName, + String assignmentKey, GovernanceAssignmentInner governanceAssignment, Context context) { + return createOrUpdateWithResponseAsync(scope, assessmentName, assignmentKey, governanceAssignment, context) + .block(); + } + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @param governanceAssignment Governance assignment over a subscription 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 governance assignment over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GovernanceAssignmentInner createOrUpdate(String scope, String assessmentName, String assignmentKey, + GovernanceAssignmentInner governanceAssignment) { + return createOrUpdateWithResponse(scope, assessmentName, assignmentKey, governanceAssignment, Context.NONE) + .getValue(); + } + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 assessmentName, String assignmentKey) { + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, scope, assessmentName, + assignmentKey, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 assessmentName, String assignmentKey, + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + return Mono.error(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, scope, assessmentName, assignmentKey, context); + } + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 assessmentName, String assignmentKey) { + return deleteWithResponseAsync(scope, assessmentName, assignmentKey).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @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 assessmentName, String assignmentKey, + Context context) { + return deleteWithResponseAsync(scope, assessmentName, assignmentKey, context).block(); + } + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance assignment. + * @param assignmentKey The governance assignment key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 assessmentName, String assignmentKey) { + deleteWithResponse(scope, assessmentName, assignmentKey, Context.NONE); + } + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, String assessmentName) { + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), apiVersion, scope, assessmentName, 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 governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, String assessmentName, + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String assessmentName) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, assessmentName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String assessmentName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, assessmentName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String assessmentName) { + return new PagedIterable<>(listAsync(scope, assessmentName)); + } + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the governance assignment. + * @param assessmentName The assessment key of the governance 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 governance assignments on all of your resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String assessmentName, Context context) { + return new PagedIterable<>(listAsync(scope, assessmentName, 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 governance assignments on all of your resources inside a scope 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 governance assignments on all of your resources inside a scope 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/GovernanceAssignmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsImpl.java new file mode 100644 index 000000000000..ba0b217af9a8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.GovernanceAssignmentInner; +import com.azure.resourcemanager.security.models.GovernanceAssignment; +import com.azure.resourcemanager.security.models.GovernanceAssignments; + +public final class GovernanceAssignmentsImpl implements GovernanceAssignments { + private static final ClientLogger LOGGER = new ClientLogger(GovernanceAssignmentsImpl.class); + + private final GovernanceAssignmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GovernanceAssignmentsImpl(GovernanceAssignmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String scope, String assessmentName, String assignmentKey, + Context context) { + Response inner + = this.serviceClient().getWithResponse(scope, assessmentName, assignmentKey, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GovernanceAssignmentImpl(inner.getValue(), this.manager())); + } + + public GovernanceAssignment get(String scope, String assessmentName, String assignmentKey) { + GovernanceAssignmentInner inner = this.serviceClient().get(scope, assessmentName, assignmentKey); + if (inner != null) { + return new GovernanceAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String scope, String assessmentName, String assignmentKey, + Context context) { + return this.serviceClient().deleteWithResponse(scope, assessmentName, assignmentKey, context); + } + + public void delete(String scope, String assessmentName, String assignmentKey) { + this.serviceClient().delete(scope, assessmentName, assignmentKey); + } + + public PagedIterable list(String scope, String assessmentName) { + PagedIterable inner = this.serviceClient().list(scope, assessmentName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GovernanceAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String assessmentName, Context context) { + PagedIterable inner = this.serviceClient().list(scope, assessmentName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GovernanceAssignmentImpl(inner1, this.manager())); + } + + public GovernanceAssignment getById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assessmentName"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + String assignmentKey = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assignmentKey"); + if (assignmentKey == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceAssignments'.", id))); + } + return this.getWithResponse(scope, assessmentName, assignmentKey, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assessmentName"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + String assignmentKey = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assignmentKey"); + if (assignmentKey == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceAssignments'.", id))); + } + return this.getWithResponse(scope, assessmentName, assignmentKey, context); + } + + public void deleteById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assessmentName"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + String assignmentKey = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assignmentKey"); + if (assignmentKey == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceAssignments'.", id))); + } + this.deleteWithResponse(scope, assessmentName, assignmentKey, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assessmentName"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + String assignmentKey = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}", + "assignmentKey"); + if (assignmentKey == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceAssignments'.", id))); + } + return this.deleteWithResponse(scope, assessmentName, assignmentKey, context); + } + + private GovernanceAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public GovernanceAssignmentImpl define(String name) { + return new GovernanceAssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRuleImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRuleImpl.java new file mode 100644 index 000000000000..e273fa61e222 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRuleImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceRuleInner; +import com.azure.resourcemanager.security.models.ExecuteGovernanceRuleParams; +import com.azure.resourcemanager.security.models.GovernanceRule; +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 java.util.Collections; +import java.util.List; + +public final class GovernanceRuleImpl implements GovernanceRule, GovernanceRule.Definition, GovernanceRule.Update { + private GovernanceRuleInner 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 tenantId() { + return this.innerModel().tenantId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String remediationTimeframe() { + return this.innerModel().remediationTimeframe(); + } + + public Boolean isGracePeriod() { + return this.innerModel().isGracePeriod(); + } + + public int rulePriority() { + return this.innerModel().rulePriority(); + } + + public Boolean isDisabled() { + return this.innerModel().isDisabled(); + } + + public GovernanceRuleType ruleType() { + return this.innerModel().ruleType(); + } + + public GovernanceRuleSourceResourceType sourceResourceType() { + return this.innerModel().sourceResourceType(); + } + + public List excludedScopes() { + List inner = this.innerModel().excludedScopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List conditionSets() { + List inner = this.innerModel().conditionSets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean includeMemberScopes() { + return this.innerModel().includeMemberScopes(); + } + + public GovernanceRuleOwnerSource ownerSource() { + return this.innerModel().ownerSource(); + } + + public GovernanceRuleEmailNotification governanceEmailNotification() { + return this.innerModel().governanceEmailNotification(); + } + + public GovernanceRuleMetadata metadata() { + return this.innerModel().metadata(); + } + + public GovernanceRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String scope; + + private String ruleId; + + public GovernanceRuleImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public GovernanceRule create() { + this.innerObject = serviceManager.serviceClient() + .getGovernanceRules() + .createOrUpdateWithResponse(scope, ruleId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GovernanceRule create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGovernanceRules() + .createOrUpdateWithResponse(scope, ruleId, this.innerModel(), context) + .getValue(); + return this; + } + + GovernanceRuleImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new GovernanceRuleInner(); + this.serviceManager = serviceManager; + this.ruleId = name; + } + + public GovernanceRuleImpl update() { + return this; + } + + public GovernanceRule apply() { + this.innerObject = serviceManager.serviceClient() + .getGovernanceRules() + .createOrUpdateWithResponse(scope, ruleId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GovernanceRule apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGovernanceRules() + .createOrUpdateWithResponse(scope, ruleId, this.innerModel(), context) + .getValue(); + return this; + } + + GovernanceRuleImpl(GovernanceRuleInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "scope"); + this.ruleId = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "ruleId"); + } + + public GovernanceRule refresh() { + this.innerObject = serviceManager.serviceClient() + .getGovernanceRules() + .getWithResponse(scope, ruleId, Context.NONE) + .getValue(); + return this; + } + + public GovernanceRule refresh(Context context) { + this.innerObject + = serviceManager.serviceClient().getGovernanceRules().getWithResponse(scope, ruleId, context).getValue(); + return this; + } + + public void execute() { + serviceManager.governanceRules().execute(scope, ruleId); + } + + public void execute(ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context) { + serviceManager.governanceRules().execute(scope, ruleId, executeGovernanceRuleParams, context); + } + + public GovernanceRuleImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public GovernanceRuleImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public GovernanceRuleImpl withRemediationTimeframe(String remediationTimeframe) { + this.innerModel().withRemediationTimeframe(remediationTimeframe); + return this; + } + + public GovernanceRuleImpl withIsGracePeriod(Boolean isGracePeriod) { + this.innerModel().withIsGracePeriod(isGracePeriod); + return this; + } + + public GovernanceRuleImpl withRulePriority(int rulePriority) { + this.innerModel().withRulePriority(rulePriority); + return this; + } + + public GovernanceRuleImpl withIsDisabled(Boolean isDisabled) { + this.innerModel().withIsDisabled(isDisabled); + return this; + } + + public GovernanceRuleImpl withRuleType(GovernanceRuleType ruleType) { + this.innerModel().withRuleType(ruleType); + return this; + } + + public GovernanceRuleImpl withSourceResourceType(GovernanceRuleSourceResourceType sourceResourceType) { + this.innerModel().withSourceResourceType(sourceResourceType); + return this; + } + + public GovernanceRuleImpl withExcludedScopes(List excludedScopes) { + this.innerModel().withExcludedScopes(excludedScopes); + return this; + } + + public GovernanceRuleImpl withConditionSets(List conditionSets) { + this.innerModel().withConditionSets(conditionSets); + return this; + } + + public GovernanceRuleImpl withIncludeMemberScopes(Boolean includeMemberScopes) { + this.innerModel().withIncludeMemberScopes(includeMemberScopes); + return this; + } + + public GovernanceRuleImpl withOwnerSource(GovernanceRuleOwnerSource ownerSource) { + this.innerModel().withOwnerSource(ownerSource); + return this; + } + + public GovernanceRuleImpl + withGovernanceEmailNotification(GovernanceRuleEmailNotification governanceEmailNotification) { + this.innerModel().withGovernanceEmailNotification(governanceEmailNotification); + return this; + } + + public GovernanceRuleImpl withMetadata(GovernanceRuleMetadata metadata) { + this.innerModel().withMetadata(metadata); + return this; + } +} 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 new file mode 100644 index 000000000000..d2062dc410de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesClientImpl.java @@ -0,0 +1,1091 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.Post; +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.GovernanceRulesClient; +import com.azure.resourcemanager.security.fluent.models.GovernanceRuleInner; +import com.azure.resourcemanager.security.fluent.models.OperationResultInner; +import com.azure.resourcemanager.security.implementation.models.GovernanceRuleList; +import com.azure.resourcemanager.security.models.ExecuteGovernanceRuleParams; +import com.azure.resourcemanager.security.models.GovernanceRulesOperationResultsResponse; +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 GovernanceRulesClient. + */ +public final class GovernanceRulesClientImpl implements GovernanceRulesClient { + /** + * The proxy service used to perform REST calls. + */ + private final GovernanceRulesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of GovernanceRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GovernanceRulesClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(GovernanceRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterGovernanceRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterGovernanceRules") + public interface GovernanceRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("ruleId") String ruleId, @HeaderParam("Accept") String accept, Context context); + + @Put("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("ruleId") String ruleId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") GovernanceRuleInner governanceRule, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("ruleId") String ruleId, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/governanceRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("ruleId") String ruleId, + @BodyParam("application/json") ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono operationResults(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("ruleId") String ruleId, @PathParam("operationId") String operationId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 a specific governance rule for the requested scope by ruleId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String ruleId) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, scope, ruleId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 a specific governance rule for the requested scope by ruleId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String ruleId, 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, ruleId, accept, context); + } + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 a specific governance rule for the requested scope by ruleId on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String ruleId) { + return getWithResponseAsync(scope, ruleId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 a specific governance rule for the requested scope by ruleId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String ruleId, Context context) { + return getWithResponseAsync(scope, ruleId, context).block(); + } + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 a specific governance rule for the requested scope by ruleId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GovernanceRuleInner get(String scope, String ruleId) { + return getWithResponse(scope, ruleId, Context.NONE).getValue(); + } + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param governanceRule Governance rule over a given 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 governance rule over a given scope along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, String ruleId, + GovernanceRuleInner governanceRule) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (governanceRule == null) { + return Mono.error(new IllegalArgumentException("Parameter governanceRule is required and cannot be null.")); + } else { + governanceRule.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, ruleId, + contentType, accept, governanceRule, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param governanceRule Governance rule over a given 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 governance rule over a given scope along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, String ruleId, + GovernanceRuleInner governanceRule, 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (governanceRule == null) { + return Mono.error(new IllegalArgumentException("Parameter governanceRule is required and cannot be null.")); + } else { + governanceRule.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, ruleId, contentType, accept, + governanceRule, context); + } + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param governanceRule Governance rule over a given 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 governance rule over a given scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String scope, String ruleId, + GovernanceRuleInner governanceRule) { + return createOrUpdateWithResponseAsync(scope, ruleId, governanceRule) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param governanceRule Governance rule over a given 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 governance rule over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String scope, String ruleId, + GovernanceRuleInner governanceRule, Context context) { + return createOrUpdateWithResponseAsync(scope, ruleId, governanceRule, context).block(); + } + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param governanceRule Governance rule over a given 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 governance rule over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GovernanceRuleInner createOrUpdate(String scope, String ruleId, GovernanceRuleInner governanceRule) { + return createOrUpdateWithResponse(scope, ruleId, governanceRule, Context.NONE).getValue(); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String scope, String ruleId) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, scope, ruleId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String scope, String ruleId, 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, scope, ruleId, context); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String scope, String ruleId) { + Mono>> mono = deleteWithResponseAsync(scope, ruleId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String scope, String ruleId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(scope, ruleId, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String scope, String ruleId) { + return this.beginDeleteAsync(scope, ruleId).getSyncPoller(); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String scope, String ruleId, Context context) { + return this.beginDeleteAsync(scope, ruleId, context).getSyncPoller(); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String ruleId) { + return beginDeleteAsync(scope, ruleId).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String ruleId, Context context) { + return beginDeleteAsync(scope, ruleId, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String ruleId) { + deleteAsync(scope, ruleId).block(); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String ruleId, Context context) { + deleteAsync(scope, ruleId, context).block(); + } + + /** + * Get a list of all relevant governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules 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 = "2022-01-01-preview"; + 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 governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules 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 = "2022-01-01-preview"; + 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 governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules 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 governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules 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 governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules 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 governance rules over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all relevant governance rules 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)); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (executeGovernanceRuleParams != null) { + executeGovernanceRuleParams.validate(); + } + final String apiVersion = "2022-01-01-preview"; + return FluxUtil + .withContext(context -> service.execute(this.client.getEndpoint(), apiVersion, scope, ruleId, + executeGovernanceRuleParams, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams, 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (executeGovernanceRuleParams != null) { + executeGovernanceRuleParams.validate(); + } + final String apiVersion = "2022-01-01-preview"; + context = this.client.mergeContext(context); + return service.execute(this.client.getEndpoint(), apiVersion, scope, ruleId, executeGovernanceRuleParams, + context); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExecuteAsync(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams) { + Mono>> mono = executeWithResponseAsync(scope, ruleId, executeGovernanceRuleParams); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExecuteAsync(String scope, String ruleId) { + final ExecuteGovernanceRuleParams executeGovernanceRuleParams = null; + Mono>> mono = executeWithResponseAsync(scope, ruleId, executeGovernanceRuleParams); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExecuteAsync(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = executeWithResponseAsync(scope, ruleId, executeGovernanceRuleParams, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExecute(String scope, String ruleId) { + final ExecuteGovernanceRuleParams executeGovernanceRuleParams = null; + return this.beginExecuteAsync(scope, ruleId, executeGovernanceRuleParams).getSyncPoller(); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExecute(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context) { + return this.beginExecuteAsync(scope, ruleId, executeGovernanceRuleParams, context).getSyncPoller(); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams) { + return beginExecuteAsync(scope, ruleId, executeGovernanceRuleParams).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String scope, String ruleId) { + final ExecuteGovernanceRuleParams executeGovernanceRuleParams = null; + return beginExecuteAsync(scope, ruleId, executeGovernanceRuleParams).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context) { + return beginExecuteAsync(scope, ruleId, executeGovernanceRuleParams, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute(String scope, String ruleId) { + final ExecuteGovernanceRuleParams executeGovernanceRuleParams = null; + executeAsync(scope, ruleId, executeGovernanceRuleParams).block(); + } + + /** + * Execute a governance rule. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @param executeGovernanceRuleParams Execute governance rule over a given 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute(String scope, String ruleId, ExecuteGovernanceRuleParams executeGovernanceRuleParams, + Context context) { + executeAsync(scope, ruleId, executeGovernanceRuleParams, context).block(); + } + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the governance rule. + * @param ruleId The governance rule key. + * @param operationId The governance rule long running operation unique key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 governance rules long run operation result for the requested scope by ruleId and operationId on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono operationResultsWithResponseAsync(String scope, String ruleId, + String operationId) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.operationResults(this.client.getEndpoint(), apiVersion, scope, ruleId, + operationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the governance rule. + * @param ruleId The governance rule key. + * @param operationId The governance rule long running operation unique key. + * @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 governance rules long run operation result for the requested scope by ruleId and operationId on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono operationResultsWithResponseAsync(String scope, String ruleId, + String operationId, 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.operationResults(this.client.getEndpoint(), apiVersion, scope, ruleId, operationId, accept, + context); + } + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the governance rule. + * @param ruleId The governance rule key. + * @param operationId The governance rule long running operation unique key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 governance rules long run operation result for the requested scope by ruleId and operationId on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono operationResultsAsync(String scope, String ruleId, String operationId) { + return operationResultsWithResponseAsync(scope, ruleId, operationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the governance rule. + * @param ruleId The governance rule key. + * @param operationId The governance rule long running operation unique key. + * @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 governance rules long run operation result for the requested scope by ruleId and operationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GovernanceRulesOperationResultsResponse operationResultsWithResponse(String scope, String ruleId, + String operationId, Context context) { + return operationResultsWithResponseAsync(scope, ruleId, operationId, context).block(); + } + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the governance rule. + * @param ruleId The governance rule key. + * @param operationId The governance rule long running operation unique key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 governance rules long run operation result for the requested scope by ruleId and operationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationResultInner operationResults(String scope, String ruleId, String operationId) { + return operationResultsWithResponse(scope, ruleId, operationId, 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 a list of all relevant governance rules over a scope 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 all relevant governance rules over a scope 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/GovernanceRulesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesImpl.java new file mode 100644 index 000000000000..531998472d11 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.GovernanceRulesClient; +import com.azure.resourcemanager.security.fluent.models.GovernanceRuleInner; +import com.azure.resourcemanager.security.fluent.models.OperationResultInner; +import com.azure.resourcemanager.security.models.ExecuteGovernanceRuleParams; +import com.azure.resourcemanager.security.models.GovernanceRule; +import com.azure.resourcemanager.security.models.GovernanceRules; +import com.azure.resourcemanager.security.models.GovernanceRulesOperationResultsResponse; +import com.azure.resourcemanager.security.models.OperationResult; + +public final class GovernanceRulesImpl implements GovernanceRules { + private static final ClientLogger LOGGER = new ClientLogger(GovernanceRulesImpl.class); + + private final GovernanceRulesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public GovernanceRulesImpl(GovernanceRulesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String scope, String ruleId, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, ruleId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GovernanceRuleImpl(inner.getValue(), this.manager())); + } + + public GovernanceRule get(String scope, String ruleId) { + GovernanceRuleInner inner = this.serviceClient().get(scope, ruleId); + if (inner != null) { + return new GovernanceRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String scope, String ruleId) { + this.serviceClient().delete(scope, ruleId); + } + + public void delete(String scope, String ruleId, Context context) { + this.serviceClient().delete(scope, ruleId, context); + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GovernanceRuleImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GovernanceRuleImpl(inner1, this.manager())); + } + + public void execute(String scope, String ruleId) { + this.serviceClient().execute(scope, ruleId); + } + + public void execute(String scope, String ruleId, ExecuteGovernanceRuleParams executeGovernanceRuleParams, + Context context) { + this.serviceClient().execute(scope, ruleId, executeGovernanceRuleParams, context); + } + + public Response operationResultsWithResponse(String scope, String ruleId, String operationId, + Context context) { + GovernanceRulesOperationResultsResponse inner + = this.serviceClient().operationResultsWithResponse(scope, ruleId, operationId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationResult operationResults(String scope, String ruleId, String operationId) { + OperationResultInner inner = this.serviceClient().operationResults(scope, ruleId, operationId); + if (inner != null) { + return new OperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public GovernanceRule getById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceRules'.", id))); + } + return this.getWithResponse(scope, ruleId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceRules'.", id))); + } + return this.getWithResponse(scope, ruleId, context); + } + + public void deleteById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceRules'.", id))); + } + this.delete(scope, ruleId, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}", "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'governanceRules'.", id))); + } + this.delete(scope, ruleId, context); + } + + private GovernanceRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public GovernanceRuleImpl define(String name) { + return new GovernanceRuleImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportImpl.java new file mode 100644 index 000000000000..2c0342e85176 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.HealthReportInner; +import com.azure.resourcemanager.security.models.EnvironmentDetails; +import com.azure.resourcemanager.security.models.HealthDataClassification; +import com.azure.resourcemanager.security.models.HealthReport; +import com.azure.resourcemanager.security.models.HealthReportResourceDetails; +import com.azure.resourcemanager.security.models.HealthReportStatus; +import com.azure.resourcemanager.security.models.Issue; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class HealthReportImpl implements HealthReport { + private HealthReportInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + HealthReportImpl(HealthReportInner 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 HealthReportResourceDetails resourceDetails() { + return this.innerModel().resourceDetails(); + } + + public EnvironmentDetails environmentDetails() { + return this.innerModel().environmentDetails(); + } + + public HealthDataClassification healthDataClassification() { + return this.innerModel().healthDataClassification(); + } + + public HealthReportStatus status() { + return this.innerModel().status(); + } + + public List affectedDefendersPlans() { + List inner = this.innerModel().affectedDefendersPlans(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List affectedDefendersSubPlans() { + List inner = this.innerModel().affectedDefendersSubPlans(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map reportAdditionalData() { + Map inner = this.innerModel().reportAdditionalData(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public List issues() { + List inner = this.innerModel().issues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public HealthReportInner 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/HealthReportsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsClientImpl.java new file mode 100644 index 000000000000..7ffbce7c96e2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsClientImpl.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.HealthReportsClient; +import com.azure.resourcemanager.security.fluent.models.HealthReportInner; +import com.azure.resourcemanager.security.implementation.models.HealthReportsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in HealthReportsClient. + */ +public final class HealthReportsClientImpl implements HealthReportsClient { + /** + * The proxy service used to perform REST calls. + */ + private final HealthReportsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of HealthReportsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HealthReportsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(HealthReportsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterHealthReports to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterHealthReports") + public interface HealthReportsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/healthReports/{healthReportName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("healthReportName") String healthReportName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/healthReports") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get health report of resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param healthReportName The health report key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 health report of resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, String healthReportName) { + 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 (healthReportName == null) { + return Mono + .error(new IllegalArgumentException("Parameter healthReportName is required and cannot be null.")); + } + final String apiVersion = "2023-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, healthReportName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get health report of resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param healthReportName The health report key. + * @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 health report of resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, String healthReportName, + 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 (healthReportName == null) { + return Mono + .error(new IllegalArgumentException("Parameter healthReportName is required and cannot be null.")); + } + final String apiVersion = "2023-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, healthReportName, accept, context); + } + + /** + * Get health report of resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param healthReportName The health report key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 health report of resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String healthReportName) { + return getWithResponseAsync(resourceId, healthReportName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get health report of resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param healthReportName The health report key. + * @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 health report of resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, String healthReportName, Context context) { + return getWithResponseAsync(resourceId, healthReportName, context).block(); + } + + /** + * Get health report of resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param healthReportName The health report key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 health report of resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthReportInner get(String resourceId, String healthReportName) { + return getWithResponse(resourceId, healthReportName, Context.NONE).getValue(); + } + + /** + * Get a list of all health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside 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 = "2023-05-01-preview"; + 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 health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside 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 = "2023-05-01-preview"; + 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 health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside 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 health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside 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 health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside 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 health reports inside a scope. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * + * @param scope The fully qualified Azure Resource manager identifier 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 all health reports inside 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 a list of all health reports inside a scope 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 all health reports inside a scope 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/HealthReportsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsImpl.java new file mode 100644 index 000000000000..251876f4a1c6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.HealthReportsClient; +import com.azure.resourcemanager.security.fluent.models.HealthReportInner; +import com.azure.resourcemanager.security.models.HealthReport; +import com.azure.resourcemanager.security.models.HealthReports; + +public final class HealthReportsImpl implements HealthReports { + private static final ClientLogger LOGGER = new ClientLogger(HealthReportsImpl.class); + + private final HealthReportsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public HealthReportsImpl(HealthReportsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceId, String healthReportName, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceId, healthReportName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HealthReportImpl(inner.getValue(), this.manager())); + } + + public HealthReport get(String resourceId, String healthReportName) { + HealthReportInner inner = this.serviceClient().get(resourceId, healthReportName); + if (inner != null) { + return new HealthReportImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HealthReportImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HealthReportImpl(inner1, this.manager())); + } + + private HealthReportsClient 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/InformationProtectionPoliciesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java new file mode 100644 index 000000000000..a4d699fb8045 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.InformationProtectionPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.implementation.models.InformationProtectionPolicyList; +import com.azure.resourcemanager.security.models.InformationProtectionPolicyName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in InformationProtectionPoliciesClient. + */ +public final class InformationProtectionPoliciesClientImpl implements InformationProtectionPoliciesClient { + /** + * The proxy service used to perform REST calls. + */ + private final InformationProtectionPoliciesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of InformationProtectionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InformationProtectionPoliciesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(InformationProtectionPoliciesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterInformationProtectionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterInformationProtectionPolicies") + public interface InformationProtectionPoliciesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") InformationProtectionPolicyName informationProtectionPolicyName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") InformationProtectionPolicyName informationProtectionPolicyName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") InformationProtectionPolicyInner informationProtectionPolicy, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/informationProtectionPolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 information protection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, + InformationProtectionPolicyName informationProtectionPolicyName) { + 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 (informationProtectionPolicyName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, scope, + informationProtectionPolicyName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @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 information protection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, 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 (informationProtectionPolicyName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, informationProtectionPolicyName, accept, + context); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 information protection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, + InformationProtectionPolicyName informationProtectionPolicyName) { + return getWithResponseAsync(scope, informationProtectionPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @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 information protection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, Context context) { + return getWithResponseAsync(scope, informationProtectionPolicyName, context).block(); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InformationProtectionPolicyInner get(String scope, + InformationProtectionPolicyName informationProtectionPolicyName) { + return getWithResponse(scope, informationProtectionPolicyName, Context.NONE).getValue(); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 information protection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy) { + 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 (informationProtectionPolicyName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + if (informationProtectionPolicy == null) { + return Mono.error( + new IllegalArgumentException("Parameter informationProtectionPolicy is required and cannot be null.")); + } else { + informationProtectionPolicy.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, + informationProtectionPolicyName, contentType, accept, informationProtectionPolicy, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @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 information protection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy, 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 (informationProtectionPolicyName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + if (informationProtectionPolicy == null) { + return Mono.error( + new IllegalArgumentException("Parameter informationProtectionPolicy is required and cannot be null.")); + } else { + informationProtectionPolicy.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, informationProtectionPolicyName, + contentType, accept, informationProtectionPolicy, context); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 information protection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy) { + return createOrUpdateWithResponseAsync(scope, informationProtectionPolicyName, informationProtectionPolicy) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @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 information protection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy, Context context) { + return createOrUpdateWithResponseAsync(scope, informationProtectionPolicyName, informationProtectionPolicy, + context).block(); + } + + /** + * Details of the information protection policy. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param informationProtectionPolicyName Name of the information protection policy. + * @param informationProtectionPolicy Information protection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 information protection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InformationProtectionPolicyInner createOrUpdate(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, + InformationProtectionPolicyInner informationProtectionPolicy) { + return createOrUpdateWithResponse(scope, informationProtectionPolicyName, informationProtectionPolicy, + Context.NONE).getValue(); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response 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 = "2017-08-01-preview"; + 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())); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response 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 = "2017-08-01-preview"; + 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)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response 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)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Information protection policies of a specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 information protection policies response 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 information protection policies response 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 information protection policies response 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/InformationProtectionPoliciesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesImpl.java new file mode 100644 index 000000000000..181bddd1985e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesImpl.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.InformationProtectionPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.models.InformationProtectionPolicies; +import com.azure.resourcemanager.security.models.InformationProtectionPolicy; +import com.azure.resourcemanager.security.models.InformationProtectionPolicyName; + +public final class InformationProtectionPoliciesImpl implements InformationProtectionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(InformationProtectionPoliciesImpl.class); + + private final InformationProtectionPoliciesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public InformationProtectionPoliciesImpl(InformationProtectionPoliciesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String scope, + InformationProtectionPolicyName informationProtectionPolicyName, Context context) { + Response inner + = this.serviceClient().getWithResponse(scope, informationProtectionPolicyName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new InformationProtectionPolicyImpl(inner.getValue(), this.manager())); + } + + public InformationProtectionPolicy get(String scope, + InformationProtectionPolicyName informationProtectionPolicyName) { + InformationProtectionPolicyInner inner = this.serviceClient().get(scope, informationProtectionPolicyName); + if (inner != null) { + return new InformationProtectionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new InformationProtectionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new InformationProtectionPolicyImpl(inner1, this.manager())); + } + + public InformationProtectionPolicy getById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", + "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String informationProtectionPolicyNameLocal = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", + "informationProtectionPolicyName"); + if (informationProtectionPolicyNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'informationProtectionPolicies'.", id))); + } + InformationProtectionPolicyName informationProtectionPolicyName + = InformationProtectionPolicyName.fromString(informationProtectionPolicyNameLocal); + return this.getWithResponse(scope, informationProtectionPolicyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", + "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String informationProtectionPolicyNameLocal = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", + "informationProtectionPolicyName"); + if (informationProtectionPolicyNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'informationProtectionPolicies'.", id))); + } + InformationProtectionPolicyName informationProtectionPolicyName + = InformationProtectionPolicyName.fromString(informationProtectionPolicyNameLocal); + return this.getWithResponse(scope, informationProtectionPolicyName, context); + } + + private InformationProtectionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public InformationProtectionPolicyImpl define(InformationProtectionPolicyName name) { + return new InformationProtectionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPolicyImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPolicyImpl.java new file mode 100644 index 000000000000..43629489a831 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPolicyImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.InformationProtectionPolicyInner; +import com.azure.resourcemanager.security.models.InformationProtectionPolicy; +import com.azure.resourcemanager.security.models.InformationProtectionPolicyName; +import com.azure.resourcemanager.security.models.InformationType; +import com.azure.resourcemanager.security.models.SensitivityLabel; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class InformationProtectionPolicyImpl + implements InformationProtectionPolicy, InformationProtectionPolicy.Definition, InformationProtectionPolicy.Update { + private InformationProtectionPolicyInner 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 OffsetDateTime lastModifiedUtc() { + return this.innerModel().lastModifiedUtc(); + } + + public String version() { + return this.innerModel().version(); + } + + public Map labels() { + Map inner = this.innerModel().labels(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Map informationTypes() { + Map inner = this.innerModel().informationTypes(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public InformationProtectionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String scope; + + private InformationProtectionPolicyName informationProtectionPolicyName; + + public InformationProtectionPolicyImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public InformationProtectionPolicy create() { + this.innerObject = serviceManager.serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public InformationProtectionPolicy create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + InformationProtectionPolicyImpl(InformationProtectionPolicyName name, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new InformationProtectionPolicyInner(); + this.serviceManager = serviceManager; + this.informationProtectionPolicyName = name; + } + + public InformationProtectionPolicyImpl update() { + return this; + } + + public InformationProtectionPolicy apply() { + this.innerObject = serviceManager.serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public InformationProtectionPolicy apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInformationProtectionPolicies() + .createOrUpdateWithResponse(scope, informationProtectionPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + InformationProtectionPolicyImpl(InformationProtectionPolicyInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", + "scope"); + this.informationProtectionPolicyName = InformationProtectionPolicyName + .fromString(ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", + "informationProtectionPolicyName")); + } + + public InformationProtectionPolicy refresh() { + this.innerObject = serviceManager.serviceClient() + .getInformationProtectionPolicies() + .getWithResponse(scope, informationProtectionPolicyName, Context.NONE) + .getValue(); + return this; + } + + public InformationProtectionPolicy refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInformationProtectionPolicies() + .getWithResponse(scope, informationProtectionPolicyName, context) + .getValue(); + return this; + } + + public InformationProtectionPolicyImpl withLabels(Map labels) { + this.innerModel().withLabels(labels); + return this; + } + + public InformationProtectionPolicyImpl withInformationTypes(Map informationTypes) { + this.innerModel().withInformationTypes(informationTypes); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedAlertImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedAlertImpl.java index 261157ce0e67..42c86de9d071 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedAlertImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedAlertImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlert; import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem; @@ -45,6 +46,10 @@ public Map tags() { } } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String alertType() { return this.innerModel().alertType(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedRecommendationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedRecommendationImpl.java index 9ca207df4dd1..170a2357362e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedRecommendationImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecurityAggregatedRecommendationImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; import com.azure.resourcemanager.security.models.IoTSecurityAggregatedRecommendation; import com.azure.resourcemanager.security.models.ReportedSeverity; @@ -42,6 +43,10 @@ public Map tags() { } } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String recommendationName() { return this.innerModel().recommendationName(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelImpl.java index 0672331599ce..f4ca2f5b2eb8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; import com.azure.resourcemanager.security.models.IoTSecurityAlertedDevice; import com.azure.resourcemanager.security.models.IoTSecurityDeviceAlert; @@ -37,6 +38,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public IoTSeverityMetrics metrics() { return this.innerModel().metrics(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelListImpl.java index 78216c812dc4..ccfb31e399a7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelListImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionAnalyticsModelListImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionModelImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionModelImpl.java index 670650a621d8..d7270f171e7c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionModelImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IoTSecuritySolutionModelImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -39,14 +39,6 @@ public String type() { return this.innerModel().type(); } - public String location() { - return this.innerModel().location(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - public Map tags() { Map inner = this.innerModel().tags(); if (inner != null) { @@ -56,6 +48,14 @@ public Map tags() { } } + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String workspace() { return this.innerModel().workspace(); } @@ -311,6 +311,6 @@ public IoTSecuritySolutionModelImpl withUnmaskedIpLoggingStatus(UnmaskedIpLoggin } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java index d7feb1c6f78a..393acfa26d21 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -55,42 +55,41 @@ public final class IotSecuritySolutionAnalyticsClientImpl implements IotSecurity * The interface defining all the services for SecurityCenterIotSecuritySolutionAnalytics to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterIotSec") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterIotSecuritySolutionAnalytics") public interface IotSecuritySolutionAnalyticsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @HeaderParam("Accept") String accept, Context context); } /** - * Use this method to get IoT security Analytics metrics in an array. + * Use this method to get IoT Security Analytics metrics. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Security analytics of your IoT Security solution along with {@link Response} on successful - * completion of {@link Mono}. + * @return security analytics of your IoT Security solution along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String resourceGroupName, + private Mono> getWithResponseAsync(String resourceGroupName, String solutionName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -110,26 +109,25 @@ private Mono> listWithRespo final String apiVersion = "2019-08-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, solutionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Use this method to get IoT security Analytics metrics in an array. + * Use this method to get IoT Security Analytics metrics. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 Security analytics of your IoT Security solution along with {@link Response} on successful - * completion of {@link Mono}. + * @return security analytics of your IoT Security solution along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String resourceGroupName, + private Mono> getWithResponseAsync(String resourceGroupName, String solutionName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -149,74 +147,70 @@ private Mono> listWithRespo final String apiVersion = "2019-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, solutionName, accept, context); } /** - * Use this method to get IoT security Analytics metrics in an array. + * Use this method to get IoT Security Analytics metrics. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Security analytics of your IoT Security solution on successful completion of {@link Mono}. + * @return security analytics of your IoT Security solution on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listAsync(String resourceGroupName, String solutionName) { - return listWithResponseAsync(resourceGroupName, solutionName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono getAsync(String resourceGroupName, String solutionName) { + return getWithResponseAsync(resourceGroupName, solutionName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Use this method to get IoT security Analytics metrics in an array. + * Use this method to get IoT Security Analytics metrics. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 Security analytics of your IoT Security solution along with {@link Response}. + * @return security analytics of your IoT Security solution along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(String resourceGroupName, + public Response getWithResponse(String resourceGroupName, String solutionName, Context context) { - return listWithResponseAsync(resourceGroupName, solutionName, context).block(); + return getWithResponseAsync(resourceGroupName, solutionName, context).block(); } /** - * Use this method to get IoT security Analytics metrics in an array. + * Use this method to get IoT Security Analytics metrics. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Security analytics of your IoT Security solution. + * @return security analytics of your IoT Security solution. */ @ServiceMethod(returns = ReturnType.SINGLE) - public IoTSecuritySolutionAnalyticsModelListInner list(String resourceGroupName, String solutionName) { - return listWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); + public IoTSecuritySolutionAnalyticsModelInner get(String resourceGroupName, String solutionName) { + return getWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); } /** - * Use this method to get IoT Security Analytics metrics. + * Use this method to get IoT security Analytics metrics in an array. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 analytics of your IoT Security solution along with {@link Response} on successful completion of - * {@link Mono}. + * @return list of Security analytics of your IoT Security solution along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, + private Mono> listWithResponseAsync(String resourceGroupName, String solutionName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -236,26 +230,25 @@ private Mono> getWithResponseAs final String apiVersion = "2019-08-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, solutionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Use this method to get IoT Security Analytics metrics. + * Use this method to get IoT security Analytics metrics in an array. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 analytics of your IoT Security solution along with {@link Response} on successful completion of - * {@link Mono}. + * @return list of Security analytics of your IoT Security solution along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, + private Mono> listWithResponseAsync(String resourceGroupName, String solutionName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -275,57 +268,54 @@ private Mono> getWithResponseAs final String apiVersion = "2019-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, solutionName, accept, context); } /** - * Use this method to get IoT Security Analytics metrics. + * Use this method to get IoT security Analytics metrics in an array. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 analytics of your IoT Security solution on successful completion of {@link Mono}. + * @return list of Security analytics of your IoT Security solution on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String solutionName) { - return getWithResponseAsync(resourceGroupName, solutionName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono listAsync(String resourceGroupName, String solutionName) { + return listWithResponseAsync(resourceGroupName, solutionName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Use this method to get IoT Security Analytics metrics. + * Use this method to get IoT security Analytics metrics in an array. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @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 analytics of your IoT Security solution along with {@link Response}. + * @return list of Security analytics of your IoT Security solution along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, + public Response listWithResponse(String resourceGroupName, String solutionName, Context context) { - return getWithResponseAsync(resourceGroupName, solutionName, context).block(); + return listWithResponseAsync(resourceGroupName, solutionName, context).block(); } /** - * Use this method to get IoT Security Analytics metrics. + * Use this method to get IoT security Analytics metrics in an array. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 analytics of your IoT Security solution. + * @return list of Security analytics of your IoT Security solution. */ @ServiceMethod(returns = ReturnType.SINGLE) - public IoTSecuritySolutionAnalyticsModelInner get(String resourceGroupName, String solutionName) { - return getWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); + public IoTSecuritySolutionAnalyticsModelListInner list(String resourceGroupName, String solutionName) { + return listWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); } } 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 269039c13994..22efae9cce91 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -28,43 +28,35 @@ public IotSecuritySolutionAnalyticsImpl(IotSecuritySolutionAnalyticsClient inner this.serviceManager = serviceManager; } - public Response listWithResponse(String resourceGroupName, - String solutionName, Context context) { - Response inner - = this.serviceClient().listWithResponse(resourceGroupName, solutionName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new IoTSecuritySolutionAnalyticsModelListImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public IoTSecuritySolutionAnalyticsModelList list(String resourceGroupName, String solutionName) { - IoTSecuritySolutionAnalyticsModelListInner inner = this.serviceClient().list(resourceGroupName, solutionName); - if (inner != null) { - return new IoTSecuritySolutionAnalyticsModelListImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getWithResponse(String resourceGroupName, String solutionName, Context context) { Response inner = this.serviceClient().getWithResponse(resourceGroupName, solutionName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new IoTSecuritySolutionAnalyticsModelImpl(inner.getValue(), this.manager())); + } + + public IoTSecuritySolutionAnalyticsModel get(String resourceGroupName, String solutionName) { + IoTSecuritySolutionAnalyticsModelInner inner = this.serviceClient().get(resourceGroupName, solutionName); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new IoTSecuritySolutionAnalyticsModelImpl(inner.getValue(), this.manager())); + return new IoTSecuritySolutionAnalyticsModelImpl(inner, this.manager()); } else { return null; } } - public IoTSecuritySolutionAnalyticsModel get(String resourceGroupName, String solutionName) { - IoTSecuritySolutionAnalyticsModelInner inner = this.serviceClient().get(resourceGroupName, solutionName); + public Response listWithResponse(String resourceGroupName, + String solutionName, Context context) { + Response inner + = this.serviceClient().listWithResponse(resourceGroupName, solutionName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new IoTSecuritySolutionAnalyticsModelListImpl(inner.getValue(), this.manager())); + } + + public IoTSecuritySolutionAnalyticsModelList list(String resourceGroupName, String solutionName) { + IoTSecuritySolutionAnalyticsModelListInner inner = this.serviceClient().list(resourceGroupName, solutionName); if (inner != null) { - return new IoTSecuritySolutionAnalyticsModelImpl(inner, this.manager()); + return new IoTSecuritySolutionAnalyticsModelListImpl(inner, this.manager()); } else { return null; } 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 fa845b52ee65..a87c7f6756b9 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -28,7 +28,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsAggregatedAlertsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; -import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertList; +import com.azure.resourcemanager.security.implementation.models.IoTSecurityAggregatedAlertList; import reactor.core.publisher.Mono; /** @@ -62,63 +62,62 @@ public final class IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl * The interface defining all the services for SecurityCenterIotSecuritySolutionsAnalyticsAggregatedAlerts to be * used by the proxy service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterIotSec") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterIotSecuritySolutionsAnalyticsAggregatedAlerts") public interface IotSecuritySolutionsAnalyticsAggregatedAlertsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, - @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + @PathParam("aggregatedAlertName") String aggregatedAlertName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, - @PathParam("aggregatedAlertName") String aggregatedAlertName, @HeaderParam("Accept") String accept, - Context context); + @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> dismiss(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + Mono> dismiss(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, - @PathParam("aggregatedAlertName") String aggregatedAlertName, @HeaderParam("Accept") String accept, - Context context); + @PathParam("aggregatedAlertName") String aggregatedAlertName, 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, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Use this method to get the aggregated alert list of yours IoT Security solution. + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param top Number of results to retrieve. + * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solution aggregated alert data along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return security Solution Aggregated Alert information along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String solutionName, Integer top) { + private Mono> getWithResponseAsync(String resourceGroupName, + String solutionName, String aggregatedAlertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -134,33 +133,35 @@ private Mono> listSinglePageAsync if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } + if (aggregatedAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } final String apiVersion = "2019-08-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, top, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, aggregatedAlertName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Use this method to get the aggregated alert list of yours IoT Security solution. + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param top Number of results to retrieve. + * @param aggregatedAlertName Identifier of the aggregated alert. * @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 IoT Security solution aggregated alert data along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return security Solution Aggregated Alert information along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String solutionName, Integer top, Context context) { + private Mono> getWithResponseAsync(String resourceGroupName, + String solutionName, String aggregatedAlertName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -176,126 +177,88 @@ private Mono> listSinglePageAsync if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } + if (aggregatedAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } final String apiVersion = "2019-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, - solutionName, top, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Use this method to get the aggregated alert list of yours IoT Security solution. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. - * @param top Number of results to retrieve. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String solutionName, - Integer top) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), - nextLink -> listNextSinglePageAsync(nextLink)); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + solutionName, aggregatedAlertName, accept, context); } /** - * Use this method to get the aggregated alert list of yours IoT Security solution. + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedFlux}. + * @return security Solution Aggregated Alert information on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String solutionName) { - final Integer top = null; - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), - nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String solutionName, + String aggregatedAlertName) { + return getWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Use this method to get the aggregated alert list of yours IoT Security solution. + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param top Number of results to retrieve. + * @param aggregatedAlertName Identifier of the aggregated alert. * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedFlux}. + * @return security Solution Aggregated Alert information along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String solutionName, - Integer top, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String solutionName, + String aggregatedAlertName, Context context) { + return getWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName, context).block(); } /** - * Use this method to get the aggregated alert list of yours IoT Security solution. + * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is + * performed by alert name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. + * @return security Solution Aggregated Alert information. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceGroupName, String solutionName) { - final Integer top = null; - return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top)); + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecurityAggregatedAlertInner get(String resourceGroupName, String solutionName, + String aggregatedAlertName) { + return getWithResponse(resourceGroupName, solutionName, aggregatedAlertName, Context.NONE).getValue(); } /** * Use this method to get the aggregated alert list of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param top Number of results to retrieve. - * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceGroupName, String solutionName, - Integer top, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top, context)); - } - - /** - * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is - * performed by alert name. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. - * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Solution Aggregated Alert information along with {@link Response} on successful completion of - * {@link Mono}. + * @return list of IoT Security solution aggregated alert data along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String solutionName, String aggregatedAlertName) { + private Mono> listSinglePageAsync(String resourceGroupName, + String solutionName, Integer top) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -311,36 +274,32 @@ private Mono> getWithResponseAsync(Str if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } - if (aggregatedAlertName == null) { - return Mono - .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); - } final String apiVersion = "2019-08-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, aggregatedAlertName, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, top, 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())); } /** - * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is - * performed by alert name. + * Use this method to get the aggregated alert list of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param aggregatedAlertName Identifier of the aggregated alert. + * @param top Number of results to retrieve. * @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 Solution Aggregated Alert information along with {@link Response} on successful completion of - * {@link Mono}. + * @return list of IoT Security solution aggregated alert data along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String solutionName, String aggregatedAlertName, Context context) { + private Mono> listSinglePageAsync(String resourceGroupName, + String solutionName, Integer top, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -356,81 +315,108 @@ private Mono> getWithResponseAsync(Str if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } - if (aggregatedAlertName == null) { - return Mono - .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); - } final String apiVersion = "2019-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, - solutionName, aggregatedAlertName, accept, context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + solutionName, top, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is - * performed by alert name. + * Use this method to get the aggregated alert list of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param aggregatedAlertName Identifier of the aggregated alert. + * @param top Number of results to retrieve. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Solution Aggregated Alert information on successful completion of {@link Mono}. + * @return list of IoT Security solution aggregated alert data as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String solutionName, - String aggregatedAlertName) { - return getWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String solutionName, + Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is - * performed by alert name. + * Use this method to get the aggregated alert list of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param aggregatedAlertName Identifier of the aggregated alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String solutionName) { + final Integer top = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. * @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 Solution Aggregated Alert information along with {@link Response}. + * @return list of IoT Security solution aggregated alert data as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String solutionName, - String aggregatedAlertName, Context context) { - return getWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String solutionName, + Integer top, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is - * performed by alert name. + * Use this method to get the aggregated alert list of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 Solution Aggregated Alert information. + * @return list of IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public IoTSecurityAggregatedAlertInner get(String resourceGroupName, String solutionName, - String aggregatedAlertName) { - return getWithResponse(resourceGroupName, solutionName, aggregatedAlertName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String solutionName) { + final Integer top = null; + return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top)); + } + + /** + * Use this method to get the aggregated alert list of yours IoT Security solution. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. + * @param top Number of results to retrieve. + * @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 IoT Security solution aggregated alert data as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String solutionName, + Integer top, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top, context)); } /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -461,18 +447,16 @@ private Mono> dismissWithResponseAsync(String resourceGroupName, .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); } final String apiVersion = "2019-08-01"; - final String accept = "application/json"; return FluxUtil .withContext(context -> service.dismiss(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, solutionName, aggregatedAlertName, accept, context)) + this.client.getSubscriptionId(), resourceGroupName, solutionName, aggregatedAlertName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedAlertName Identifier of the aggregated alert. * @param context The context to associate with this operation. @@ -504,17 +488,15 @@ private Mono> dismissWithResponseAsync(String resourceGroupName, .error(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); } final String apiVersion = "2019-08-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); return service.dismiss(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, aggregatedAlertName, accept, context); + resourceGroupName, solutionName, aggregatedAlertName, context); } /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -531,8 +513,7 @@ private Mono dismissAsync(String resourceGroupName, String solutionName, S /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedAlertName Identifier of the aggregated alert. * @param context The context to associate with this operation. @@ -550,8 +531,7 @@ public Response dismissWithResponse(String resourceGroupName, String solut /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedAlertName Identifier of the aggregated alert. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.java index 5875a3586a2d..d39912cb4e16 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,31 +30,12 @@ public IotSecuritySolutionsAnalyticsAggregatedAlertsImpl( this.serviceManager = serviceManager; } - public PagedIterable list(String resourceGroupName, String solutionName) { - PagedIterable inner - = this.serviceClient().list(resourceGroupName, solutionName); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new IoTSecurityAggregatedAlertImpl(inner1, this.manager())); - } - - public PagedIterable list(String resourceGroupName, String solutionName, Integer top, - Context context) { - PagedIterable inner - = this.serviceClient().list(resourceGroupName, solutionName, top, context); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new IoTSecurityAggregatedAlertImpl(inner1, this.manager())); - } - public Response getWithResponse(String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { Response inner = this.serviceClient().getWithResponse(resourceGroupName, solutionName, aggregatedAlertName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new IoTSecurityAggregatedAlertImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new IoTSecurityAggregatedAlertImpl(inner.getValue(), this.manager())); } public IoTSecurityAggregatedAlert get(String resourceGroupName, String solutionName, String aggregatedAlertName) { @@ -67,6 +48,21 @@ public IoTSecurityAggregatedAlert get(String resourceGroupName, String solutionN } } + public PagedIterable list(String resourceGroupName, String solutionName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, solutionName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new IoTSecurityAggregatedAlertImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String solutionName, Integer top, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, solutionName, top, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new IoTSecurityAggregatedAlertImpl(inner1, this.manager())); + } + public Response dismissWithResponse(String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { return this.serviceClient().dismissWithResponse(resourceGroupName, solutionName, aggregatedAlertName, context); 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 509f2eb5cc46..ad4b8ab05971 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsRecommendationsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; -import com.azure.resourcemanager.security.models.IoTSecurityAggregatedRecommendationList; +import com.azure.resourcemanager.security.implementation.models.IoTSecurityAggregatedRecommendationList; import reactor.core.publisher.Mono; /** @@ -61,14 +61,14 @@ public final class IotSecuritySolutionsAnalyticsRecommendationsClientImpl * The interface defining all the services for SecurityCenterIotSecuritySolutionsAnalyticsRecommendations to be used * by the proxy service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterIotSec") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterIotSecuritySolutionsAnalyticsRecommendations") public interface IotSecuritySolutionsAnalyticsRecommendationsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @PathParam("aggregatedRecommendationName") String aggregatedRecommendationName, @@ -78,7 +78,7 @@ Mono> get(@HostParam("$host") @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); @@ -88,7 +88,7 @@ Mono> list(@HostParam("$host") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } @@ -96,8 +96,7 @@ Mono> listNext( * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -140,8 +139,7 @@ private Mono> getWithResponse * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. * @param context The context to associate with this operation. @@ -184,8 +182,7 @@ private Mono> getWithResponse * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -204,8 +201,7 @@ private Mono getAsync(String resourceG * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. * @param context The context to associate with this operation. @@ -224,8 +220,7 @@ public Response getWithResponse(String * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param aggregatedRecommendationName Name of the recommendation aggregated for this query. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -242,8 +237,7 @@ public IoTSecurityAggregatedRecommendationInner get(String resourceGroupName, St /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param top Number of results to retrieve. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -284,8 +278,7 @@ private Mono> listSingle /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param top Number of results to retrieve. * @param context The context to associate with this operation. @@ -326,8 +319,7 @@ private Mono> listSingle /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param top Number of results to retrieve. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -345,8 +337,7 @@ private PagedFlux listAsync(String res /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -364,8 +355,7 @@ private PagedFlux listAsync(String res /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param top Number of results to retrieve. * @param context The context to associate with this operation. @@ -384,8 +374,7 @@ private PagedFlux listAsync(String res /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -402,8 +391,7 @@ public PagedIterable list(String resou /** * Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. * @param top Number of results to retrieve. * @param context The context to associate with this operation. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsImpl.java index bff70b76b0ff..c8e4e7bed2db 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -33,12 +33,8 @@ public Response getWithResponse(String reso String aggregatedRecommendationName, Context context) { Response inner = this.serviceClient() .getWithResponse(resourceGroupName, solutionName, aggregatedRecommendationName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new IoTSecurityAggregatedRecommendationImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new IoTSecurityAggregatedRecommendationImpl(inner.getValue(), this.manager())); } public IoTSecurityAggregatedRecommendation get(String resourceGroupName, String solutionName, 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 17c1d752af04..296c223f0727 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -31,7 +31,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; -import com.azure.resourcemanager.security.models.IoTSecuritySolutionsList; +import com.azure.resourcemanager.security.implementation.models.IoTSecuritySolutionsList; import com.azure.resourcemanager.security.models.UpdateIotSecuritySolutionData; import reactor.core.publisher.Mono; @@ -64,92 +64,94 @@ public final class IotSecuritySolutionsClientImpl implements IotSecuritySolution * The interface defining all the services for SecurityCenterIotSecuritySolutions to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterIotSec") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterIotSecuritySolutions") public interface IotSecuritySolutionsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$filter") String filter, - @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("$host") String endpoint, + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, - @BodyParam("application/json") IoTSecuritySolutionModelInner iotSecuritySolutionData, - @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") IoTSecuritySolutionModelInner iotSecuritySolutionData, Context context); - @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("$host") String endpoint, + Mono> update(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, @BodyParam("application/json") UpdateIotSecuritySolutionData updateIotSecuritySolutionData, - @HeaderParam("Accept") String accept, Context context); + Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Use this method to get the list of IoT Security solutions by subscription. + * User this method to get details of a specific IoT Security solution based on solution name. * - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return ioT Security solution configuration and resource information along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String filter) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String solutionName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -158,28 +160,36 @@ private Mono> listSinglePageAsync(S 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 (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } final String apiVersion = "2019-08-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - filter, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, solutionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Use this method to get the list of IoT Security solutions by subscription. + * User this method to get details of a specific IoT Security solution based on solution name. * - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. * @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 IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return ioT Security solution configuration and resource information along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String filter, Context context) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String solutionName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -188,102 +198,83 @@ private Mono> listSinglePageAsync(S 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 (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } final String apiVersion = "2019-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), filter, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, accept, context); } /** - * Use this method to get the list of IoT Security solutions by subscription. + * User this method to get details of a specific IoT Security solution based on solution name. * - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solutions as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String filter) { - return new PagedFlux<>(() -> listSinglePageAsync(filter), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); - } - - /** - * Use this method to get the list of IoT Security solutions by 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 list of IoT Security solutions as paginated response with {@link PagedFlux}. + * @return ioT Security solution configuration and resource information on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - final String filter = null; - return new PagedFlux<>(() -> listSinglePageAsync(filter), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String solutionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, solutionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Use this method to get the list of IoT Security solutions by subscription. + * User this method to get details of a specific IoT Security solution based on solution name. * - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. * @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 IoT Security solutions as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String filter, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(filter, context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); - } - - /** - * Use this method to get the list of IoT Security solutions by 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 list of IoT Security solutions as paginated response with {@link PagedIterable}. + * @return ioT Security solution configuration and resource information along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - final String filter = null; - return new PagedIterable<>(listAsync(filter)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String solutionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, solutionName, context).block(); } /** - * Use this method to get the list of IoT Security solutions by subscription. + * User this method to get details of a specific IoT Security solution based on solution name. * - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solutions as paginated response with {@link PagedIterable}. + * @return ioT Security solution configuration and resource information. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String filter, Context context) { - return new PagedIterable<>(listAsync(filter, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecuritySolutionModelInner getByResourceGroup(String resourceGroupName, String solutionName) { + return getByResourceGroupWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); } /** - * Use this method to get the list IoT Security solutions organized by resource group. + * Use this method to create or update yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return ioT Security solution configuration and resource information along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName, String filter) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -296,31 +287,41 @@ public PagedIterable list(String filter, Context return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (iotSecuritySolutionData == null) { + return Mono.error( + new IllegalArgumentException("Parameter iotSecuritySolutionData is required and cannot be null.")); + } else { + iotSecuritySolutionData.validate(); + } final String apiVersion = "2019-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, filter, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, solutionName, contentType, accept, + iotSecuritySolutionData, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Use this method to get the list IoT Security solutions organized by resource group. + * Use this method to create or update yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. * @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 IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return ioT Security solution configuration and resource information along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName, String filter, Context context) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -333,109 +334,85 @@ public PagedIterable list(String filter, Context return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (solutionName == null) { + return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (iotSecuritySolutionData == null) { + return Mono.error( + new IllegalArgumentException("Parameter iotSecuritySolutionData is required and cannot be null.")); + } else { + iotSecuritySolutionData.validate(); + } final String apiVersion = "2019-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, filter, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Use this method to get the list IoT Security solutions organized by resource group. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 IoT Security solutions as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, contentType, accept, iotSecuritySolutionData, context); } /** - * Use this method to get the list IoT Security solutions organized by resource group. + * Use this method to create or update yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solutions as paginated response with {@link PagedFlux}. + * @return ioT Security solution configuration and resource information on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - final String filter = null; - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String solutionName, + IoTSecuritySolutionModelInner iotSecuritySolutionData) { + return createOrUpdateWithResponseAsync(resourceGroupName, solutionName, iotSecuritySolutionData) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Use this method to get the list IoT Security solutions organized by resource group. + * Use this method to create or update yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. * @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 IoT Security solutions as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter, - Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); - } - - /** - * Use this method to get the list IoT Security solutions organized by resource group. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 IoT Security solutions as paginated response with {@link PagedIterable}. + * @return ioT Security solution configuration and resource information along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - final String filter = null; - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, solutionName, iotSecuritySolutionData, context) + .block(); } /** - * Use this method to get the list IoT Security solutions organized by resource group. + * Use this method to create or update yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param solutionName The name of the IoT Security solution. + * @param iotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 IoT Security solutions as paginated response with {@link PagedIterable}. + * @return ioT Security solution configuration and resource information. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, String filter, - Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public IoTSecuritySolutionModelInner createOrUpdate(String resourceGroupName, String solutionName, + IoTSecuritySolutionModelInner iotSecuritySolutionData) { + return createOrUpdateWithResponse(resourceGroupName, solutionName, iotSecuritySolutionData, Context.NONE) + .getValue(); } /** - * User this method to get details of a specific IoT Security solution based on solution name. + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -443,8 +420,8 @@ public PagedIterable listByResourceGroup(String r * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String solutionName) { + private Mono> updateWithResponseAsync(String resourceGroupName, + String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -460,20 +437,29 @@ private Mono> getByResourceGroupWithResp if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } + if (updateIotSecuritySolutionData == null) { + return Mono.error(new IllegalArgumentException( + "Parameter updateIotSecuritySolutionData is required and cannot be null.")); + } else { + updateIotSecuritySolutionData.validate(); + } final String apiVersion = "2019-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, solutionName, accept, context)) + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, contentType, accept, updateIotSecuritySolutionData, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * User this method to get details of a specific IoT Security solution based on solution name. + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. * @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. @@ -482,8 +468,8 @@ private Mono> getByResourceGroupWithResp * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String solutionName, Context context) { + private Mono> updateWithResponseAsync(String resourceGroupName, + String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -499,36 +485,46 @@ private Mono> getByResourceGroupWithResp if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } + if (updateIotSecuritySolutionData == null) { + return Mono.error(new IllegalArgumentException( + "Parameter updateIotSecuritySolutionData is required and cannot be null.")); + } else { + updateIotSecuritySolutionData.validate(); + } final String apiVersion = "2019-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, accept, context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + solutionName, contentType, accept, updateIotSecuritySolutionData, context); } /** - * User this method to get details of a specific IoT Security solution based on solution name. + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String solutionName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, solutionName) + private Mono updateAsync(String resourceGroupName, String solutionName, + UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { + return updateWithResponseAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * User this method to get details of a specific IoT Security solution based on solution name. + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. * @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. @@ -536,43 +532,42 @@ private Mono getByResourceGroupAsync(String resou * @return ioT Security solution configuration and resource information along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String solutionName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, solutionName, context).block(); + public Response updateWithResponse(String resourceGroupName, String solutionName, + UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Context context) { + return updateWithResponseAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData, context).block(); } /** - * User this method to get details of a specific IoT Security solution based on solution name. + * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields + * use the CreateOrUpdate method. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. + * @param updateIotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information. */ @ServiceMethod(returns = ReturnType.SINGLE) - public IoTSecuritySolutionModelInner getByResourceGroup(String resourceGroupName, String solutionName) { - return getByResourceGroupWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); + public IoTSecuritySolutionModelInner update(String resourceGroupName, String solutionName, + UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { + return updateWithResponse(resourceGroupName, solutionName, updateIotSecuritySolutionData, Context.NONE) + .getValue(); } /** - * Use this method to create or update yours IoT Security solution. + * Use this method to delete yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param iotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information along with {@link Response} on successful - * completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String solutionName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -588,36 +583,27 @@ private Mono> createOrUpdateWithResponse if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } - if (iotSecuritySolutionData == null) { - return Mono.error( - new IllegalArgumentException("Parameter iotSecuritySolutionData is required and cannot be null.")); - } else { - iotSecuritySolutionData.validate(); - } final String apiVersion = "2019-08-01"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, solutionName, iotSecuritySolutionData, accept, context)) + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, solutionName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Use this method to create or update yours IoT Security solution. + * Use this method to delete yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param iotSecuritySolutionData The security solution data. * @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 ioT Security solution configuration and resource information along with {@link Response} on successful - * completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData, Context context) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String solutionName, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -633,94 +619,70 @@ private Mono> createOrUpdateWithResponse if (solutionName == null) { return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); } - if (iotSecuritySolutionData == null) { - return Mono.error( - new IllegalArgumentException("Parameter iotSecuritySolutionData is required and cannot be null.")); - } else { - iotSecuritySolutionData.validate(); - } final String apiVersion = "2019-08-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, iotSecuritySolutionData, accept, context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + solutionName, context); } /** - * Use this method to create or update yours IoT Security solution. + * Use this method to delete yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param iotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information on successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String solutionName, - IoTSecuritySolutionModelInner iotSecuritySolutionData) { - return createOrUpdateWithResponseAsync(resourceGroupName, solutionName, iotSecuritySolutionData) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono deleteAsync(String resourceGroupName, String solutionName) { + return deleteWithResponseAsync(resourceGroupName, solutionName).flatMap(ignored -> Mono.empty()); } /** - * Use this method to create or update yours IoT Security solution. + * Use this method to delete yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param iotSecuritySolutionData The security solution data. * @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 ioT Security solution configuration and resource information along with {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, - String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, solutionName, iotSecuritySolutionData, context) - .block(); + public Response deleteWithResponse(String resourceGroupName, String solutionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, solutionName, context).block(); } /** - * Use this method to create or update yours IoT Security solution. + * Use this method to delete yours IoT Security solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param solutionName The name of the IoT Security solution. - * @param iotSecuritySolutionData The security solution data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information. */ @ServiceMethod(returns = ReturnType.SINGLE) - public IoTSecuritySolutionModelInner createOrUpdate(String resourceGroupName, String solutionName, - IoTSecuritySolutionModelInner iotSecuritySolutionData) { - return createOrUpdateWithResponse(resourceGroupName, solutionName, iotSecuritySolutionData, Context.NONE) - .getValue(); + public void delete(String resourceGroupName, String solutionName) { + deleteWithResponse(resourceGroupName, solutionName, Context.NONE); } /** - * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields - * use the CreateOrUpdate method. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. - * @param updateIotSecuritySolutionData The security solution data. + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information along with {@link Response} on successful - * completion of {@link Mono}. + * @return list of IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName, String filter) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -733,42 +695,30 @@ private Mono> updateWithResponseAsync(St return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (solutionName == null) { - return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); - } - if (updateIotSecuritySolutionData == null) { - return Mono.error(new IllegalArgumentException( - "Parameter updateIotSecuritySolutionData is required and cannot be null.")); - } else { - updateIotSecuritySolutionData.validate(); - } final String apiVersion = "2019-08-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, updateIotSecuritySolutionData, accept, context)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, filter, 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())); } /** - * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields - * use the CreateOrUpdate method. + * Use this method to get the list IoT Security solutions organized by resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. - * @param updateIotSecuritySolutionData The security solution data. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. * @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 ioT Security solution configuration and resource information along with {@link Response} on successful - * completion of {@link Mono}. + * @return list of IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Context context) { + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName, String filter, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -781,95 +731,109 @@ private Mono> updateWithResponseAsync(St return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (solutionName == null) { - return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); - } - if (updateIotSecuritySolutionData == null) { - return Mono.error(new IllegalArgumentException( - "Parameter updateIotSecuritySolutionData is required and cannot be null.")); - } else { - updateIotSecuritySolutionData.validate(); - } final String apiVersion = "2019-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, - solutionName, updateIotSecuritySolutionData, accept, context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields - * use the CreateOrUpdate method. + * Use this method to get the list IoT Security solutions organized by resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. - * @param updateIotSecuritySolutionData The security solution data. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information on successful completion of {@link Mono}. + * @return list of IoT Security solutions as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String solutionName, - UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { - return updateWithResponseAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** - * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields - * use the CreateOrUpdate method. + * Use this method to get the list IoT Security solutions organized by resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. - * @param updateIotSecuritySolutionData The security solution data. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 IoT Security solutions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list IoT Security solutions organized by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. * @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 ioT Security solution configuration and resource information along with {@link Response}. + * @return list of IoT Security solutions as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceGroupName, String solutionName, - UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Context context) { - return updateWithResponseAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter, + Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** - * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields - * use the CreateOrUpdate method. + * Use this method to get the list IoT Security solutions organized by resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. - * @param updateIotSecuritySolutionData The security solution data. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 ioT Security solution configuration and resource information. + * @return list of IoT Security solutions as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public IoTSecuritySolutionModelInner update(String resourceGroupName, String solutionName, - UpdateIotSecuritySolutionData updateIotSecuritySolutionData) { - return updateWithResponse(resourceGroupName, solutionName, updateIotSecuritySolutionData, Context.NONE) - .getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); } /** - * Use this method to delete yours IoT Security solution. + * Use this method to get the list IoT Security solutions organized by resource group. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @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}. + * @return list of IoT Security solutions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String filter, + Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String solutionName) { + private Mono> listSinglePageAsync(String filter) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -878,36 +842,28 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S 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 (solutionName == null) { - return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); - } final String apiVersion = "2019-08-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, solutionName, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + filter, 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())); } /** - * Use this method to delete yours IoT Security solution. + * Use this method to get the list of IoT Security solutions by subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. * @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}. + * @return list of IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String solutionName, - Context context) { + private Mono> listSinglePageAsync(String filter, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -916,66 +872,86 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S 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 (solutionName == null) { - return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); - } final String apiVersion = "2019-08-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, - solutionName, accept, context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Use this method to delete yours IoT Security solution. + * Use this method to get the list of IoT Security solutions by subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return list of IoT Security solutions as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String solutionName) { - return deleteWithResponseAsync(resourceGroupName, solutionName).flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** - * Use this method to delete yours IoT Security solution. + * Use this method to get the list of IoT Security solutions by subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. + * @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 IoT Security solutions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. * @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}. + * @return list of IoT Security solutions as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String solutionName, Context context) { - return deleteWithResponseAsync(resourceGroupName, solutionName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); } /** - * Use this method to delete yours IoT Security solution. + * Use this method to get the list of IoT Security solutions by subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param solutionName The name of the IoT Security solution. + * @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 IoT Security solutions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Use this method to get the list of IoT Security solutions by subscription. + * + * @param filter Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + * @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 IoT Security solutions as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String solutionName) { - deleteWithResponse(resourceGroupName, solutionName, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); } /** @@ -988,7 +964,7 @@ public void delete(String resourceGroupName, String solutionName) { * @return list of IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -999,7 +975,7 @@ private Mono> listBySubscriptionNex final String accept = "application/json"; return FluxUtil .withContext( - context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + context -> service.listByResourceGroupNext(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())); @@ -1016,7 +992,7 @@ private Mono> listBySubscriptionNex * @return list of IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -1027,7 +1003,7 @@ private Mono> listBySubscriptionNex } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -1042,7 +1018,7 @@ private Mono> listBySubscriptionNex * @return list of IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1053,7 +1029,7 @@ private Mono> listByResourceGroupNe final String accept = "application/json"; return FluxUtil .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + context -> service.listBySubscriptionNext(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())); @@ -1070,7 +1046,7 @@ private Mono> listByResourceGroupNe * @return list of IoT Security solutions along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -1081,7 +1057,7 @@ private Mono> listByResourceGroupNe } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listBySubscriptionNext(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/IotSecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsImpl.java index d1c50ef8066f..adf7648b83b4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,39 +27,12 @@ public IotSecuritySolutionsImpl(IotSecuritySolutionsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); - } - - public PagedIterable list(String filter, Context context) { - PagedIterable inner = this.serviceClient().list(filter, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, String filter, - Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); - } - public Response getByResourceGroupWithResponse(String resourceGroupName, String solutionName, Context context) { Response inner = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, solutionName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new IoTSecuritySolutionModelImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new IoTSecuritySolutionModelImpl(inner.getValue(), this.manager())); } public IoTSecuritySolutionModel getByResourceGroup(String resourceGroupName, String solutionName) { @@ -80,6 +53,29 @@ public void deleteByResourceGroup(String resourceGroupName, String solutionName) this.serviceClient().delete(resourceGroupName, solutionName); } + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String filter, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IoTSecuritySolutionModelImpl(inner1, this.manager())); + } + public IoTSecuritySolutionModel getById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { 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 08e6b4e36e46..6d82ae0e3bad 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -32,7 +32,7 @@ import com.azure.resourcemanager.security.fluent.JitNetworkAccessPoliciesClient; import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; -import com.azure.resourcemanager.security.models.JitNetworkAccessPoliciesList; +import com.azure.resourcemanager.security.implementation.models.JitNetworkAccessPoliciesList; import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateRequest; import reactor.core.publisher.Mono; @@ -65,94 +65,90 @@ public final class JitNetworkAccessPoliciesClientImpl implements JitNetworkAcces * The interface defining all the services for SecurityCenterJitNetworkAccessPolicies to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterJitNet") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterJitNetworkAccessPolicies") public interface JitNetworkAccessPoliciesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByRegion(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") JitNetworkAccessPolicyInner body, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies") - @ExpectedResponses({ 200 }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") + @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupAndRegion(@HostParam("$host") String endpoint, + Mono> listByResourceGroupAndRegion( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> listByRegion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") - @ExpectedResponses({ 200 }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}") + @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono> initiate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") JitNetworkAccessPolicyInner body, @HeaderParam("Accept") String accept, - Context context); + @PathParam("jitNetworkAccessPolicyInitiateType") String jitNetworkAccessPolicyInitiateType, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") JitNetworkAccessPolicyInitiateRequest body, Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") - @ExpectedResponses({ 200, 204 }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}") - @ExpectedResponses({ 202 }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> initiate(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, - @PathParam("jitNetworkAccessPolicyInitiateType") String jitNetworkAccessPolicyInitiateType, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") JitNetworkAccessPolicyInitiateRequest body, - @HeaderParam("Accept") String accept, Context context); + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @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, + Mono> listByResourceGroupAndRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -160,35 +156,42 @@ Mono> listNext( @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupAndRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Policies for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, String jitNetworkAccessPolicyName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -197,27 +200,42 @@ private Mono> listSinglePageAsync() { 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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, - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Policies for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getWithResponseAsync(String resourceGroupName, + String ascLocation, String jitNetworkAccessPolicyName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -226,79 +244,99 @@ private Mono> listSinglePageAsync(Con 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + ascLocation, jitNetworkAccessPolicyName, accept, context); } /** - * Policies for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 paginated response with {@link PagedFlux}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName) { + return getWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Policies for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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 paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Policies for protecting resources using Just-in-Time access control. - * - * @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 paginated response with {@link PagedIterable}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context).block(); } /** - * Policies for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 paginated response with {@link PagedIterable}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName) { + return getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE).getValue(); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Create a policy for protecting resources using Just-in-Time access control. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 PagedResponse} on successful completion of {@link Mono}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByRegionSinglePageAsync(String ascLocation) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -307,33 +345,50 @@ private Mono> listByRegionSinglePageA 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } + if (jitNetworkAccessPolicyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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 contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), - ascLocation, apiVersion, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, jitNetworkAccessPolicyName, + contentType, accept, body, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Create a policy for protecting resources using Just-in-Time access control. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 PagedResponse} on successful completion of {@link Mono}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByRegionSinglePageAsync(String ascLocation, - Context context) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -342,96 +397,108 @@ private Mono> listByRegionSinglePageA 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } + if (jitNetworkAccessPolicyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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 contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listByRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, contentType, accept, body, context); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Create a policy for protecting resources using Just-in-Time access control. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedFlux}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listByRegionSinglePageAsync(ascLocation), - nextLink -> listByRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Create a policy for protecting resources using Just-in-Time access control. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedFlux}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByRegionAsync(String ascLocation, Context context) { - return new PagedFlux<>(() -> listByRegionSinglePageAsync(ascLocation, context), - nextLink -> listByRegionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, + context).block(); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Create a policy for protecting resources using Just-in-Time access control. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedIterable}. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByRegion(String ascLocation) { - return new PagedIterable<>(listByRegionAsync(ascLocation)); + @ServiceMethod(returns = ReturnType.SINGLE) + public JitNetworkAccessPolicyInner createOrUpdate(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body) { + return createOrUpdateWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, + Context.NONE).getValue(); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Delete a Just-in-Time access control policy. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @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 paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByRegion(String ascLocation, Context context) { - return new PagedIterable<>(listByRegionAsync(ascLocation, context)); - } - - /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -444,30 +511,36 @@ public PagedIterable listByRegion(String ascLocatio return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } final String apiVersion = "2020-01-01"; - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Delete a Just-in-Time access control policy. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -480,85 +553,76 @@ public PagedIterable listByRegion(String ascLocatio return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + return Mono.error( + new IllegalArgumentException("Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } final String apiVersion = "2020-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + ascLocation, jitNetworkAccessPolicyName, context); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Delete a Just-in-Time access control policy. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 paginated response with {@link PagedFlux}. + * @return A {@link Mono} that completes when a successful response is received. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + return deleteWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName) + .flatMap(ignored -> Mono.empty()); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Delete a Just-in-Time access control policy. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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 paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); - } - - /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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 paginated response with {@link PagedIterable}. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context).block(); } /** - * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * Delete a Just-in-Time access control policy. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { + deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE); } /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -587,8 +651,8 @@ public PagedIterable listByResourceGroup(String res final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByResourceGroupAndRegion(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, ascLocation, apiVersion, accept, context)) + .withContext(context -> service.listByResourceGroupAndRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, 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())); @@ -597,8 +661,7 @@ public PagedIterable listByResourceGroup(String res /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param context The context to associate with this operation. @@ -629,8 +692,8 @@ public PagedIterable listByResourceGroup(String res final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByResourceGroupAndRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - ascLocation, apiVersion, accept, context) + .listByResourceGroupAndRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -638,8 +701,7 @@ public PagedIterable listByResourceGroup(String res /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -657,8 +719,7 @@ private PagedFlux listByResourceGroupAndRegionAsync /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param context The context to associate with this operation. @@ -678,8 +739,7 @@ private PagedFlux listByResourceGroupAndRegionAsync /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -696,8 +756,7 @@ public PagedIterable listByResourceGroupAndRegion(S /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param context The context to associate with this operation. @@ -715,19 +774,15 @@ public PagedIterable listByResourceGroupAndRegion(S /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName) { + private Mono> listByRegionSinglePageAsync(String ascLocation) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -736,42 +791,33 @@ private Mono> getWithResponseAsync(String 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } - if (jitNetworkAccessPolicyName == null) { - return Mono.error( - new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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, ascLocation, jitNetworkAccessPolicyName, apiVersion, accept, context)) + .withContext(context -> service.listByRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, 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())); } /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName, Context context) { + private Mono> listByRegionSinglePageAsync(String ascLocation, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -780,88 +826,87 @@ private Mono> getWithResponseAsync(String 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 (ascLocation == null) { return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } - if (jitNetworkAccessPolicyName == null) { - return Mono.error( - new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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, ascLocation, - jitNetworkAccessPolicyName, apiVersion, accept, context); + return service + .listByRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName) { - return getWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listByRegionSinglePageAsync(ascLocation), + nextLink -> listByRegionNextSinglePageAsync(nextLink)); } /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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}. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRegionAsync(String ascLocation, Context context) { + return new PagedFlux<>(() -> listByRegionSinglePageAsync(ascLocation, context), + nextLink -> listByRegionNextSinglePageAsync(nextLink, context)); } /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return the paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName) { - return getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRegion(String ascLocation) { + return new PagedIterable<>(listByRegionAsync(ascLocation)); } /** - * Create a policy for protecting resources using Just-in-Time access control. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @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 paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRegion(String ascLocation, Context context) { + return new PagedIterable<>(listByRegionAsync(ascLocation, context)); + } + + /** + * Initiate a JIT access from a specific Just-in-Time policy configuration. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. @@ -872,8 +917,8 @@ public JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocat * @return the response body along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body) { + private Mono> initiateWithResponseAsync(String resourceGroupName, + String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -899,18 +944,20 @@ private Mono> createOrUpdateWithResponseAs body.validate(); } final String apiVersion = "2020-01-01"; + final String jitNetworkAccessPolicyInitiateType = "initiate"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, ascLocation, jitNetworkAccessPolicyName, apiVersion, body, accept, context)) + .withContext(context -> service.initiate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, jitNetworkAccessPolicyName, + jitNetworkAccessPolicyInitiateType, contentType, accept, body, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Create a policy for protecting resources using Just-in-Time access control. + * Initiate a JIT access from a specific Just-in-Time policy configuration. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. @@ -922,8 +969,9 @@ private Mono> createOrUpdateWithResponseAs * @return the response body along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body, Context context) { + private Mono> initiateWithResponseAsync(String resourceGroupName, + String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -949,17 +997,19 @@ private Mono> createOrUpdateWithResponseAs body.validate(); } final String apiVersion = "2020-01-01"; + final String jitNetworkAccessPolicyInitiateType = "initiate"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - ascLocation, jitNetworkAccessPolicyName, apiVersion, body, accept, context); + return service.initiate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, jitNetworkAccessPolicyInitiateType, contentType, + accept, body, context); } /** - * Create a policy for protecting resources using Just-in-Time access control. + * Initiate a JIT access from a specific Just-in-Time policy configuration. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. @@ -970,17 +1020,16 @@ private Mono> createOrUpdateWithResponseAs * @return the response body on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body) { - return createOrUpdateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body) + private Mono initiateAsync(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body) { + return initiateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Create a policy for protecting resources using Just-in-Time access control. + * Initiate a JIT access from a specific Just-in-Time policy configuration. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. @@ -992,17 +1041,16 @@ private Mono createOrUpdateAsync(String resourceGro * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, - context).block(); + public Response initiateWithResponse(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, Context context) { + return initiateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, context) + .block(); } /** - * Create a policy for protecting resources using Just-in-Time access control. + * Initiate a JIT access from a specific Just-in-Time policy configuration. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. @@ -1013,28 +1061,21 @@ public Response createOrUpdateWithResponse(String r * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public JitNetworkAccessPolicyInner createOrUpdate(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body) { - return createOrUpdateWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, - Context.NONE).getValue(); + public JitNetworkAccessRequestInner initiate(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body) { + return initiateWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, Context.NONE) + .getValue(); } - /** - * Delete a Just-in-Time access control policy. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @throws IllegalArgumentException thrown if parameters fail the validation. + /** + * Policies for protecting resources using Just-in-Time access control. + * * @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}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1043,42 +1084,27 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (jitNetworkAccessPolicyName == null) { - return Mono.error( - new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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(), - resourceGroupName, ascLocation, jitNetworkAccessPolicyName, apiVersion, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); } /** - * Delete a Just-in-Time access control policy. + * Policies for protecting resources using Just-in-Time access control. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1087,97 +1113,79 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (jitNetworkAccessPolicyName == null) { - return Mono.error( - new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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(), resourceGroupName, - ascLocation, jitNetworkAccessPolicyName, apiVersion, accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Delete a Just-in-Time access control policy. + * Policies for protecting resources using Just-in-Time access control. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { - return deleteWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName) - .flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Delete a Just-in-Time access control policy. + * Policies for protecting resources using Just-in-Time access control. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. * @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}. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, Context context) { - return deleteWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Delete a Just-in-Time access control policy. + * Policies for protecting resources using Just-in-Time access control. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. + * @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 paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Policies for protecting resources using Just-in-Time access control. + * + * @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 paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { - deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** - * Initiate a JIT access from a specific Just-in-Time policy configuration. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @param body The body parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> initiateWithResponseAsync(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body) { + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1190,47 +1198,29 @@ private Mono> initiateWithResponseAsync(S return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (jitNetworkAccessPolicyName == null) { - return Mono.error( - new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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 jitNetworkAccessPolicyInitiateType = "initiate"; final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.initiate(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, ascLocation, jitNetworkAccessPolicyName, jitNetworkAccessPolicyInitiateType, - apiVersion, body, accept, context)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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())); } /** - * Initiate a JIT access from a specific Just-in-Time policy configuration. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @param body The body parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> initiateWithResponseAsync(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, - Context context) { + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1243,89 +1233,74 @@ private Mono> initiateWithResponseAsync(S return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (jitNetworkAccessPolicyName == null) { - return Mono.error( - new IllegalArgumentException("Parameter jitNetworkAccessPolicyName 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 jitNetworkAccessPolicyInitiateType = "initiate"; final String apiVersion = "2020-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.initiate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - ascLocation, jitNetworkAccessPolicyName, jitNetworkAccessPolicyInitiateType, apiVersion, body, accept, - context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Initiate a JIT access from a specific Just-in-Time policy configuration. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @param body The body parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono initiateAsync(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body) { - return initiateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** - * Initiate a JIT access from a specific Just-in-Time policy configuration. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @param body The body parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response initiateWithResponse(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, Context context) { - return initiateWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, context) - .block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** - * Initiate a JIT access from a specific Just-in-Time policy configuration. + * Policies for protecting resources using Just-in-Time access control for the subscription, location. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param jitNetworkAccessPolicyName Name of a Just-in-Time access configuration policy. - * @param body The body parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return the paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public JitNetworkAccessRequestInner initiate(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body) { - return initiateWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, Context.NONE) - .getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Policies for protecting resources using Just-in-Time access control for the subscription, location. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); } /** @@ -1338,7 +1313,8 @@ public JitNetworkAccessRequestInner initiate(String resourceGroupName, String as * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> + listByResourceGroupAndRegionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1347,7 +1323,8 @@ private Mono> listNextSinglePageAsync 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)) + return FluxUtil.withContext( + context -> service.listByResourceGroupAndRegionNext(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())); @@ -1364,7 +1341,8 @@ private Mono> listNextSinglePageAsync * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private Mono> + listByResourceGroupAndRegionNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1374,7 +1352,7 @@ private Mono> listNextSinglePageAsync } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByResourceGroupAndRegionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -1442,7 +1420,7 @@ private Mono> listByRegionNextSingleP * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1451,9 +1429,7 @@ private Mono> listByResourceGroupNext new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + 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())); @@ -1470,8 +1446,7 @@ private Mono> listByResourceGroupNext * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, - Context context) { + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1481,7 +1456,7 @@ private Mono> listByResourceGroupNext } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, 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)); } @@ -1496,8 +1471,7 @@ private Mono> listByResourceGroupNext * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupAndRegionNextSinglePageAsync(String nextLink) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1506,8 +1480,9 @@ private Mono> listByResourceGroupNext new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listByResourceGroupAndRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(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())); @@ -1524,8 +1499,8 @@ private Mono> listByResourceGroupNext * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupAndRegionNextSinglePageAsync(String nextLink, Context context) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1535,7 +1510,7 @@ private Mono> listByResourceGroupNext } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByResourceGroupAndRegionNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByResourceGroupNext(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/JitNetworkAccessPoliciesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesImpl.java index 828cee5c5f89..bac8a095463c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,61 +30,12 @@ public JitNetworkAccessPoliciesImpl(JitNetworkAccessPoliciesClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - - public PagedIterable listByRegion(String ascLocation) { - PagedIterable inner = this.serviceClient().listByRegion(ascLocation); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - - public PagedIterable listByRegion(String ascLocation, Context context) { - PagedIterable inner = this.serviceClient().listByRegion(ascLocation, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroupAndRegion(String resourceGroupName, - String ascLocation) { - PagedIterable inner - = this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroupAndRegion(String resourceGroupName, - String ascLocation, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); - } - public Response getWithResponse(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { Response inner = this.serviceClient().getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new JitNetworkAccessPolicyImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new JitNetworkAccessPolicyImpl(inner.getValue(), this.manager())); } public JitNetworkAccessPolicy get(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) { @@ -107,16 +58,36 @@ public void delete(String resourceGroupName, String ascLocation, String jitNetwo this.serviceClient().delete(resourceGroupName, ascLocation, jitNetworkAccessPolicyName); } + public PagedIterable listByResourceGroupAndRegion(String resourceGroupName, + String ascLocation) { + PagedIterable inner + = this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupAndRegion(String resourceGroupName, + String ascLocation, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByRegion(ascLocation); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByRegion(String ascLocation, Context context) { + PagedIterable inner = this.serviceClient().listByRegion(ascLocation, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + public Response initiateWithResponse(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, Context context) { Response inner = this.serviceClient() .initiateWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new JitNetworkAccessRequestImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new JitNetworkAccessRequestImpl(inner.getValue(), this.manager())); } public JitNetworkAccessRequest initiate(String resourceGroupName, String ascLocation, @@ -130,6 +101,27 @@ public JitNetworkAccessRequest initiate(String resourceGroupName, String ascLoca } } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager())); + } + public JitNetworkAccessPolicy getById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPolicyImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPolicyImpl.java index 905b8566ca83..99356480fb29 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPolicyImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPolicyImpl.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; @@ -41,6 +42,10 @@ public String location() { return this.innerModel().location(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public List virtualMachines() { List inner = this.innerModel().virtualMachines(); if (inner != null) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessRequestImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessRequestImpl.java index be0e133fab44..b69294b73900 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessRequestImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessRequestImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; 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 new file mode 100644 index 000000000000..2f3ccb7830fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.LocationsClient; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; +import com.azure.resourcemanager.security.implementation.models.AscLocationList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in LocationsClient. + */ +public final class LocationsClientImpl implements LocationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final LocationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of LocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterLocations to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterLocations") + public interface LocationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 ASC location of the subscription is in the "name" field along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String ascLocation) { + 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.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + ascLocation, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @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 ASC location of the subscription is in the "name" field along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String ascLocation, 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.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, + context); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 ASC location of the subscription is in the "name" field on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String ascLocation) { + return getWithResponseAsync(ascLocation).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @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 ASC location of the subscription is in the "name" field along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String ascLocation, Context context) { + return getWithResponseAsync(ascLocation, context).block(); + } + + /** + * Details of a specific location. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 ASC location of the subscription is in the "name" field. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AscLocationInner get(String ascLocation) { + return getWithResponse(ascLocation, Context.NONE).getValue(); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @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 locations where ASC saves your data along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their 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 list of locations where ASC saves your data along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @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 locations where ASC saves your data as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their 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 list of locations where ASC saves your data as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their ID. + * + * @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 locations where ASC saves your data as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * The location of the responsible ASC of the specific subscription (home region). For each subscription there is + * only one responsible location. The location in the response should be used to read or write other resources in + * ASC according to their 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 list of locations where ASC saves your data as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 list of locations where ASC saves your data 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 locations where ASC saves your data 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/LocationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsImpl.java new file mode 100644 index 000000000000..13ad46e8b724 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.LocationsClient; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; +import com.azure.resourcemanager.security.models.AscLocation; +import com.azure.resourcemanager.security.models.Locations; + +public final class LocationsImpl implements Locations { + private static final ClientLogger LOGGER = new ClientLogger(LocationsImpl.class); + + private final LocationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public LocationsImpl(LocationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String ascLocation, Context context) { + Response inner = this.serviceClient().getWithResponse(ascLocation, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AscLocationImpl(inner.getValue(), this.manager())); + } + + public AscLocation get(String ascLocation) { + AscLocationInner inner = this.serviceClient().get(ascLocation); + if (inner != null) { + return new AscLocationImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AscLocationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AscLocationImpl(inner1, this.manager())); + } + + private LocationsClient 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/MalwareScanImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MalwareScanImpl.java new file mode 100644 index 000000000000..29abe0a4f159 --- /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) TypeSpec 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/MdeOnboardingDataImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingDataImpl.java new file mode 100644 index 000000000000..49edf07ea707 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingDataImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataInner; +import com.azure.resourcemanager.security.models.MdeOnboardingData; + +public final class MdeOnboardingDataImpl implements MdeOnboardingData { + private MdeOnboardingDataInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + MdeOnboardingDataImpl(MdeOnboardingDataInner 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 byte[] onboardingPackageWindows() { + return this.innerModel().onboardingPackageWindows(); + } + + public byte[] onboardingPackageLinux() { + return this.innerModel().onboardingPackageLinux(); + } + + public MdeOnboardingDataInner 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/MdeOnboardingDataListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingDataListImpl.java new file mode 100644 index 000000000000..e90e1ef2e762 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingDataListImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataInner; +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataListInner; +import com.azure.resourcemanager.security.models.MdeOnboardingData; +import com.azure.resourcemanager.security.models.MdeOnboardingDataList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class MdeOnboardingDataListImpl implements MdeOnboardingDataList { + private MdeOnboardingDataListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + MdeOnboardingDataListImpl(MdeOnboardingDataListInner 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 MdeOnboardingDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public MdeOnboardingDataListInner 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/MdeOnboardingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingsClientImpl.java new file mode 100644 index 000000000000..8b94505bc560 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingsClientImpl.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.MdeOnboardingsClient; +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataInner; +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataListInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MdeOnboardingsClient. + */ +public final class MdeOnboardingsClientImpl implements MdeOnboardingsClient { + /** + * The proxy service used to perform REST calls. + */ + private final MdeOnboardingsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of MdeOnboardingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MdeOnboardingsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(MdeOnboardingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterMdeOnboardings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterMdeOnboardings") + public interface MdeOnboardingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * The default configuration or data needed to onboard the machine to MDE. + * + * @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 resource of the configuration or data needed to onboard the machine to MDE along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync() { + 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 = "2021-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The default configuration or data needed to onboard the machine to MDE. + * + * @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 resource of the configuration or data needed to onboard the machine to MDE along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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 = "2021-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * The default configuration or data needed to onboard the machine to MDE. + * + * @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 resource of the configuration or data needed to onboard the machine to MDE on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync() { + return getWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The default configuration or data needed to onboard the machine to MDE. + * + * @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 resource of the configuration or data needed to onboard the machine to MDE along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(Context context) { + return getWithResponseAsync(context).block(); + } + + /** + * The default configuration or data needed to onboard the machine to MDE. + * + * @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 resource of the configuration or data needed to onboard the machine to MDE. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MdeOnboardingDataInner get() { + return getWithResponse(Context.NONE).getValue(); + } + + /** + * The configuration or data needed to onboard the machine to MDE. + * + * @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 all MDE onboarding data resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + 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 = "2021-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The configuration or data needed to onboard the machine to MDE. + * + * @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 all MDE onboarding data resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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 = "2021-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * The configuration or data needed to onboard the machine to MDE. + * + * @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 all MDE onboarding data resources on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The configuration or data needed to onboard the machine to MDE. + * + * @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 all MDE onboarding data resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * The configuration or data needed to onboard the machine to MDE. + * + * @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 all MDE onboarding data resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MdeOnboardingDataListInner list() { + return listWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingsImpl.java new file mode 100644 index 000000000000..d5840f957b7c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingsImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.MdeOnboardingsClient; +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataInner; +import com.azure.resourcemanager.security.fluent.models.MdeOnboardingDataListInner; +import com.azure.resourcemanager.security.models.MdeOnboardingData; +import com.azure.resourcemanager.security.models.MdeOnboardingDataList; +import com.azure.resourcemanager.security.models.MdeOnboardings; + +public final class MdeOnboardingsImpl implements MdeOnboardings { + private static final ClientLogger LOGGER = new ClientLogger(MdeOnboardingsImpl.class); + + private final MdeOnboardingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public MdeOnboardingsImpl(MdeOnboardingsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(Context context) { + Response inner = this.serviceClient().getWithResponse(context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MdeOnboardingDataImpl(inner.getValue(), this.manager())); + } + + public MdeOnboardingData get() { + MdeOnboardingDataInner inner = this.serviceClient().get(); + if (inner != null) { + return new MdeOnboardingDataImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MdeOnboardingDataListImpl(inner.getValue(), this.manager())); + } + + public MdeOnboardingDataList list() { + MdeOnboardingDataListInner inner = this.serviceClient().list(); + if (inner != null) { + return new MdeOnboardingDataListImpl(inner, this.manager()); + } else { + return null; + } + } + + private MdeOnboardingsClient 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/OperationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java new file mode 100644 index 000000000000..62473d270246 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.models.ArmActionType; +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; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ArmActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner 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/OperationResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultImpl.java new file mode 100644 index 000000000000..cb8ee70f1a7d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.OperationResultInner; +import com.azure.resourcemanager.security.models.OperationResult; +import com.azure.resourcemanager.security.models.OperationResultStatus; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + OperationResultImpl(OperationResultInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OperationResultStatus status() { + return this.innerModel().status(); + } + + public OperationResultInner 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/OperationResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultsClientImpl.java new file mode 100644 index 000000000000..03da4460edc7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultsClientImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.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.OperationResultsClient; +import com.azure.resourcemanager.security.models.OperationResultsGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationResultsClient. + */ +public final class OperationResultsClientImpl implements OperationResultsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationResultsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of OperationResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationResultsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(OperationResultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterOperationResults to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterOperationResults") + public interface OperationResultsService { + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{location}/operationResults/{operationId}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("operationId") String operationId, Context context); + } + + /** + * Returns operation results for long running operations. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 getWithResponseAsync(String location, String operationId) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2025-10-01-preview"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + location, operationId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns operation results for long running operations. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 getWithResponseAsync(String location, String operationId, + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2025-10-01-preview"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), location, + operationId, context); + } + + /** + * Returns operation results for long running operations. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 getAsync(String location, String operationId) { + return getWithResponseAsync(location, operationId).flatMap(ignored -> Mono.empty()); + } + + /** + * Returns operation results for long running operations. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async operation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationResultsGetResponse getWithResponse(String location, String operationId, Context context) { + return getWithResponseAsync(location, operationId, context).block(); + } + + /** + * Returns operation results for long running operations. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 get(String location, String operationId) { + getWithResponse(location, operationId, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultsImpl.java new file mode 100644 index 000000000000..3be3a635d2b5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultsImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.OperationResultsClient; +import com.azure.resourcemanager.security.models.OperationResults; +import com.azure.resourcemanager.security.models.OperationResultsGetResponse; + +public final class OperationResultsImpl implements OperationResults { + private static final ClientLogger LOGGER = new ClientLogger(OperationResultsImpl.class); + + private final OperationResultsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public OperationResultsImpl(OperationResultsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationResultsGetResponse getWithResponse(String location, String operationId, Context context) { + return this.serviceClient().getWithResponse(location, operationId, context); + } + + public void get(String location, String operationId) { + this.serviceClient().get(location, operationId); + } + + private OperationResultsClient 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/OperationStatusResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusResultImpl.java new file mode 100644 index 000000000000..df5f5f2488b4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusResultImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.security.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.security.models.OperationStatusResult; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class OperationStatusResultImpl implements OperationStatusResult { + private OperationStatusResultInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + OperationStatusResultImpl(OperationStatusResultInner 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 status() { + return this.innerModel().status(); + } + + public Double percentComplete() { + return this.innerModel().percentComplete(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public List operations() { + List inner = this.innerModel().operations(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new OperationStatusResultImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public OperationStatusResultInner 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/OperationStatusesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusesClientImpl.java new file mode 100644 index 000000000000..e467185a55ca --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusesClientImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.OperationStatusesClient; +import com.azure.resourcemanager.security.fluent.models.OperationStatusResultInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationStatusesClient. + */ +public final class OperationStatusesClientImpl implements OperationStatusesClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationStatusesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of OperationStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationStatusesClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterOperationStatuses to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterOperationStatuses") + public interface OperationStatusesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{location}/operationStatuses/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 status of a long running azure asynchronous operation along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String operationId) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2025-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + location, operationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 status of a long running azure asynchronous operation along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String operationId, + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2025-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), location, + operationId, accept, context); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 status of a long running azure asynchronous operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String operationId) { + return getWithResponseAsync(location, operationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 status of a long running azure asynchronous operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String operationId, Context context) { + return getWithResponseAsync(location, operationId, context).block(); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The name of the Azure region. + * @param operationId The ID of an ongoing async 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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResultInner get(String location, String operationId) { + return getWithResponse(location, operationId, Context.NONE).getValue(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusesImpl.java new file mode 100644 index 000000000000..a26f095d4bce --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusesImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.OperationStatusesClient; +import com.azure.resourcemanager.security.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.security.models.OperationStatusResult; +import com.azure.resourcemanager.security.models.OperationStatuses; + +public final class OperationStatusesImpl implements OperationStatuses { + private static final ClientLogger LOGGER = new ClientLogger(OperationStatusesImpl.class); + + private final OperationStatusesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public OperationStatusesImpl(OperationStatusesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String location, String operationId, Context context) { + Response inner + = this.serviceClient().getWithResponse(location, operationId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperationStatusResultImpl(inner.getValue(), this.manager())); + } + + public OperationStatusResult get(String location, String operationId) { + OperationStatusResultInner inner = this.serviceClient().get(location, operationId); + if (inner != null) { + return new OperationStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private OperationStatusesClient 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/OperationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..4168b8a404e1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.OperationsClient; +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.implementation.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") 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, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2025-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(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2025-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Exposes all available operations for discovery purposes. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 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) + 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 REST API operations supported by an Azure Resource Provider 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/OperationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsImpl.java new file mode 100644 index 000000000000..1cbeee618b7f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.OperationsClient; +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.models.Operation; +import com.azure.resourcemanager.security.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient 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/PricingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingImpl.java index ab7e27cea485..6eb82bef6d71 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.PricingInner; import com.azure.resourcemanager.security.models.Enforce; import com.azure.resourcemanager.security.models.Extension; @@ -38,6 +39,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public PricingTier pricingTier() { return this.innerModel().pricingTier(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingListImpl.java index 17437a75891a..31495e87359d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingListImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingListImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java index bc2876b3ba79..c9cf8981651a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -57,39 +57,38 @@ public final class PricingsClientImpl implements PricingsClient { * The interface defining all the services for SecurityCenterPricings to be used by the proxy service to perform * REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterPricin") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterPricings") public interface PricingsService { @Headers({ "Content-Type: application/json" }) @Get("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "scopeId", encoded = true) String scopeId, @PathParam("pricingName") String pricingName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Put("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("$host") String endpoint, + Mono> update(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "scopeId", encoded = true) String scopeId, - @PathParam("pricingName") String pricingName, @BodyParam("application/json") PricingInner pricing, - @HeaderParam("Accept") String accept, Context context); + @PathParam("pricingName") String pricingName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PricingInner pricing, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam(value = "scopeId", encoded = true) String scopeId, @PathParam("pricingName") String pricingName, - @HeaderParam("Accept") String accept, Context context); + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scopeId", encoded = true) String scopeId, + @PathParam("pricingName") String pricingName, Context context); @Headers({ "Content-Type: application/json" }) @Get("/{scopeId}/providers/Microsoft.Security/pricings") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "scopeId", encoded = true) String scopeId, @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); } @@ -98,10 +97,7 @@ Mono> list(@HostParam("$host") String endpoint, * Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a * subscription id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -133,10 +129,7 @@ private Mono> getWithResponseAsync(String scopeId, String * Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a * subscription id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -167,10 +160,7 @@ private Mono> getWithResponseAsync(String scopeId, String * Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a * subscription id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -187,10 +177,7 @@ private Mono getAsync(String scopeId, String pricingName) { * Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a * subscription id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -208,10 +195,7 @@ public Response getWithResponse(String scopeId, String pricingName * Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a * subscription id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -229,10 +213,7 @@ public PricingInner get(String scopeId, String pricingName) { * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and * only for plan='VirtualMachines' and subPlan='P1'). * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param pricing Pricing object. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -260,10 +241,11 @@ private Mono> updateWithResponseAsync(String scopeId, Str pricing.validate(); } final String apiVersion = "2024-01-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, scopeId, pricingName, pricing, - accept, context)) + .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, scopeId, pricingName, + contentType, accept, pricing, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -272,10 +254,7 @@ private Mono> updateWithResponseAsync(String scopeId, Str * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and * only for plan='VirtualMachines' and subPlan='P1'). * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param pricing Pricing object. * @param context The context to associate with this operation. @@ -304,9 +283,11 @@ private Mono> updateWithResponseAsync(String scopeId, Str pricing.validate(); } final String apiVersion = "2024-01-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), apiVersion, scopeId, pricingName, pricing, accept, context); + return service.update(this.client.getEndpoint(), apiVersion, scopeId, pricingName, contentType, accept, pricing, + context); } /** @@ -314,10 +295,7 @@ private Mono> updateWithResponseAsync(String scopeId, Str * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and * only for plan='VirtualMachines' and subPlan='P1'). * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param pricing Pricing object. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -336,10 +314,7 @@ private Mono updateAsync(String scopeId, String pricingName, Prici * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and * only for plan='VirtualMachines' and subPlan='P1'). * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param pricing Pricing object. * @param context The context to associate with this operation. @@ -360,10 +335,7 @@ public Response updateWithResponse(String scopeId, String pricingN * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and * only for plan='VirtualMachines' and subPlan='P1'). * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param pricing Pricing object. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -378,10 +350,9 @@ public PricingInner update(String scopeId, String pricingName, PricingInner pric /** * Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for - * resource scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). + * resource scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -401,19 +372,17 @@ private Mono> deleteWithResponseAsync(String scopeId, String pric return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); } final String apiVersion = "2024-01-01"; - final String accept = "application/json"; return FluxUtil .withContext( - context -> service.delete(this.client.getEndpoint(), apiVersion, scopeId, pricingName, accept, context)) + context -> service.delete(this.client.getEndpoint(), apiVersion, scopeId, pricingName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for - * resource scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). + * resource scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -434,17 +403,15 @@ private Mono> deleteWithResponseAsync(String scopeId, String pric return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); } final String apiVersion = "2024-01-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, scopeId, pricingName, accept, context); + return service.delete(this.client.getEndpoint(), apiVersion, scopeId, pricingName, context); } /** * Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for - * resource scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). + * resource scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -458,10 +425,9 @@ private Mono deleteAsync(String scopeId, String pricingName) { /** * Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for - * resource scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). + * resource scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -476,10 +442,9 @@ public Response deleteWithResponse(String scopeId, String pricingName, Con /** * Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for - * resource scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). + * resource scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param pricingName name of the pricing configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -497,10 +462,7 @@ public void delete(String scopeId, String pricingName) { * unfiltered list will be returned. If '$filter=name in (planName1,planName2)' is provided, the returned list * includes the pricings set for 'planName1' and 'planName2' only. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param filter OData filter. Optional. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -532,10 +494,7 @@ private Mono> listWithResponseAsync(String scopeId, S * unfiltered list will be returned. If '$filter=name in (planName1,planName2)' is provided, the returned list * includes the pricings set for 'planName1' and 'planName2' only. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param filter OData filter. Optional. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -566,10 +525,7 @@ private Mono> listWithResponseAsync(String scopeId, S * unfiltered list will be returned. If '$filter=name in (planName1,planName2)' is provided, the returned list * includes the pricings set for 'planName1' and 'planName2' only. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier 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. @@ -588,10 +544,7 @@ private Mono listAsync(String scopeId) { * unfiltered list will be returned. If '$filter=name in (planName1,planName2)' is provided, the returned list * includes the pricings set for 'planName1' and 'planName2' only. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier of the resource. * @param filter OData filter. Optional. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -611,10 +564,7 @@ public Response listWithResponse(String scopeId, String filter * unfiltered list will be returned. If '$filter=name in (planName1,planName2)' is provided, the returned list * includes the pricings set for 'planName1' and 'planName2' only. * - * @param scopeId The scope id of the pricing. Valid scopes are: subscription (format: - * 'subscriptions/{subscriptionId}'), or a specific resource (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) - * - Supported resources are (VirtualMachines). + * @param scopeId The fully qualified Azure Resource manager identifier 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. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsImpl.java index d74c9313bcc9..ef874da03092 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -29,12 +29,8 @@ public PricingsImpl(PricingsClient innerClient, com.azure.resourcemanager.securi public Response getWithResponse(String scopeId, String pricingName, Context context) { Response inner = this.serviceClient().getWithResponse(scopeId, pricingName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new PricingImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PricingImpl(inner.getValue(), this.manager())); } public Pricing get(String scopeId, String pricingName) { @@ -49,12 +45,8 @@ public Pricing get(String scopeId, String pricingName) { public Response updateWithResponse(String scopeId, String pricingName, PricingInner pricing, Context context) { Response inner = this.serviceClient().updateWithResponse(scopeId, pricingName, pricing, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new PricingImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PricingImpl(inner.getValue(), this.manager())); } public Pricing update(String scopeId, String pricingName, PricingInner pricing) { @@ -76,12 +68,8 @@ public void deleteByResourceGroup(String scopeId, String pricingName) { public Response listWithResponse(String scopeId, String filter, Context context) { Response inner = this.serviceClient().listWithResponse(scopeId, filter, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new PricingListImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PricingListImpl(inner.getValue(), this.manager())); } public PricingList list(String scopeId) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..bade8c8ba7dd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.security.models.PrivateEndpoint; +import com.azure.resourcemanager.security.models.PrivateEndpointConnection; +import com.azure.resourcemanager.security.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.security.models.PrivateLinkServiceConnectionState; +import java.util.Collections; +import java.util.List; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner 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 List groupIds() { + List inner = this.innerModel().groupIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String privateLinkName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingPrivateLink(String resourceGroupName, String privateLinkName) { + this.resourceGroupName = resourceGroupName; + this.privateLinkName = privateLinkName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, privateLinkName, privateEndpointConnectionName, this.innerModel(), + Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, privateLinkName, privateEndpointConnectionName, this.innerModel(), + context); + return this; + } + + PrivateEndpointConnectionImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, privateLinkName, privateEndpointConnectionName, this.innerModel(), + Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, privateLinkName, privateEndpointConnectionName, this.innerModel(), + context); + return this; + } + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.privateLinkName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateLinks"); + this.privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, privateLinkName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, privateLinkName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..02e224e8a5d5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1061 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.security.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.security.implementation.models.PrivateEndpointConnectionListResult; +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 PrivateEndpointConnectionsClient. + */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(PrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterPrivateEndpointConnections to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterPrivateEndpointConnections") + public interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PrivateEndpointConnectionInner privateEndpointConnection, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified private endpoint connection associated with the private link. Returns the connection details, + * status, and configuration for a specific private endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the private link along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String privateLinkName, String privateEndpointConnectionName) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, privateEndpointConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private endpoint connection associated with the private link. Returns the connection details, + * status, and configuration for a specific private endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the private link along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String privateLinkName, String privateEndpointConnectionName, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, privateEndpointConnectionName, accept, context); + } + + /** + * Gets the specified private endpoint connection associated with the private link. Returns the connection details, + * status, and configuration for a specific private endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the private link on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private endpoint connection associated with the private link. Returns the connection details, + * status, and configuration for a specific private endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the private link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets the specified private endpoint connection associated with the private link. Returns the connection details, + * status, and configuration for a specific private endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the private link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, privateLinkName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono.error( + new IllegalArgumentException("Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String apiVersion = "2026-01-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, privateLinkName, privateEndpointConnectionName, + contentType, accept, privateEndpointConnection, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono.error( + new IllegalArgumentException("Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String apiVersion = "2026-01-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, privateEndpointConnectionName, contentType, accept, + privateEndpointConnection, context); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the {@link PollerFlux} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, privateLinkName, + privateEndpointConnectionName, privateEndpointConnection); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the {@link PollerFlux} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, privateLinkName, + privateEndpointConnectionName, privateEndpointConnection, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, + context); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, + privateEndpointConnection) + .getSyncPoller(); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, + privateEndpointConnection, context) + .getSyncPoller(); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { + return beginCreateOrUpdateAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, + privateEndpointConnection).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, + privateEndpointConnection, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { + return createOrUpdateAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, + privateEndpointConnection).block(); + } + + /** + * Update the state of specified private endpoint connection associated with the private link. This operation is + * typically used to approve or reject pending private endpoint connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param privateEndpointConnection The private endpoint connection 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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return createOrUpdateAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, + privateEndpointConnection, context).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, privateEndpointConnectionName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, privateEndpointConnectionName, context); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName) { + return this.beginDeleteAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, Context context) { + return this.beginDeleteAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the private link. This operation will + * disconnect the private endpoint and remove the connection configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + Context context) { + deleteAsync(resourceGroupName, privateLinkName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 all private endpoint connections for a private link along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String privateLinkName) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, 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 all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 all private endpoint connections for a private link along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String privateLinkName, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 all private endpoint connections for a private link as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String privateLinkName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, privateLinkName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 all private endpoint connections for a private link as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String privateLinkName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, privateLinkName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 all private endpoint connections for a private link as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String privateLinkName) { + return new PagedIterable<>(listAsync(resourceGroupName, privateLinkName)); + } + + /** + * Gets all private endpoint connections for a private link. Returns the list of private endpoints that are + * connected or in the process of connecting to this private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 all private endpoint connections for a private link as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String privateLinkName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, privateLinkName, 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 all private endpoint connections for a private link 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 all private endpoint connections for a private link 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/PrivateEndpointConnectionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..c25be50262d5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.security.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.security.models.PrivateEndpointConnection; +import com.azure.resourcemanager.security.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, privateLinkName, privateEndpointConnectionName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } + + public PrivateEndpointConnection get(String resourceGroupName, String privateLinkName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, privateLinkName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, privateLinkName, privateEndpointConnectionName); + } + + public void delete(String resourceGroupName, String privateLinkName, String privateEndpointConnectionName, + Context context) { + this.serviceClient().delete(resourceGroupName, privateLinkName, privateEndpointConnectionName, context); + } + + public PagedIterable list(String resourceGroupName, String privateLinkName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, privateLinkName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String privateLinkName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, privateLinkName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PrivateEndpointConnection 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, privateLinkName, privateEndpointConnectionName, 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, privateLinkName, privateEndpointConnectionName, 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, privateLinkName, privateEndpointConnectionName, 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, privateLinkName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkGroupResourceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkGroupResourceImpl.java new file mode 100644 index 000000000000..79387b15d2ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkGroupResourceImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.PrivateLinkGroupResourceInner; +import com.azure.resourcemanager.security.models.PrivateLinkGroupResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkGroupResourceImpl implements PrivateLinkGroupResource { + private PrivateLinkGroupResourceInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + PrivateLinkGroupResourceImpl(PrivateLinkGroupResourceInner 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 String groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkGroupResourceInner 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/PrivateLinkResourceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..924af837fcbd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.security.fluent.models.PrivateLinkGroupResourceInner; +import com.azure.resourcemanager.security.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.security.models.PrivateEndpointConnection; +import com.azure.resourcemanager.security.models.PrivateLinkGroupResource; +import com.azure.resourcemanager.security.models.PrivateLinkResource; +import com.azure.resourcemanager.security.models.PrivateLinkUpdate; +import com.azure.resourcemanager.security.models.ProvisioningState; +import com.azure.resourcemanager.security.models.PublicNetworkAccess; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class PrivateLinkResourceImpl + implements PrivateLinkResource, PrivateLinkResource.Definition, PrivateLinkResource.Update { + private PrivateLinkResourceInner 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 Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List privateLinkResources() { + List inner = this.innerModel().privateLinkResources(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new PrivateLinkGroupResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String privateLinkName; + + private PrivateLinkUpdate updatePrivateLink; + + public PrivateLinkResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public PrivateLinkResource create() { + this.innerObject = serviceManager.serviceClient() + .getPrivateLinks() + .create(resourceGroupName, privateLinkName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateLinkResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateLinks() + .create(resourceGroupName, privateLinkName, this.innerModel(), context); + return this; + } + + PrivateLinkResourceImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new PrivateLinkResourceInner(); + this.serviceManager = serviceManager; + this.privateLinkName = name; + } + + public PrivateLinkResourceImpl update() { + this.updatePrivateLink = new PrivateLinkUpdate(); + return this; + } + + public PrivateLinkResource apply() { + this.innerObject = serviceManager.serviceClient() + .getPrivateLinks() + .updateWithResponse(resourceGroupName, privateLinkName, updatePrivateLink, Context.NONE) + .getValue(); + return this; + } + + public PrivateLinkResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateLinks() + .updateWithResponse(resourceGroupName, privateLinkName, updatePrivateLink, context) + .getValue(); + return this; + } + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.privateLinkName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateLinks"); + } + + public PrivateLinkResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getPrivateLinks() + .getByResourceGroupWithResponse(resourceGroupName, privateLinkName, Context.NONE) + .getValue(); + return this; + } + + public PrivateLinkResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateLinks() + .getByResourceGroupWithResponse(resourceGroupName, privateLinkName, context) + .getValue(); + return this; + } + + public PrivateLinkResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PrivateLinkResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PrivateLinkResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updatePrivateLink.withTags(tags); + return this; + } + } + + public PrivateLinkResourceImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkResourcesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..0933d0e56a87 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateLinkResourcesClient; +import com.azure.resourcemanager.security.fluent.models.PrivateLinkGroupResourceInner; +import com.azure.resourcemanager.security.implementation.models.PrivateLinkGroupResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(PrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterPrivateLinkResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterPrivateLinkResources") + public interface PrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateLinkResources/{groupId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, @PathParam("groupId") String groupId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get the specified private link resource associated with the private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param groupId The group ID of the private link 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 the specified private link resource associated with the private link along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String privateLinkName, String groupId) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, groupId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the specified private link resource associated with the private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param groupId The group ID of the private link 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 the specified private link resource associated with the private link along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String privateLinkName, String groupId, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, groupId, accept, context); + } + + /** + * Get the specified private link resource associated with the private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param groupId The group ID of the private link 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 the specified private link resource associated with the private link on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String privateLinkName, + String groupId) { + return getWithResponseAsync(resourceGroupName, privateLinkName, groupId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the specified private link resource associated with the private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param groupId The group ID of the private link 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 the specified private link resource associated with the private link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String privateLinkName, + String groupId, Context context) { + return getWithResponseAsync(resourceGroupName, privateLinkName, groupId, context).block(); + } + + /** + * Get the specified private link resource associated with the private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param groupId The group ID of the private link 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 the specified private link resource associated with the private link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkGroupResourceInner get(String resourceGroupName, String privateLinkName, String groupId) { + return getWithResponse(resourceGroupName, privateLinkName, groupId, Context.NONE).getValue(); + } + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 of a PrivateLinkGroupResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String privateLinkName) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, 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())); + } + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 of a PrivateLinkGroupResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String privateLinkName, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 of a PrivateLinkGroupResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String privateLinkName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, privateLinkName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 of a PrivateLinkGroupResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String privateLinkName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, privateLinkName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 of a PrivateLinkGroupResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String privateLinkName) { + return new PagedIterable<>(listAsync(resourceGroupName, privateLinkName)); + } + + /** + * List all private link resources in a private link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 of a PrivateLinkGroupResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String privateLinkName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, privateLinkName, 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 the response of a PrivateLinkGroupResource list operation 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 the response of a PrivateLinkGroupResource list operation 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/PrivateLinkResourcesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..5fa9050ede0c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateLinkResourcesClient; +import com.azure.resourcemanager.security.fluent.models.PrivateLinkGroupResourceInner; +import com.azure.resourcemanager.security.models.PrivateLinkGroupResource; +import com.azure.resourcemanager.security.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String privateLinkName, + String groupId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, privateLinkName, groupId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateLinkGroupResourceImpl(inner.getValue(), this.manager())); + } + + public PrivateLinkGroupResource get(String resourceGroupName, String privateLinkName, String groupId) { + PrivateLinkGroupResourceInner inner = this.serviceClient().get(resourceGroupName, privateLinkName, groupId); + if (inner != null) { + return new PrivateLinkGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String privateLinkName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, privateLinkName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String privateLinkName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, privateLinkName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkGroupResourceImpl(inner1, this.manager())); + } + + private PrivateLinkResourcesClient 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/PrivateLinksClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinksClientImpl.java new file mode 100644 index 000000000000..84bebe38c34a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinksClientImpl.java @@ -0,0 +1,1440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.Head; +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.PrivateLinksClient; +import com.azure.resourcemanager.security.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.security.implementation.models.PrivateLinksList; +import com.azure.resourcemanager.security.models.PrivateLinkUpdate; +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 PrivateLinksClient. + */ +public final class PrivateLinksClientImpl implements PrivateLinksClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateLinksService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of PrivateLinksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinksClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(PrivateLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterPrivateLinks to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterPrivateLinks") + public interface PrivateLinksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PrivateLinkResourceInner privateLink, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PrivateLinkUpdate privateLink, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("privateLinkName") String privateLinkName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/privateLinks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft + * Defender for Cloud services in the specified region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String privateLinkName) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, privateLinkName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft + * Defender for Cloud services in the specified region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 private link resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String privateLinkName, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, accept, context); + } + + /** + * Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft + * Defender for Cloud services in the specified region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String privateLinkName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, privateLinkName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft + * Defender for Cloud services in the specified region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 private link resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String privateLinkName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, privateLinkName, context).block(); + } + + /** + * Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft + * Defender for Cloud services in the specified region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner getByResourceGroup(String resourceGroupName, String privateLinkName) { + return getByResourceGroupWithResponse(resourceGroupName, privateLinkName, Context.NONE).getValue(); + } + + /** + * Checks whether private link exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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> headWithResponseAsync(String resourceGroupName, String privateLinkName) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + return FluxUtil + .withContext(context -> service.head(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether private link exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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> headWithResponseAsync(String resourceGroupName, String privateLinkName, + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, context); + } + + /** + * Checks whether private link exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 headAsync(String resourceGroupName, String privateLinkName) { + return headWithResponseAsync(resourceGroupName, privateLinkName).flatMap(ignored -> Mono.empty()); + } + + /** + * Checks whether private link exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 headWithResponse(String resourceGroupName, String privateLinkName, Context context) { + return headWithResponseAsync(resourceGroupName, privateLinkName, context).block(); + } + + /** + * Checks whether private link exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 head(String resourceGroupName, String privateLinkName) { + headWithResponse(resourceGroupName, privateLinkName, Context.NONE); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateLink == null) { + return Mono.error(new IllegalArgumentException("Parameter privateLink is required and cannot be null.")); + } else { + privateLink.validate(); + } + final String apiVersion = "2026-01-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, contentType, accept, privateLink, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateLink == null) { + return Mono.error(new IllegalArgumentException("Parameter privateLink is required and cannot be null.")); + } else { + privateLink.validate(); + } + final String apiVersion = "2026-01-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, contentType, accept, privateLink, context); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 a private link resource that enables secure, private connectivity + * to Microsoft Defender for Cloud services. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateLinkResourceInner> + beginCreateAsync(String resourceGroupName, String privateLinkName, PrivateLinkResourceInner privateLink) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, privateLinkName, privateLink); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PrivateLinkResourceInner.class, PrivateLinkResourceInner.class, + this.client.getContext()); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 a private link resource that enables secure, private connectivity + * to Microsoft Defender for Cloud services. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateLinkResourceInner> beginCreateAsync( + String resourceGroupName, String privateLinkName, PrivateLinkResourceInner privateLink, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, privateLinkName, privateLink, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PrivateLinkResourceInner.class, PrivateLinkResourceInner.class, context); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 a private link resource that enables secure, private connectivity + * to Microsoft Defender for Cloud services. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateLinkResourceInner> + beginCreate(String resourceGroupName, String privateLinkName, PrivateLinkResourceInner privateLink) { + return this.beginCreateAsync(resourceGroupName, privateLinkName, privateLink).getSyncPoller(); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 a private link resource that enables secure, private connectivity + * to Microsoft Defender for Cloud services. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateLinkResourceInner> beginCreate( + String resourceGroupName, String privateLinkName, PrivateLinkResourceInner privateLink, Context context) { + return this.beginCreateAsync(resourceGroupName, privateLinkName, privateLink, context).getSyncPoller(); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink) { + return beginCreateAsync(resourceGroupName, privateLinkName, privateLink).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink, Context context) { + return beginCreateAsync(resourceGroupName, privateLinkName, privateLink, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner create(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink) { + return createAsync(resourceGroupName, privateLinkName, privateLink).block(); + } + + /** + * Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint + * connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. + * The operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink Private link request payload containing the resource information for create operations. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner create(String resourceGroupName, String privateLinkName, + PrivateLinkResourceInner privateLink, Context context) { + return createAsync(resourceGroupName, privateLinkName, privateLink, context).block(); + } + + /** + * Update specific properties of a private link resource. Use this operation to update mutable properties like tags + * without affecting the entire resource configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink private link update payload containing only the properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String privateLinkName, PrivateLinkUpdate privateLink) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateLink == null) { + return Mono.error(new IllegalArgumentException("Parameter privateLink is required and cannot be null.")); + } else { + privateLink.validate(); + } + final String apiVersion = "2026-01-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, privateLinkName, contentType, accept, privateLink, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update specific properties of a private link resource. Use this operation to update mutable properties like tags + * without affecting the entire resource configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink private link update payload containing only the properties to be updated. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String privateLinkName, PrivateLinkUpdate privateLink, 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + if (privateLink == null) { + return Mono.error(new IllegalArgumentException("Parameter privateLink is required and cannot be null.")); + } else { + privateLink.validate(); + } + final String apiVersion = "2026-01-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, contentType, accept, privateLink, context); + } + + /** + * Update specific properties of a private link resource. Use this operation to update mutable properties like tags + * without affecting the entire resource configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink private link update payload containing only the properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String privateLinkName, + PrivateLinkUpdate privateLink) { + return updateWithResponseAsync(resourceGroupName, privateLinkName, privateLink) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update specific properties of a private link resource. Use this operation to update mutable properties like tags + * without affecting the entire resource configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink private link update payload containing only the properties to be updated. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String privateLinkName, + PrivateLinkUpdate privateLink, Context context) { + return updateWithResponseAsync(resourceGroupName, privateLinkName, privateLink, context).block(); + } + + /** + * Update specific properties of a private link resource. Use this operation to update mutable properties like tags + * without affecting the entire resource configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @param privateLink private link update payload containing only the properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 private link resource that enables secure, private connectivity to Microsoft Defender for Cloud + * services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner update(String resourceGroupName, String privateLinkName, + PrivateLinkUpdate privateLink) { + return updateWithResponse(resourceGroupName, privateLinkName, privateLink, Context.NONE).getValue(); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 privateLinkName) { + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, privateLinkName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName, + 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 (privateLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkName is required and cannot be null.")); + } + final String apiVersion = "2026-01-01"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + privateLinkName, context); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 privateLinkName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, privateLinkName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, privateLinkName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 privateLinkName) { + return this.beginDeleteAsync(resourceGroupName, privateLinkName).getSyncPoller(); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, privateLinkName, context).getSyncPoller(); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 privateLinkName) { + return beginDeleteAsync(resourceGroupName, privateLinkName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName, Context context) { + return beginDeleteAsync(resourceGroupName, privateLinkName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 privateLinkName) { + deleteAsync(resourceGroupName, privateLinkName).block(); + } + + /** + * Delete a private link resource. This operation will remove the private link infrastructure and disconnect all + * associated private endpoints. This operation is asynchronous and may take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param privateLinkName The name of the private link resource. Must be unique within the resource group and follow + * Azure naming conventions. + * @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 privateLinkName, Context context) { + deleteAsync(resourceGroupName, privateLinkName, context).block(); + } + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 paginated list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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())); + } + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 paginated list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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.")); + } + final String apiVersion = "2026-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 paginated list of private link resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 paginated list of private link resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the private links in the specified resource group. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified 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 paginated list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2026-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified subscription. + * + * @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 paginated list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2026-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified 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 paginated list of private link resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified subscription. + * + * @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 paginated list of private link resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified 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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the private links in the specified subscription. private links enable secure, private connectivity to + * Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' + * property in the response to get the next page of private links for the specified subscription. + * + * @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 paginated list of private link resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 paginated list of private link resources 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 paginated list of private link resources 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)); + } + + /** + * 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 paginated list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 paginated list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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/PrivateLinksImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinksImpl.java new file mode 100644 index 000000000000..4f4aa2221987 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PrivateLinksImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PrivateLinksClient; +import com.azure.resourcemanager.security.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.security.models.PrivateLinkResource; +import com.azure.resourcemanager.security.models.PrivateLinks; + +public final class PrivateLinksImpl implements PrivateLinks { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinksImpl.class); + + private final PrivateLinksClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public PrivateLinksImpl(PrivateLinksClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String privateLinkName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, privateLinkName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } + + public PrivateLinkResource getByResourceGroup(String resourceGroupName, String privateLinkName) { + PrivateLinkResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, privateLinkName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response headWithResponse(String resourceGroupName, String privateLinkName, Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, privateLinkName, context); + } + + public void head(String resourceGroupName, String privateLinkName) { + this.serviceClient().head(resourceGroupName, privateLinkName); + } + + public void deleteByResourceGroup(String resourceGroupName, String privateLinkName) { + this.serviceClient().delete(resourceGroupName, privateLinkName); + } + + public void delete(String resourceGroupName, String privateLinkName, Context context) { + this.serviceClient().delete(resourceGroupName, privateLinkName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, privateLinkName, 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, privateLinkName, 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + this.delete(resourceGroupName, privateLinkName, 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 privateLinkName = ResourceManagerUtils.getValueFromIdByName(id, "privateLinks"); + if (privateLinkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'privateLinks'.", id))); + } + this.delete(resourceGroupName, privateLinkName, context); + } + + private PrivateLinksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public PrivateLinkResourceImpl define(String name) { + return new PrivateLinkResourceImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentImpl.java new file mode 100644 index 000000000000..2f4b0dfe6293 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessment; +import com.azure.resourcemanager.security.models.State; + +public final class RegulatoryComplianceAssessmentImpl implements RegulatoryComplianceAssessment { + private RegulatoryComplianceAssessmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RegulatoryComplianceAssessmentImpl(RegulatoryComplianceAssessmentInner 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 String description() { + return this.innerModel().description(); + } + + public String assessmentType() { + return this.innerModel().assessmentType(); + } + + public String assessmentDetailsLink() { + return this.innerModel().assessmentDetailsLink(); + } + + public State state() { + return this.innerModel().state(); + } + + public Integer passedResources() { + return this.innerModel().passedResources(); + } + + public Integer failedResources() { + return this.innerModel().failedResources(); + } + + public Integer skippedResources() { + return this.innerModel().skippedResources(); + } + + public Integer unsupportedResources() { + return this.innerModel().unsupportedResources(); + } + + public RegulatoryComplianceAssessmentInner 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/RegulatoryComplianceAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java new file mode 100644 index 000000000000..0fd7a8a34361 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java @@ -0,0 +1,471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; +import com.azure.resourcemanager.security.implementation.models.RegulatoryComplianceAssessmentList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceAssessmentsClient. + */ +public final class RegulatoryComplianceAssessmentsClientImpl implements RegulatoryComplianceAssessmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final RegulatoryComplianceAssessmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of RegulatoryComplianceAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegulatoryComplianceAssessmentsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(RegulatoryComplianceAssessmentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterRegulatoryComplianceAssessments to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterRegulatoryComplianceAssessments") + public interface RegulatoryComplianceAssessmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @PathParam("regulatoryComplianceControlName") String regulatoryComplianceControlName, + @PathParam("regulatoryComplianceAssessmentName") String regulatoryComplianceAssessmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @PathParam("regulatoryComplianceControlName") String regulatoryComplianceControlName, + @QueryParam("$filter") String filter, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance assessment details and state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName) { + 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + if (regulatoryComplianceAssessmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @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 regulatory compliance assessment details and state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, + String regulatoryComplianceAssessmentName, 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + if (regulatoryComplianceAssessmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName, + accept, context); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance assessment details and state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName) { + return getWithResponseAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, + regulatoryComplianceAssessmentName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @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 regulatory compliance assessment details and state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName, Context context) { + return getWithResponseAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, context).block(); + } + + /** + * Supported regulatory compliance details and state for selected assessment. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param regulatoryComplianceAssessmentName Name of the regulatory compliance assessment object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance assessment details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceAssessmentInner get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName) { + return getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, Context.NONE).getValue(); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance assessment response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, String filter) { + 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, 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())); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @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 regulatory compliance assessment response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, String filter, + 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance assessment response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance assessment response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @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 regulatory compliance assessment response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(regulatoryComplianceStandardName, + regulatoryComplianceControlName, filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance assessment response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName) { + final String filter = null; + return new PagedIterable<>( + listAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter)); + } + + /** + * Details and state of assessments mapped to selected regulatory compliance control. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @param filter OData filter. Optional. + * @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 regulatory compliance assessment response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter, Context context) { + return new PagedIterable<>( + listAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, 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 list of regulatory compliance assessment response 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 regulatory compliance assessment response 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/RegulatoryComplianceAssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsImpl.java new file mode 100644 index 000000000000..95ddf0a1537a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessment; +import com.azure.resourcemanager.security.models.RegulatoryComplianceAssessments; + +public final class RegulatoryComplianceAssessmentsImpl implements RegulatoryComplianceAssessments { + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceAssessmentsImpl.class); + + private final RegulatoryComplianceAssessmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public RegulatoryComplianceAssessmentsImpl(RegulatoryComplianceAssessmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RegulatoryComplianceAssessmentImpl(inner.getValue(), this.manager())); + } + + public RegulatoryComplianceAssessment get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName) { + RegulatoryComplianceAssessmentInner inner = this.serviceClient() + .get(regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName); + if (inner != null) { + return new RegulatoryComplianceAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName) { + PagedIterable inner + = this.serviceClient().list(regulatoryComplianceStandardName, regulatoryComplianceControlName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RegulatoryComplianceAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter, Context context) { + PagedIterable inner = this.serviceClient() + .list(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RegulatoryComplianceAssessmentImpl(inner1, this.manager())); + } + + private RegulatoryComplianceAssessmentsClient 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/RegulatoryComplianceControlImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlImpl.java new file mode 100644 index 000000000000..ebd7fc130560 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControl; +import com.azure.resourcemanager.security.models.State; + +public final class RegulatoryComplianceControlImpl implements RegulatoryComplianceControl { + private RegulatoryComplianceControlInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RegulatoryComplianceControlImpl(RegulatoryComplianceControlInner 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 String description() { + return this.innerModel().description(); + } + + public State state() { + return this.innerModel().state(); + } + + public Integer passedAssessments() { + return this.innerModel().passedAssessments(); + } + + public Integer failedAssessments() { + return this.innerModel().failedAssessments(); + } + + public Integer skippedAssessments() { + return this.innerModel().skippedAssessments(); + } + + public RegulatoryComplianceControlInner 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/RegulatoryComplianceControlsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java new file mode 100644 index 000000000000..489d22f0af22 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceControlsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; +import com.azure.resourcemanager.security.implementation.models.RegulatoryComplianceControlList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceControlsClient. + */ +public final class RegulatoryComplianceControlsClientImpl implements RegulatoryComplianceControlsClient { + /** + * The proxy service used to perform REST calls. + */ + private final RegulatoryComplianceControlsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of RegulatoryComplianceControlsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegulatoryComplianceControlsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(RegulatoryComplianceControlsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterRegulatoryComplianceControls to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterRegulatoryComplianceControls") + public interface RegulatoryComplianceControlsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @PathParam("regulatoryComplianceControlName") String regulatoryComplianceControlName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @QueryParam("$filter") String filter, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance control details and state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getWithResponseAsync(String regulatoryComplianceStandardName, String regulatoryComplianceControlName) { + 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @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 regulatory compliance control details and state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String regulatoryComplianceStandardName, String regulatoryComplianceControlName, 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, accept, context); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance control details and state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName) { + return getWithResponseAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @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 regulatory compliance control details and state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, Context context) { + return getWithResponseAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, context).block(); + } + + /** + * Selected regulatory compliance control details and state. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param regulatoryComplianceControlName Name of the regulatory compliance control object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance control details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceControlInner get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName) { + return getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, Context.NONE) + .getValue(); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance controls response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listSinglePageAsync(String regulatoryComplianceStandardName, String filter) { + 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, filter, 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())); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @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 regulatory compliance controls response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listSinglePageAsync(String regulatoryComplianceStandardName, String filter, 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance controls response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String regulatoryComplianceStandardName, + String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(regulatoryComplianceStandardName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance controls response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String regulatoryComplianceStandardName) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(regulatoryComplianceStandardName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @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 regulatory compliance controls response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String regulatoryComplianceStandardName, + String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(regulatoryComplianceStandardName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance controls response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String regulatoryComplianceStandardName) { + final String filter = null; + return new PagedIterable<>(listAsync(regulatoryComplianceStandardName, filter)); + } + + /** + * All supported regulatory compliance controls details and state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @param filter OData filter. Optional. + * @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 regulatory compliance controls response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String regulatoryComplianceStandardName, String filter, + Context context) { + return new PagedIterable<>(listAsync(regulatoryComplianceStandardName, filter, 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 list of regulatory compliance controls response 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 regulatory compliance controls response 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/RegulatoryComplianceControlsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsImpl.java new file mode 100644 index 000000000000..5560dec2aba0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceControlsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControl; +import com.azure.resourcemanager.security.models.RegulatoryComplianceControls; + +public final class RegulatoryComplianceControlsImpl implements RegulatoryComplianceControls { + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceControlsImpl.class); + + private final RegulatoryComplianceControlsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public RegulatoryComplianceControlsImpl(RegulatoryComplianceControlsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RegulatoryComplianceControlImpl(inner.getValue(), this.manager())); + } + + public RegulatoryComplianceControl get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName) { + RegulatoryComplianceControlInner inner + = this.serviceClient().get(regulatoryComplianceStandardName, regulatoryComplianceControlName); + if (inner != null) { + return new RegulatoryComplianceControlImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String regulatoryComplianceStandardName) { + PagedIterable inner + = this.serviceClient().list(regulatoryComplianceStandardName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RegulatoryComplianceControlImpl(inner1, this.manager())); + } + + public PagedIterable list(String regulatoryComplianceStandardName, String filter, + Context context) { + PagedIterable inner + = this.serviceClient().list(regulatoryComplianceStandardName, filter, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RegulatoryComplianceControlImpl(inner1, this.manager())); + } + + private RegulatoryComplianceControlsClient 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/RegulatoryComplianceStandardImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardImpl.java new file mode 100644 index 000000000000..1fdf17f1016a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandard; +import com.azure.resourcemanager.security.models.State; + +public final class RegulatoryComplianceStandardImpl implements RegulatoryComplianceStandard { + private RegulatoryComplianceStandardInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RegulatoryComplianceStandardImpl(RegulatoryComplianceStandardInner 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 State state() { + return this.innerModel().state(); + } + + public Integer passedControls() { + return this.innerModel().passedControls(); + } + + public Integer failedControls() { + return this.innerModel().failedControls(); + } + + public Integer skippedControls() { + return this.innerModel().skippedControls(); + } + + public Integer unsupportedControls() { + return this.innerModel().unsupportedControls(); + } + + public RegulatoryComplianceStandardInner 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/RegulatoryComplianceStandardsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java new file mode 100644 index 000000000000..e3c1d57c9ff8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceStandardsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; +import com.azure.resourcemanager.security.implementation.models.RegulatoryComplianceStandardList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceStandardsClient. + */ +public final class RegulatoryComplianceStandardsClientImpl implements RegulatoryComplianceStandardsClient { + /** + * The proxy service used to perform REST calls. + */ + private final RegulatoryComplianceStandardsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of RegulatoryComplianceStandardsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegulatoryComplianceStandardsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(RegulatoryComplianceStandardsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterRegulatoryComplianceStandards to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterRegulatoryComplianceStandards") + public interface RegulatoryComplianceStandardsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("regulatoryComplianceStandardName") String regulatoryComplianceStandardName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance standard details and state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getWithResponseAsync(String regulatoryComplianceStandardName) { + 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @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 regulatory compliance standard details and state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getWithResponseAsync(String regulatoryComplianceStandardName, 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 (regulatoryComplianceStandardName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, accept, context); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance standard details and state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String regulatoryComplianceStandardName) { + return getWithResponseAsync(regulatoryComplianceStandardName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @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 regulatory compliance standard details and state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String regulatoryComplianceStandardName, + Context context) { + return getWithResponseAsync(regulatoryComplianceStandardName, context).block(); + } + + /** + * Supported regulatory compliance details state for selected standard. + * + * @param regulatoryComplianceStandardName Name of the regulatory compliance standard object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance standard details and state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceStandardInner get(String regulatoryComplianceStandardName) { + return getWithResponse(regulatoryComplianceStandardName, Context.NONE).getValue(); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance standards response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + 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 = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + filter, 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())); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @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 regulatory compliance standards response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, 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 = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 regulatory compliance standards response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @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 regulatory compliance standards response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @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 regulatory compliance standards response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @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 regulatory compliance standards response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Supported regulatory compliance standards details and state. + * + * @param filter OData filter. Optional. + * @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 regulatory compliance standards response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, 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 list of regulatory compliance standards response 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 regulatory compliance standards response 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/RegulatoryComplianceStandardsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsImpl.java new file mode 100644 index 000000000000..705a4e60c28e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RegulatoryComplianceStandardsClient; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandard; +import com.azure.resourcemanager.security.models.RegulatoryComplianceStandards; + +public final class RegulatoryComplianceStandardsImpl implements RegulatoryComplianceStandards { + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceStandardsImpl.class); + + private final RegulatoryComplianceStandardsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public RegulatoryComplianceStandardsImpl(RegulatoryComplianceStandardsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String regulatoryComplianceStandardName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(regulatoryComplianceStandardName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RegulatoryComplianceStandardImpl(inner.getValue(), this.manager())); + } + + public RegulatoryComplianceStandard get(String regulatoryComplianceStandardName) { + RegulatoryComplianceStandardInner inner = this.serviceClient().get(regulatoryComplianceStandardName); + if (inner != null) { + return new RegulatoryComplianceStandardImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RegulatoryComplianceStandardImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RegulatoryComplianceStandardImpl(inner1, this.manager())); + } + + private RegulatoryComplianceStandardsClient 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/ResourceManagerUtils.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceManagerUtils.java index 741376ada5b7..667239c36084 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceManagerUtils.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceManagerUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java new file mode 100644 index 000000000000..907e43d05175 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.RuleResultsInner; +import com.azure.resourcemanager.security.models.RuleResults; +import com.azure.resourcemanager.security.models.RuleResultsInput; +import com.azure.resourcemanager.security.models.RuleResultsProperties; +import java.util.List; + +public final class RuleResultsImpl implements RuleResults, RuleResults.Definition, RuleResults.Update { + private RuleResultsInner 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 RuleResultsProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public RuleResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceId; + + private String ruleId; + + private String createDatabaseName; + + private RuleResultsInput createBody; + + private String updateDatabaseName; + + private RuleResultsInput updateBody; + + public RuleResultsImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public RuleResults create() { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(resourceId, ruleId, createDatabaseName, createBody, Context.NONE) + .getValue(); + return this; + } + + public RuleResults create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(resourceId, ruleId, createDatabaseName, createBody, context) + .getValue(); + return this; + } + + RuleResultsImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.serviceManager = serviceManager; + this.ruleId = name; + this.createDatabaseName = null; + this.createBody = new RuleResultsInput(); + } + + public RuleResultsImpl update() { + this.updateDatabaseName = null; + this.updateBody = new RuleResultsInput(); + return this; + } + + public RuleResults apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(resourceId, ruleId, updateDatabaseName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public RuleResults apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(resourceId, ruleId, updateDatabaseName, updateBody, context) + .getValue(); + return this; + } + + RuleResultsImpl(RuleResultsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceId = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "resourceId"); + this.ruleId = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "ruleId"); + } + + public RuleResults refresh() { + String localDatabaseName = null; + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .getWithResponse(resourceId, ruleId, localDatabaseName, Context.NONE) + .getValue(); + return this; + } + + public RuleResults refresh(Context context) { + String localDatabaseName = null; + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .getWithResponse(resourceId, ruleId, localDatabaseName, context) + .getValue(); + return this; + } + + public RuleResultsImpl withLatestScan(Boolean latestScan) { + if (isInCreateMode()) { + this.createBody.withLatestScan(latestScan); + return this; + } else { + this.updateBody.withLatestScan(latestScan); + return this; + } + } + + public RuleResultsImpl withResults(List> results) { + if (isInCreateMode()) { + this.createBody.withResults(results); + return this; + } else { + this.updateBody.withResults(results); + return this; + } + } + + public RuleResultsImpl withDatabaseName(String databaseName) { + if (isInCreateMode()) { + this.createDatabaseName = databaseName; + return this; + } else { + this.updateDatabaseName = databaseName; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RulesResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RulesResultsImpl.java new file mode 100644 index 000000000000..c98721b82b03 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RulesResultsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResults; +import com.azure.resourcemanager.security.models.RulesResults; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class RulesResultsImpl implements RulesResults { + private RulesResultsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + RulesResultsImpl(RulesResultsInner 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 RuleResultsImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public RulesResultsInner 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/ScanResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultImpl.java new file mode 100644 index 000000000000..9fc82677fa44 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.models.ScanResult; +import com.azure.resourcemanager.security.models.ScanResultProperties; + +public final class ScanResultImpl implements ScanResult { + private ScanResultInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScanResultImpl(ScanResultInner 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 ScanResultProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ScanResultInner 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/ScanV2Impl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanV2Impl.java new file mode 100644 index 000000000000..d619bf6dac0e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanV2Impl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.ScanV2Inner; +import com.azure.resourcemanager.security.models.ScanPropertiesV2; +import com.azure.resourcemanager.security.models.ScanV2; + +public final class ScanV2Impl implements ScanV2 { + private ScanV2Inner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScanV2Impl(ScanV2Inner 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 ScanPropertiesV2 properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ScanV2Inner 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/SecureScoreControlDefinitionItemImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionItemImpl.java index 95cbe7eda848..5a786482c09d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionItemImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionItemImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; import com.azure.resourcemanager.security.models.AzureResourceLink; import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionItem; @@ -34,6 +35,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String displayName() { return this.innerModel().displayName(); } 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 7428fdb884f3..2de14bf93423 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.SecureScoreControlDefinitionsClient; import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; -import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionList; +import com.azure.resourcemanager.security.implementation.models.SecureScoreControlDefinitionList; import reactor.core.publisher.Mono; /** @@ -59,21 +59,21 @@ public final class SecureScoreControlDefinitionsClientImpl implements SecureScor * The interface defining all the services for SecurityCenterSecureScoreControlDefinitions to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterSecure") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecureScoreControlDefinitions") public interface SecureScoreControlDefinitionsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Security/secureScoreControlDefinitions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscription(@HostParam("$host") String endpoint, + Mono> listBySubscription(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @@ -82,7 +82,7 @@ Mono> listBySubscription(@HostParam(" @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -90,7 +90,7 @@ Mono> listNext( @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsImpl.java index 5423f04374f9..95109f4b1ae6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDetailsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDetailsImpl.java index c9717c67992a..5367484caa36 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDetailsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDetailsImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionItem; @@ -32,6 +33,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String displayName() { return this.innerModel().displayName(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlScoreDetailsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlScoreDetailsImpl.java index 5c32b8c68890..51f5442ad9f8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlScoreDetailsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlScoreDetailsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; 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 cdb179b68e28..2d28f4a81dae 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,8 +27,8 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.SecureScoreControlsClient; import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; +import com.azure.resourcemanager.security.implementation.models.SecureScoreControlList; import com.azure.resourcemanager.security.models.ExpandControlsEnum; -import com.azure.resourcemanager.security.models.SecureScoreControlList; import reactor.core.publisher.Mono; /** @@ -60,14 +60,14 @@ public final class SecureScoreControlsClientImpl implements SecureScoreControlsC * The interface defining all the services for SecurityCenterSecureScoreControls to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterSecure") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecureScoreControls") public interface SecureScoreControlsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySecureScore(@HostParam("$host") String endpoint, + Mono> listBySecureScore(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("secureScoreName") String secureScoreName, @QueryParam("$expand") ExpandControlsEnum expand, @HeaderParam("Accept") String accept, Context context); @@ -76,7 +76,7 @@ Mono> listBySecureScore(@HostParam("$host") Str @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @QueryParam("$expand") ExpandControlsEnum expand, @HeaderParam("Accept") String accept, Context context); @@ -85,7 +85,7 @@ Mono> list(@HostParam("$host") String endpoint, @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listBySecureScoreNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -93,7 +93,7 @@ Mono> listBySecureScoreNext( @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -403,7 +403,8 @@ public PagedIterable list(ExpandControlsEnum exp * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security controls along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return all security controls for a specific initiative within a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySecureScoreNextSinglePageAsync(String nextLink) { @@ -430,7 +431,8 @@ private Mono> listBySecureScoreNex * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security controls along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return all security controls for a specific initiative within a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySecureScoreNextSinglePageAsync(String nextLink, @@ -456,7 +458,8 @@ private Mono> listBySecureScoreNex * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security controls along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return all security controls within a scope along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -482,7 +485,8 @@ private Mono> listNextSinglePageAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 security controls along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return all security controls within a scope along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsImpl.java index 8c10b8f58ec8..73971b9693cb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreItemImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreItemImpl.java index fc83a1473b34..3231158bb364 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreItemImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreItemImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; import com.azure.resourcemanager.security.models.SecureScoreItem; @@ -30,6 +31,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String displayName() { return this.innerModel().displayName(); } 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 8178ed01dfc2..324d1352b493 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.SecureScoresClient; import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; -import com.azure.resourcemanager.security.models.SecureScoresList; +import com.azure.resourcemanager.security.implementation.models.SecureScoresList; import reactor.core.publisher.Mono; /** @@ -59,43 +59,48 @@ public final class SecureScoresClientImpl implements SecureScoresClient { * The interface defining all the services for SecurityCenterSecureScores to be used by the proxy service to perform * REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterSecure") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecureScores") public interface SecureScoresService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); + @PathParam("secureScoreName") String secureScoreName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("secureScoreName") String secureScoreName, @HeaderParam("Accept") String accept, - Context context); + @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); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. + * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC + * Default initiative, use 'ascScore'. * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 secure scores along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return secure score for a specific Microsoft Defender for Cloud initiative within your current scope along with + * {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getWithResponseAsync(String secureScoreName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -104,27 +109,33 @@ private Mono> listSinglePageAsync() { return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (secureScoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secureScoreName 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(), apiVersion, this.client.getSubscriptionId(), - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + secureScoreName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. + * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC + * Default initiative, use 'ascScore'. * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. * @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 secure scores along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return secure score for a specific Microsoft Defender for Cloud initiative within your current scope along with + * {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getWithResponseAsync(String secureScoreName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -133,81 +144,77 @@ private Mono> listSinglePageAsync(Context co return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (secureScoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secureScoreName 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(), apiVersion, this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), secureScoreName, + accept, context); } /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. + * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC + * Default initiative, use 'ascScore'. * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 secure scores as paginated response with {@link PagedFlux}. + * @return secure score for a specific Microsoft Defender for Cloud initiative within your current scope on + * successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String secureScoreName) { + return getWithResponseAsync(secureScoreName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. + * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC + * Default initiative, use 'ascScore'. * + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. * @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 secure scores as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. - * - * @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 secure scores as paginated response with {@link PagedIterable}. + * @return secure score for a specific Microsoft Defender for Cloud initiative within your current scope along with + * {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String secureScoreName, Context context) { + return getWithResponseAsync(secureScoreName, context).block(); } /** - * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. + * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC + * Default initiative, use 'ascScore'. * - * @param context The context to associate with this operation. + * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample + * request below. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 secure scores as paginated response with {@link PagedIterable}. + * @return secure score for a specific Microsoft Defender for Cloud initiative within your current scope. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public SecureScoreItemInner get(String secureScoreName) { + return getWithResponse(secureScoreName, Context.NONE).getValue(); } /** - * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC - * Default initiative, use 'ascScore'. + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. * - * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample - * request below. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 secure score for a specific Microsoft Defender for Cloud initiative within your current scope along with - * {@link Response} on successful completion of {@link Mono}. + * @return list of secure scores along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String secureScoreName) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -216,33 +223,27 @@ private Mono> getWithResponseAsync(String secureS return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (secureScoreName == null) { - return Mono - .error(new IllegalArgumentException("Parameter secureScoreName 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(), apiVersion, this.client.getSubscriptionId(), - secureScoreName, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC - * Default initiative, use 'ascScore'. + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. * - * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample - * request below. * @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 secure score for a specific Microsoft Defender for Cloud initiative within your current scope along with - * {@link Response} on successful completion of {@link Mono}. + * @return list of secure scores along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String secureScoreName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -251,66 +252,65 @@ private Mono> getWithResponseAsync(String secureS return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (secureScoreName == null) { - return Mono - .error(new IllegalArgumentException("Parameter secureScoreName 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(), apiVersion, this.client.getSubscriptionId(), secureScoreName, - accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC - * Default initiative, use 'ascScore'. + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. * - * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample - * request below. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 secure score for a specific Microsoft Defender for Cloud initiative within your current scope on - * successful completion of {@link Mono}. + * @return list of secure scores as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String secureScoreName) { - return getWithResponseAsync(secureScoreName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC - * Default initiative, use 'ascScore'. + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. * - * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample - * request below. * @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 secure score for a specific Microsoft Defender for Cloud initiative within your current scope along with - * {@link Response}. + * @return list of secure scores as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String secureScoreName, Context context) { - return getWithResponseAsync(secureScoreName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC - * Default initiative, use 'ascScore'. + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. * - * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample - * request below. + * @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 secure scores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List secure scores for all your Microsoft Defender for Cloud initiatives within your current 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 secure score for a specific Microsoft Defender for Cloud initiative within your current scope. + * @return list of secure scores as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SecureScoreItemInner get(String secureScoreName) { - return getWithResponse(secureScoreName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresImpl.java index 4f0ab3083a89..809eb8161cb6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,24 +27,10 @@ public SecureScoresImpl(SecureScoresClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SecureScoreItemImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SecureScoreItemImpl(inner1, this.manager())); - } - public Response getWithResponse(String secureScoreName, Context context) { Response inner = this.serviceClient().getWithResponse(secureScoreName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SecureScoreItemImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecureScoreItemImpl(inner.getValue(), this.manager())); } public SecureScoreItem get(String secureScoreName) { @@ -56,6 +42,16 @@ public SecureScoreItem get(String secureScoreName) { } } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecureScoreItemImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecureScoreItemImpl(inner1, this.manager())); + } + private SecureScoresClient serviceClient() { return this.innerClient; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentMetadataResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentMetadataResponseImpl.java index c37a7b53d871..9830ff379bdb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentMetadataResponseImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentMetadataResponseImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.SecurityAssessmentMetadataResponseInner; import com.azure.resourcemanager.security.models.AssessmentType; @@ -44,6 +45,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public SecurityAssessmentMetadataPropertiesResponsePublishDates publishDates() { return this.innerModel().publishDates(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentResponseImpl.java index 291fb3cdd2b0..0e33684afbd5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentResponseImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityAssessmentResponseImpl.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.SecurityAssessmentMetadataProperties; import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentResponseInner; import com.azure.resourcemanager.security.models.AssessmentLinks; import com.azure.resourcemanager.security.models.AssessmentStatus; @@ -13,7 +13,9 @@ import com.azure.resourcemanager.security.models.ExpandEnum; import com.azure.resourcemanager.security.models.ResourceDetails; import com.azure.resourcemanager.security.models.SecurityAssessment; +import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataProperties; import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; +import com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBaseRisk; import com.azure.resourcemanager.security.models.SecurityAssessmentResponse; import java.util.Collections; import java.util.Map; @@ -36,10 +38,18 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public AssessmentStatusResponse status() { return this.innerModel().status(); } + public SecurityAssessmentPropertiesBaseRisk risk() { + return this.innerModel().risk(); + } + public ResourceDetails resourceDetails() { return this.innerModel().resourceDetails(); } @@ -107,7 +117,6 @@ public SecurityAssessmentResponse create(Context context) { } SecurityAssessmentResponseImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { - this.innerObject = new SecurityAssessmentResponseInner(); this.serviceManager = serviceManager; this.assessmentName = name; this.createAssessment = new SecurityAssessment(); @@ -172,6 +181,16 @@ public SecurityAssessmentResponseImpl withStatus(AssessmentStatus status) { } } + public SecurityAssessmentResponseImpl withRisk(SecurityAssessmentPropertiesBaseRisk risk) { + if (isInCreateMode()) { + this.createAssessment.withRisk(risk); + return this; + } else { + this.updateAssessment.withRisk(risk); + return this; + } + } + public SecurityAssessmentResponseImpl withResourceDetails(ResourceDetails resourceDetails) { if (isInCreateMode()) { this.createAssessment.withResourceDetails(resourceDetails); @@ -213,6 +232,6 @@ public SecurityAssessmentResponseImpl withPartnersData(SecurityAssessmentPartner } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterBuilder.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterBuilder.java index adaa2950db85..b2a8f4fe8f23 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterBuilder.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterBuilder.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -20,34 +20,34 @@ @ServiceClientBuilder(serviceClients = { SecurityCenterImpl.class }) public final class SecurityCenterBuilder { /* - * Azure subscription ID + * Service host */ - private String subscriptionId; + private String endpoint; /** - * Sets Azure subscription ID. + * Sets Service host. * - * @param subscriptionId the subscriptionId value. + * @param endpoint the endpoint value. * @return the SecurityCenterBuilder. */ - public SecurityCenterBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; + public SecurityCenterBuilder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } /* - * server parameter + * The ID of the target subscription. The value must be an UUID. */ - private String endpoint; + private String subscriptionId; /** - * Sets server parameter. + * Sets The ID of the target subscription. The value must be an UUID. * - * @param endpoint the endpoint value. + * @param subscriptionId the subscriptionId value. * @return the SecurityCenterBuilder. */ - public SecurityCenterBuilder endpoint(String endpoint) { - this.endpoint = endpoint; + public SecurityCenterBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; return this; } @@ -132,7 +132,7 @@ public SecurityCenterImpl buildClient() { ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); SecurityCenterImpl client = new SecurityCenterImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); return client; } } 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 b8383d446a78..47ceb3204d76 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -25,33 +25,79 @@ import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.security.fluent.AdvancedThreatProtectionsClient; import com.azure.resourcemanager.security.fluent.AlertsClient; +import com.azure.resourcemanager.security.fluent.AlertsSuppressionRulesClient; import com.azure.resourcemanager.security.fluent.AllowedConnectionsClient; import com.azure.resourcemanager.security.fluent.ApiCollectionsClient; +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.AssignmentsClient; +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; import com.azure.resourcemanager.security.fluent.ComplianceResultsClient; +import com.azure.resourcemanager.security.fluent.CompliancesClient; import com.azure.resourcemanager.security.fluent.CustomRecommendationsClient; +import com.azure.resourcemanager.security.fluent.DefenderForStoragesClient; +import com.azure.resourcemanager.security.fluent.DevOpsConfigurationsClient; +import com.azure.resourcemanager.security.fluent.DevOpsOperationResultsClient; 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.GitHubIssuesClient; +import com.azure.resourcemanager.security.fluent.GitHubOwnersClient; +import com.azure.resourcemanager.security.fluent.GitHubReposClient; +import com.azure.resourcemanager.security.fluent.GitLabGroupsClient; +import com.azure.resourcemanager.security.fluent.GitLabProjectsClient; +import com.azure.resourcemanager.security.fluent.GitLabSubgroupsClient; +import com.azure.resourcemanager.security.fluent.GovernanceAssignmentsClient; +import com.azure.resourcemanager.security.fluent.GovernanceRulesClient; +import com.azure.resourcemanager.security.fluent.HealthReportsClient; +import com.azure.resourcemanager.security.fluent.InformationProtectionPoliciesClient; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionAnalyticsClient; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsAggregatedAlertsClient; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsRecommendationsClient; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.JitNetworkAccessPoliciesClient; +import com.azure.resourcemanager.security.fluent.LocationsClient; +import com.azure.resourcemanager.security.fluent.MdeOnboardingsClient; +import com.azure.resourcemanager.security.fluent.OperationResultsClient; +import com.azure.resourcemanager.security.fluent.OperationStatusesClient; +import com.azure.resourcemanager.security.fluent.OperationsClient; import com.azure.resourcemanager.security.fluent.PricingsClient; +import com.azure.resourcemanager.security.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.security.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.security.fluent.PrivateLinksClient; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceAssessmentsClient; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceControlsClient; +import com.azure.resourcemanager.security.fluent.RegulatoryComplianceStandardsClient; import com.azure.resourcemanager.security.fluent.SecureScoreControlDefinitionsClient; import com.azure.resourcemanager.security.fluent.SecureScoreControlsClient; import com.azure.resourcemanager.security.fluent.SecureScoresClient; import com.azure.resourcemanager.security.fluent.SecurityCenter; +import com.azure.resourcemanager.security.fluent.SecurityConnectorApplicationsClient; +import com.azure.resourcemanager.security.fluent.SecurityConnectorsClient; +import com.azure.resourcemanager.security.fluent.SecurityContactsClient; +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; import com.azure.resourcemanager.security.fluent.SettingsClient; +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.SqlVulnerabilityAssessmentSettingsOperationsClient; import com.azure.resourcemanager.security.fluent.StandardAssignmentsClient; +import com.azure.resourcemanager.security.fluent.StandardsClient; +import com.azure.resourcemanager.security.fluent.SubAssessmentsClient; +import com.azure.resourcemanager.security.fluent.TasksClient; import com.azure.resourcemanager.security.fluent.TopologiesClient; +import com.azure.resourcemanager.security.fluent.WorkspaceSettingsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -67,87 +113,745 @@ @ServiceClient(builder = SecurityCenterBuilder.class) public final class SecurityCenterImpl implements SecurityCenter { /** - * Azure subscription ID. + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * The ID of the target subscription. The value must be an UUID. */ private final String subscriptionId; /** - * Gets Azure subscription ID. + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The AlertsClient object to access its operations. + */ + private final AlertsClient alerts; + + /** + * Gets the AlertsClient object to access its operations. + * + * @return the AlertsClient object. + */ + public AlertsClient getAlerts() { + return this.alerts; + } + + /** + * The AlertsSuppressionRulesClient object to access its operations. + */ + private final AlertsSuppressionRulesClient alertsSuppressionRules; + + /** + * Gets the AlertsSuppressionRulesClient object to access its operations. + * + * @return the AlertsSuppressionRulesClient object. + */ + public AlertsSuppressionRulesClient getAlertsSuppressionRules() { + return this.alertsSuppressionRules; + } + + /** + * The ApiCollectionsClient object to access its operations. + */ + private final ApiCollectionsClient apiCollections; + + /** + * Gets the ApiCollectionsClient object to access its operations. + * + * @return the ApiCollectionsClient object. + */ + public ApiCollectionsClient getApiCollections() { + return this.apiCollections; + } + + /** + * The ApplicationsClient object to access its operations. + */ + private final ApplicationsClient applications; + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + public ApplicationsClient getApplications() { + return this.applications; + } + + /** + * The AssessmentsMetadatasClient object to access its operations. + */ + private final AssessmentsMetadatasClient assessmentsMetadatas; + + /** + * Gets the AssessmentsMetadatasClient object to access its operations. + * + * @return the AssessmentsMetadatasClient object. + */ + public AssessmentsMetadatasClient getAssessmentsMetadatas() { + return this.assessmentsMetadatas; + } + + /** + * The AutomationsClient object to access its operations. + */ + private final AutomationsClient automations; + + /** + * Gets the AutomationsClient object to access its operations. + * + * @return the AutomationsClient object. + */ + public AutomationsClient getAutomations() { + return this.automations; + } + + /** + * The SecurityContactsClient object to access its operations. + */ + private final SecurityContactsClient securityContacts; + + /** + * Gets the SecurityContactsClient object to access its operations. + * + * @return the SecurityContactsClient object. + */ + public SecurityContactsClient getSecurityContacts() { + return this.securityContacts; + } + + /** + * The ComplianceResultsClient object to access its operations. + */ + private final ComplianceResultsClient complianceResults; + + /** + * Gets the ComplianceResultsClient object to access its operations. + * + * @return the ComplianceResultsClient object. + */ + public ComplianceResultsClient getComplianceResults() { + return this.complianceResults; + } + + /** + * The GovernanceAssignmentsClient object to access its operations. + */ + private final GovernanceAssignmentsClient governanceAssignments; + + /** + * Gets the GovernanceAssignmentsClient object to access its operations. + * + * @return the GovernanceAssignmentsClient object. + */ + public GovernanceAssignmentsClient getGovernanceAssignments() { + return this.governanceAssignments; + } + + /** + * The GovernanceRulesClient object to access its operations. + */ + private final GovernanceRulesClient governanceRules; + + /** + * Gets the GovernanceRulesClient object to access its operations. + * + * @return the GovernanceRulesClient object. + */ + public GovernanceRulesClient getGovernanceRules() { + return this.governanceRules; + } + + /** + * The HealthReportsClient object to access its operations. + */ + private final HealthReportsClient healthReports; + + /** + * Gets the HealthReportsClient object to access its operations. + * + * @return the HealthReportsClient object. + */ + public HealthReportsClient getHealthReports() { + return this.healthReports; + } + + /** + * The DeviceSecurityGroupsClient object to access its operations. + */ + private final DeviceSecurityGroupsClient deviceSecurityGroups; + + /** + * Gets the DeviceSecurityGroupsClient object to access its operations. + * + * @return the DeviceSecurityGroupsClient object. + */ + public DeviceSecurityGroupsClient getDeviceSecurityGroups() { + return this.deviceSecurityGroups; + } + + /** + * The AutoProvisioningSettingsClient object to access its operations. + */ + private final AutoProvisioningSettingsClient autoProvisioningSettings; + + /** + * Gets the AutoProvisioningSettingsClient object to access its operations. + * + * @return the AutoProvisioningSettingsClient object. + */ + public AutoProvisioningSettingsClient getAutoProvisioningSettings() { + return this.autoProvisioningSettings; + } + + /** + * The CompliancesClient object to access its operations. + */ + private final CompliancesClient compliances; + + /** + * Gets the CompliancesClient object to access its operations. + * + * @return the CompliancesClient object. + */ + public CompliancesClient getCompliances() { + return this.compliances; + } + + /** + * The InformationProtectionPoliciesClient object to access its operations. + */ + private final InformationProtectionPoliciesClient informationProtectionPolicies; + + /** + * Gets the InformationProtectionPoliciesClient object to access its operations. + * + * @return the InformationProtectionPoliciesClient object. + */ + public InformationProtectionPoliciesClient getInformationProtectionPolicies() { + return this.informationProtectionPolicies; + } + + /** + * The WorkspaceSettingsClient object to access its operations. + */ + private final WorkspaceSettingsClient workspaceSettings; + + /** + * Gets the WorkspaceSettingsClient object to access its operations. + * + * @return the WorkspaceSettingsClient object. + */ + public WorkspaceSettingsClient getWorkspaceSettings() { + return this.workspaceSettings; + } + + /** + * The MdeOnboardingsClient object to access its operations. + */ + private final MdeOnboardingsClient mdeOnboardings; + + /** + * Gets the MdeOnboardingsClient object to access its operations. + * + * @return the MdeOnboardingsClient object. + */ + public MdeOnboardingsClient getMdeOnboardings() { + return this.mdeOnboardings; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The PricingsClient object to access its operations. + */ + private final PricingsClient pricings; + + /** + * Gets the PricingsClient object to access its operations. + * + * @return the PricingsClient object. + */ + public PricingsClient getPricings() { + return this.pricings; + } + + /** + * The PrivateLinkResourcesClient object to access its operations. + */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** + * The PrivateEndpointConnectionsClient object to access its operations. + */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * The RegulatoryComplianceStandardsClient object to access its operations. + */ + private final RegulatoryComplianceStandardsClient regulatoryComplianceStandards; + + /** + * Gets the RegulatoryComplianceStandardsClient object to access its operations. + * + * @return the RegulatoryComplianceStandardsClient object. + */ + public RegulatoryComplianceStandardsClient getRegulatoryComplianceStandards() { + return this.regulatoryComplianceStandards; + } + + /** + * The RegulatoryComplianceControlsClient object to access its operations. + */ + private final RegulatoryComplianceControlsClient regulatoryComplianceControls; + + /** + * Gets the RegulatoryComplianceControlsClient object to access its operations. + * + * @return the RegulatoryComplianceControlsClient object. + */ + public RegulatoryComplianceControlsClient getRegulatoryComplianceControls() { + return this.regulatoryComplianceControls; + } + + /** + * The RegulatoryComplianceAssessmentsClient object to access its operations. + */ + private final RegulatoryComplianceAssessmentsClient regulatoryComplianceAssessments; + + /** + * Gets the RegulatoryComplianceAssessmentsClient object to access its operations. + * + * @return the RegulatoryComplianceAssessmentsClient object. + */ + public RegulatoryComplianceAssessmentsClient getRegulatoryComplianceAssessments() { + return this.regulatoryComplianceAssessments; + } + + /** + * The SecurityConnectorsClient object to access its operations. + */ + private final SecurityConnectorsClient securityConnectors; + + /** + * Gets the SecurityConnectorsClient object to access its operations. + * + * @return the SecurityConnectorsClient object. + */ + 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 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 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 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 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 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 SecurityOperatorsClient object to access its operations. + */ + private final SecurityOperatorsClient securityOperators; + + /** + * Gets the SecurityOperatorsClient object to access its operations. + * + * @return the SecurityOperatorsClient object. + */ + public SecurityOperatorsClient getSecurityOperators() { + return this.securityOperators; + } + + /** + * The DiscoveredSecuritySolutionsClient object to access its operations. + */ + private final DiscoveredSecuritySolutionsClient discoveredSecuritySolutions; + + /** + * Gets the DiscoveredSecuritySolutionsClient object to access its operations. + * + * @return the DiscoveredSecuritySolutionsClient object. + */ + public DiscoveredSecuritySolutionsClient getDiscoveredSecuritySolutions() { + return this.discoveredSecuritySolutions; + } + + /** + * The ExternalSecuritySolutionsClient object to access its operations. + */ + private final ExternalSecuritySolutionsClient externalSecuritySolutions; + + /** + * Gets the ExternalSecuritySolutionsClient object to access its operations. + * + * @return the ExternalSecuritySolutionsClient object. + */ + public ExternalSecuritySolutionsClient getExternalSecuritySolutions() { + return this.externalSecuritySolutions; + } + + /** + * The JitNetworkAccessPoliciesClient object to access its operations. + */ + private final JitNetworkAccessPoliciesClient jitNetworkAccessPolicies; + + /** + * Gets the JitNetworkAccessPoliciesClient object to access its operations. + * + * @return the JitNetworkAccessPoliciesClient object. + */ + public JitNetworkAccessPoliciesClient getJitNetworkAccessPolicies() { + return this.jitNetworkAccessPolicies; + } + + /** + * The SecuritySolutionsClient object to access its operations. + */ + private final SecuritySolutionsClient securitySolutions; + + /** + * Gets the SecuritySolutionsClient object to access its operations. + * + * @return the SecuritySolutionsClient object. + */ + public SecuritySolutionsClient getSecuritySolutions() { + return this.securitySolutions; + } + + /** + * The SecurityStandardsClient object to access its operations. + */ + private final SecurityStandardsClient securityStandards; + + /** + * Gets the SecurityStandardsClient object to access its operations. + * + * @return the SecurityStandardsClient object. + */ + public SecurityStandardsClient getSecurityStandards() { + return this.securityStandards; + } + + /** + * The StandardAssignmentsClient object to access its operations. + */ + private final StandardAssignmentsClient standardAssignments; + + /** + * Gets the StandardAssignmentsClient object to access its operations. + * + * @return the StandardAssignmentsClient object. + */ + public StandardAssignmentsClient getStandardAssignments() { + return this.standardAssignments; + } + + /** + * The CustomRecommendationsClient object to access its operations. + */ + private final CustomRecommendationsClient customRecommendations; + + /** + * Gets the CustomRecommendationsClient object to access its operations. + * + * @return the CustomRecommendationsClient object. + */ + public CustomRecommendationsClient getCustomRecommendations() { + return this.customRecommendations; + } + + /** + * The ServerVulnerabilityAssessmentsSettingsClient object to access its operations. + */ + private final ServerVulnerabilityAssessmentsSettingsClient serverVulnerabilityAssessmentsSettings; + + /** + * Gets the ServerVulnerabilityAssessmentsSettingsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsSettingsClient object. + */ + public ServerVulnerabilityAssessmentsSettingsClient getServerVulnerabilityAssessmentsSettings() { + return this.serverVulnerabilityAssessmentsSettings; + } + + /** + * The SettingsClient object to access its operations. + */ + private final SettingsClient settings; + + /** + * Gets the SettingsClient object to access its operations. + * + * @return the SettingsClient object. + */ + public SettingsClient getSettings() { + return this.settings; + } + + /** + * The SqlVulnerabilityAssessmentBaselineRulesClient object to access its operations. + */ + private final SqlVulnerabilityAssessmentBaselineRulesClient sqlVulnerabilityAssessmentBaselineRules; + + /** + * Gets the SqlVulnerabilityAssessmentBaselineRulesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselineRulesClient object. + */ + public SqlVulnerabilityAssessmentBaselineRulesClient getSqlVulnerabilityAssessmentBaselineRules() { + return this.sqlVulnerabilityAssessmentBaselineRules; + } + + /** + * The SqlVulnerabilityAssessmentScanResultsClient object to access its operations. + */ + private final SqlVulnerabilityAssessmentScanResultsClient sqlVulnerabilityAssessmentScanResults; + + /** + * Gets the SqlVulnerabilityAssessmentScanResultsClient object to access its operations. * - * @return the subscriptionId value. + * @return the SqlVulnerabilityAssessmentScanResultsClient object. */ - public String getSubscriptionId() { - return this.subscriptionId; + public SqlVulnerabilityAssessmentScanResultsClient getSqlVulnerabilityAssessmentScanResults() { + return this.sqlVulnerabilityAssessmentScanResults; } /** - * server parameter. + * The StandardsClient object to access its operations. */ - private final String endpoint; + private final StandardsClient standards; /** - * Gets server parameter. + * Gets the StandardsClient object to access its operations. * - * @return the endpoint value. + * @return the StandardsClient object. */ - public String getEndpoint() { - return this.endpoint; + public StandardsClient getStandards() { + return this.standards; } /** - * The HTTP pipeline to send requests through. + * The AssignmentsClient object to access its operations. */ - private final HttpPipeline httpPipeline; + private final AssignmentsClient assignments; /** - * Gets The HTTP pipeline to send requests through. + * Gets the AssignmentsClient object to access its operations. * - * @return the httpPipeline value. + * @return the AssignmentsClient object. */ - public HttpPipeline getHttpPipeline() { - return this.httpPipeline; + public AssignmentsClient getAssignments() { + return this.assignments; } /** - * The serializer to serialize an object into a string. + * The TasksClient object to access its operations. */ - private final SerializerAdapter serializerAdapter; + private final TasksClient tasks; /** - * Gets The serializer to serialize an object into a string. + * Gets the TasksClient object to access its operations. * - * @return the serializerAdapter value. + * @return the TasksClient object. */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; + public TasksClient getTasks() { + return this.tasks; } /** - * The default poll interval for long-running operation. + * The SecurityConnectorApplicationsClient object to access its operations. */ - private final Duration defaultPollInterval; + private final SecurityConnectorApplicationsClient securityConnectorApplications; /** - * Gets The default poll interval for long-running operation. + * Gets the SecurityConnectorApplicationsClient object to access its operations. * - * @return the defaultPollInterval value. + * @return the SecurityConnectorApplicationsClient object. */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; + public SecurityConnectorApplicationsClient getSecurityConnectorApplications() { + return this.securityConnectorApplications; } /** - * The ComplianceResultsClient object to access its operations. + * The AssessmentsClient object to access its operations. */ - private final ComplianceResultsClient complianceResults; + private final AssessmentsClient assessments; /** - * Gets the ComplianceResultsClient object to access its operations. + * Gets the AssessmentsClient object to access its operations. * - * @return the ComplianceResultsClient object. + * @return the AssessmentsClient object. */ - public ComplianceResultsClient getComplianceResults() { - return this.complianceResults; + public AssessmentsClient getAssessments() { + return this.assessments; } /** @@ -165,17 +869,17 @@ public AdvancedThreatProtectionsClient getAdvancedThreatProtections() { } /** - * The DeviceSecurityGroupsClient object to access its operations. + * The DefenderForStoragesClient object to access its operations. */ - private final DeviceSecurityGroupsClient deviceSecurityGroups; + private final DefenderForStoragesClient defenderForStorages; /** - * Gets the DeviceSecurityGroupsClient object to access its operations. + * Gets the DefenderForStoragesClient object to access its operations. * - * @return the DeviceSecurityGroupsClient object. + * @return the DefenderForStoragesClient object. */ - public DeviceSecurityGroupsClient getDeviceSecurityGroups() { - return this.deviceSecurityGroups; + public DefenderForStoragesClient getDefenderForStorages() { + return this.defenderForStorages; } /** @@ -192,6 +896,20 @@ public IotSecuritySolutionAnalyticsClient getIotSecuritySolutionAnalytics() { return this.iotSecuritySolutionAnalytics; } + /** + * The IotSecuritySolutionsClient object to access its operations. + */ + private final IotSecuritySolutionsClient iotSecuritySolutions; + + /** + * Gets the IotSecuritySolutionsClient object to access its operations. + * + * @return the IotSecuritySolutionsClient object. + */ + public IotSecuritySolutionsClient getIotSecuritySolutions() { + return this.iotSecuritySolutions; + } + /** * The IotSecuritySolutionsAnalyticsAggregatedAlertsClient object to access its operations. */ @@ -221,73 +939,59 @@ public IotSecuritySolutionsAnalyticsRecommendationsClient getIotSecuritySolution } /** - * The IotSecuritySolutionsClient object to access its operations. - */ - private final IotSecuritySolutionsClient iotSecuritySolutions; - - /** - * Gets the IotSecuritySolutionsClient object to access its operations. - * - * @return the IotSecuritySolutionsClient object. + * The LocationsClient object to access its operations. */ - public IotSecuritySolutionsClient getIotSecuritySolutions() { - return this.iotSecuritySolutions; - } - - /** - * The AllowedConnectionsClient object to access its operations. - */ - private final AllowedConnectionsClient allowedConnections; + private final LocationsClient locations; /** - * Gets the AllowedConnectionsClient object to access its operations. + * Gets the LocationsClient object to access its operations. * - * @return the AllowedConnectionsClient object. + * @return the LocationsClient object. */ - public AllowedConnectionsClient getAllowedConnections() { - return this.allowedConnections; + public LocationsClient getLocations() { + return this.locations; } /** - * The DiscoveredSecuritySolutionsClient object to access its operations. + * The OperationResultsClient object to access its operations. */ - private final DiscoveredSecuritySolutionsClient discoveredSecuritySolutions; + private final OperationResultsClient operationResults; /** - * Gets the DiscoveredSecuritySolutionsClient object to access its operations. + * Gets the OperationResultsClient object to access its operations. * - * @return the DiscoveredSecuritySolutionsClient object. + * @return the OperationResultsClient object. */ - public DiscoveredSecuritySolutionsClient getDiscoveredSecuritySolutions() { - return this.discoveredSecuritySolutions; + public OperationResultsClient getOperationResults() { + return this.operationResults; } /** - * The ExternalSecuritySolutionsClient object to access its operations. + * The OperationStatusesClient object to access its operations. */ - private final ExternalSecuritySolutionsClient externalSecuritySolutions; + private final OperationStatusesClient operationStatuses; /** - * Gets the ExternalSecuritySolutionsClient object to access its operations. + * Gets the OperationStatusesClient object to access its operations. * - * @return the ExternalSecuritySolutionsClient object. + * @return the OperationStatusesClient object. */ - public ExternalSecuritySolutionsClient getExternalSecuritySolutions() { - return this.externalSecuritySolutions; + public OperationStatusesClient getOperationStatuses() { + return this.operationStatuses; } /** - * The JitNetworkAccessPoliciesClient object to access its operations. + * The PrivateLinksClient object to access its operations. */ - private final JitNetworkAccessPoliciesClient jitNetworkAccessPolicies; + private final PrivateLinksClient privateLinks; /** - * Gets the JitNetworkAccessPoliciesClient object to access its operations. + * Gets the PrivateLinksClient object to access its operations. * - * @return the JitNetworkAccessPoliciesClient object. + * @return the PrivateLinksClient object. */ - public JitNetworkAccessPoliciesClient getJitNetworkAccessPolicies() { - return this.jitNetworkAccessPolicies; + public PrivateLinksClient getPrivateLinks() { + return this.privateLinks; } /** @@ -333,199 +1037,185 @@ public SecureScoreControlDefinitionsClient getSecureScoreControlDefinitions() { } /** - * The SecuritySolutionsClient object to access its operations. - */ - private final SecuritySolutionsClient securitySolutions; - - /** - * Gets the SecuritySolutionsClient object to access its operations. - * - * @return the SecuritySolutionsClient object. - */ - public SecuritySolutionsClient getSecuritySolutions() { - return this.securitySolutions; - } - - /** - * The SecuritySolutionsReferenceDatasClient object to access its operations. + * The GitLabSubgroupsClient object to access its operations. */ - private final SecuritySolutionsReferenceDatasClient securitySolutionsReferenceDatas; + private final GitLabSubgroupsClient gitLabSubgroups; /** - * Gets the SecuritySolutionsReferenceDatasClient object to access its operations. + * Gets the GitLabSubgroupsClient object to access its operations. * - * @return the SecuritySolutionsReferenceDatasClient object. + * @return the GitLabSubgroupsClient object. */ - public SecuritySolutionsReferenceDatasClient getSecuritySolutionsReferenceDatas() { - return this.securitySolutionsReferenceDatas; + public GitLabSubgroupsClient getGitLabSubgroups() { + return this.gitLabSubgroups; } /** - * The ServerVulnerabilityAssessmentsClient object to access its operations. + * The DevOpsOperationResultsClient object to access its operations. */ - private final ServerVulnerabilityAssessmentsClient serverVulnerabilityAssessments; + private final DevOpsOperationResultsClient devOpsOperationResults; /** - * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * Gets the DevOpsOperationResultsClient object to access its operations. * - * @return the ServerVulnerabilityAssessmentsClient object. + * @return the DevOpsOperationResultsClient object. */ - public ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments() { - return this.serverVulnerabilityAssessments; + public DevOpsOperationResultsClient getDevOpsOperationResults() { + return this.devOpsOperationResults; } /** - * The TopologiesClient object to access its operations. + * The AzureDevOpsReposClient object to access its operations. */ - private final TopologiesClient topologies; + private final AzureDevOpsReposClient azureDevOpsRepos; /** - * Gets the TopologiesClient object to access its operations. + * Gets the AzureDevOpsReposClient object to access its operations. * - * @return the TopologiesClient object. + * @return the AzureDevOpsReposClient object. */ - public TopologiesClient getTopologies() { - return this.topologies; + public AzureDevOpsReposClient getAzureDevOpsRepos() { + return this.azureDevOpsRepos; } /** - * The AssessmentsMetadatasClient object to access its operations. + * The GitHubReposClient object to access its operations. */ - private final AssessmentsMetadatasClient assessmentsMetadatas; + private final GitHubReposClient gitHubRepos; /** - * Gets the AssessmentsMetadatasClient object to access its operations. + * Gets the GitHubReposClient object to access its operations. * - * @return the AssessmentsMetadatasClient object. + * @return the GitHubReposClient object. */ - public AssessmentsMetadatasClient getAssessmentsMetadatas() { - return this.assessmentsMetadatas; + public GitHubReposClient getGitHubRepos() { + return this.gitHubRepos; } /** - * The AssessmentsClient object to access its operations. + * The GitHubIssuesClient object to access its operations. */ - private final AssessmentsClient assessments; + private final GitHubIssuesClient gitHubIssues; /** - * Gets the AssessmentsClient object to access its operations. + * Gets the GitHubIssuesClient object to access its operations. * - * @return the AssessmentsClient object. + * @return the GitHubIssuesClient object. */ - public AssessmentsClient getAssessments() { - return this.assessments; + public GitHubIssuesClient getGitHubIssues() { + return this.gitHubIssues; } /** - * The AlertsClient object to access its operations. + * The AllowedConnectionsClient object to access its operations. */ - private final AlertsClient alerts; + private final AllowedConnectionsClient allowedConnections; /** - * Gets the AlertsClient object to access its operations. + * Gets the AllowedConnectionsClient object to access its operations. * - * @return the AlertsClient object. + * @return the AllowedConnectionsClient object. */ - public AlertsClient getAlerts() { - return this.alerts; + public AllowedConnectionsClient getAllowedConnections() { + return this.allowedConnections; } /** - * The SettingsClient object to access its operations. + * The ServerVulnerabilityAssessmentsClient object to access its operations. */ - private final SettingsClient settings; + private final ServerVulnerabilityAssessmentsClient serverVulnerabilityAssessments; /** - * Gets the SettingsClient object to access its operations. + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. * - * @return the SettingsClient object. + * @return the ServerVulnerabilityAssessmentsClient object. */ - public SettingsClient getSettings() { - return this.settings; + public ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments() { + return this.serverVulnerabilityAssessments; } /** - * The ServerVulnerabilityAssessmentsSettingsClient object to access its operations. + * The TopologiesClient object to access its operations. */ - private final ServerVulnerabilityAssessmentsSettingsClient serverVulnerabilityAssessmentsSettings; + private final TopologiesClient topologies; /** - * Gets the ServerVulnerabilityAssessmentsSettingsClient object to access its operations. + * Gets the TopologiesClient object to access its operations. * - * @return the ServerVulnerabilityAssessmentsSettingsClient object. + * @return the TopologiesClient object. */ - public ServerVulnerabilityAssessmentsSettingsClient getServerVulnerabilityAssessmentsSettings() { - return this.serverVulnerabilityAssessmentsSettings; + public TopologiesClient getTopologies() { + return this.topologies; } /** - * The ApiCollectionsClient object to access its operations. + * The SecuritySolutionsReferenceDatasClient object to access its operations. */ - private final ApiCollectionsClient apiCollections; + private final SecuritySolutionsReferenceDatasClient securitySolutionsReferenceDatas; /** - * Gets the ApiCollectionsClient object to access its operations. + * Gets the SecuritySolutionsReferenceDatasClient object to access its operations. * - * @return the ApiCollectionsClient object. + * @return the SecuritySolutionsReferenceDatasClient object. */ - public ApiCollectionsClient getApiCollections() { - return this.apiCollections; + public SecuritySolutionsReferenceDatasClient getSecuritySolutionsReferenceDatas() { + return this.securitySolutionsReferenceDatas; } /** - * The PricingsClient object to access its operations. + * The SensitivitySettingsClient object to access its operations. */ - private final PricingsClient pricings; + private final SensitivitySettingsClient sensitivitySettings; /** - * Gets the PricingsClient object to access its operations. + * Gets the SensitivitySettingsClient object to access its operations. * - * @return the PricingsClient object. + * @return the SensitivitySettingsClient object. */ - public PricingsClient getPricings() { - return this.pricings; + public SensitivitySettingsClient getSensitivitySettings() { + return this.sensitivitySettings; } /** - * The SecurityStandardsClient object to access its operations. + * The SqlVulnerabilityAssessmentSettingsOperationsClient object to access its operations. */ - private final SecurityStandardsClient securityStandards; + private final SqlVulnerabilityAssessmentSettingsOperationsClient sqlVulnerabilityAssessmentSettingsOperations; /** - * Gets the SecurityStandardsClient object to access its operations. + * Gets the SqlVulnerabilityAssessmentSettingsOperationsClient object to access its operations. * - * @return the SecurityStandardsClient object. + * @return the SqlVulnerabilityAssessmentSettingsOperationsClient object. */ - public SecurityStandardsClient getSecurityStandards() { - return this.securityStandards; + public SqlVulnerabilityAssessmentSettingsOperationsClient getSqlVulnerabilityAssessmentSettingsOperations() { + return this.sqlVulnerabilityAssessmentSettingsOperations; } /** - * The StandardAssignmentsClient object to access its operations. + * The SqlVulnerabilityAssessmentScansClient object to access its operations. */ - private final StandardAssignmentsClient standardAssignments; + private final SqlVulnerabilityAssessmentScansClient sqlVulnerabilityAssessmentScans; /** - * Gets the StandardAssignmentsClient object to access its operations. + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. * - * @return the StandardAssignmentsClient object. + * @return the SqlVulnerabilityAssessmentScansClient object. */ - public StandardAssignmentsClient getStandardAssignments() { - return this.standardAssignments; + public SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans() { + return this.sqlVulnerabilityAssessmentScans; } /** - * The CustomRecommendationsClient object to access its operations. + * The SubAssessmentsClient object to access its operations. */ - private final CustomRecommendationsClient customRecommendations; + private final SubAssessmentsClient subAssessments; /** - * Gets the CustomRecommendationsClient object to access its operations. + * Gets the SubAssessmentsClient object to access its operations. * - * @return the CustomRecommendationsClient object. + * @return the SubAssessmentsClient object. */ - public CustomRecommendationsClient getCustomRecommendations() { - return this.customRecommendations; + public SubAssessmentsClient getSubAssessments() { + return this.subAssessments; } /** @@ -535,46 +1225,93 @@ public CustomRecommendationsClient getCustomRecommendations() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId Azure subscription ID. - * @param endpoint server parameter. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. */ SecurityCenterImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String subscriptionId, String endpoint) { + AzureEnvironment environment, String endpoint, String subscriptionId) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; - this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.alerts = new AlertsClientImpl(this); + this.alertsSuppressionRules = new AlertsSuppressionRulesClientImpl(this); + this.apiCollections = new ApiCollectionsClientImpl(this); + this.applications = new ApplicationsClientImpl(this); + this.assessmentsMetadatas = new AssessmentsMetadatasClientImpl(this); + this.automations = new AutomationsClientImpl(this); + this.securityContacts = new SecurityContactsClientImpl(this); this.complianceResults = new ComplianceResultsClientImpl(this); - this.advancedThreatProtections = new AdvancedThreatProtectionsClientImpl(this); + this.governanceAssignments = new GovernanceAssignmentsClientImpl(this); + this.governanceRules = new GovernanceRulesClientImpl(this); + this.healthReports = new HealthReportsClientImpl(this); this.deviceSecurityGroups = new DeviceSecurityGroupsClientImpl(this); + this.autoProvisioningSettings = new AutoProvisioningSettingsClientImpl(this); + this.compliances = new CompliancesClientImpl(this); + this.informationProtectionPolicies = new InformationProtectionPoliciesClientImpl(this); + this.workspaceSettings = new WorkspaceSettingsClientImpl(this); + this.mdeOnboardings = new MdeOnboardingsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.pricings = new PricingsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.regulatoryComplianceStandards = new RegulatoryComplianceStandardsClientImpl(this); + this.regulatoryComplianceControls = new RegulatoryComplianceControlsClientImpl(this); + this.regulatoryComplianceAssessments = new RegulatoryComplianceAssessmentsClientImpl(this); + this.securityConnectors = new SecurityConnectorsClientImpl(this); + this.azureDevOpsOrgs = new AzureDevOpsOrgsClientImpl(this); + this.gitHubOwners = new GitHubOwnersClientImpl(this); + this.gitLabGroups = new GitLabGroupsClientImpl(this); + this.devOpsConfigurations = new DevOpsConfigurationsClientImpl(this); + this.azureDevOpsProjects = new AzureDevOpsProjectsClientImpl(this); + this.gitLabProjects = new GitLabProjectsClientImpl(this); + this.securityOperators = new SecurityOperatorsClientImpl(this); + this.discoveredSecuritySolutions = new DiscoveredSecuritySolutionsClientImpl(this); + this.externalSecuritySolutions = new ExternalSecuritySolutionsClientImpl(this); + this.jitNetworkAccessPolicies = new JitNetworkAccessPoliciesClientImpl(this); + this.securitySolutions = new SecuritySolutionsClientImpl(this); + this.securityStandards = new SecurityStandardsClientImpl(this); + this.standardAssignments = new StandardAssignmentsClientImpl(this); + this.customRecommendations = new CustomRecommendationsClientImpl(this); + this.serverVulnerabilityAssessmentsSettings = new ServerVulnerabilityAssessmentsSettingsClientImpl(this); + this.settings = new SettingsClientImpl(this); + this.sqlVulnerabilityAssessmentBaselineRules = new SqlVulnerabilityAssessmentBaselineRulesClientImpl(this); + this.sqlVulnerabilityAssessmentScanResults = new SqlVulnerabilityAssessmentScanResultsClientImpl(this); + this.standards = new StandardsClientImpl(this); + this.assignments = new AssignmentsClientImpl(this); + this.tasks = new TasksClientImpl(this); + this.securityConnectorApplications = new SecurityConnectorApplicationsClientImpl(this); + this.assessments = new AssessmentsClientImpl(this); + this.advancedThreatProtections = new AdvancedThreatProtectionsClientImpl(this); + this.defenderForStorages = new DefenderForStoragesClientImpl(this); this.iotSecuritySolutionAnalytics = new IotSecuritySolutionAnalyticsClientImpl(this); + this.iotSecuritySolutions = new IotSecuritySolutionsClientImpl(this); this.iotSecuritySolutionsAnalyticsAggregatedAlerts = new IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl(this); this.iotSecuritySolutionsAnalyticsRecommendations = new IotSecuritySolutionsAnalyticsRecommendationsClientImpl(this); - this.iotSecuritySolutions = new IotSecuritySolutionsClientImpl(this); - this.allowedConnections = new AllowedConnectionsClientImpl(this); - this.discoveredSecuritySolutions = new DiscoveredSecuritySolutionsClientImpl(this); - this.externalSecuritySolutions = new ExternalSecuritySolutionsClientImpl(this); - this.jitNetworkAccessPolicies = new JitNetworkAccessPoliciesClientImpl(this); + this.locations = new LocationsClientImpl(this); + this.operationResults = new OperationResultsClientImpl(this); + this.operationStatuses = new OperationStatusesClientImpl(this); + this.privateLinks = new PrivateLinksClientImpl(this); this.secureScores = new SecureScoresClientImpl(this); this.secureScoreControls = new SecureScoreControlsClientImpl(this); this.secureScoreControlDefinitions = new SecureScoreControlDefinitionsClientImpl(this); - this.securitySolutions = new SecuritySolutionsClientImpl(this); - this.securitySolutionsReferenceDatas = new SecuritySolutionsReferenceDatasClientImpl(this); + this.gitLabSubgroups = new GitLabSubgroupsClientImpl(this); + this.devOpsOperationResults = new DevOpsOperationResultsClientImpl(this); + this.azureDevOpsRepos = new AzureDevOpsReposClientImpl(this); + this.gitHubRepos = new GitHubReposClientImpl(this); + this.gitHubIssues = new GitHubIssuesClientImpl(this); + this.allowedConnections = new AllowedConnectionsClientImpl(this); this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsClientImpl(this); this.topologies = new TopologiesClientImpl(this); - this.assessmentsMetadatas = new AssessmentsMetadatasClientImpl(this); - this.assessments = new AssessmentsClientImpl(this); - this.alerts = new AlertsClientImpl(this); - this.settings = new SettingsClientImpl(this); - this.serverVulnerabilityAssessmentsSettings = new ServerVulnerabilityAssessmentsSettingsClientImpl(this); - this.apiCollections = new ApiCollectionsClientImpl(this); - this.pricings = new PricingsClientImpl(this); - this.securityStandards = new SecurityStandardsClientImpl(this); - this.standardAssignments = new StandardAssignmentsClientImpl(this); - this.customRecommendations = new CustomRecommendationsClientImpl(this); + this.securitySolutionsReferenceDatas = new SecuritySolutionsReferenceDatasClientImpl(this); + this.sensitivitySettings = new SensitivitySettingsClientImpl(this); + this.sqlVulnerabilityAssessmentSettingsOperations + = new SqlVulnerabilityAssessmentSettingsOperationsClientImpl(this); + this.sqlVulnerabilityAssessmentScans = new SqlVulnerabilityAssessmentScansClientImpl(this); + this.subAssessments = new SubAssessmentsClientImpl(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 new file mode 100644 index 000000000000..70584314a8f4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsClientImpl.java @@ -0,0 +1,743 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityConnectorApplicationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import com.azure.resourcemanager.security.implementation.models.ApplicationsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecurityConnectorApplicationsClient. + */ +public final class SecurityConnectorApplicationsClientImpl implements SecurityConnectorApplicationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecurityConnectorApplicationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecurityConnectorApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityConnectorApplicationsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SecurityConnectorApplicationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecurityConnectorApplications to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecurityConnectorApplications") + public interface SecurityConnectorApplicationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("applicationId") String applicationId, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("applicationId") String applicationId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApplicationInner application, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("applicationId") String applicationId, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 application for the requested scope by applicationId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String applicationId) { + 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, applicationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String applicationId, 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, applicationId, accept, context); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 application for the requested scope by applicationId on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String applicationId) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, applicationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String applicationId, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, context).block(); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 application for the requested scope by applicationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner get(String resourceGroupName, String securityConnectorName, String applicationId) { + return getWithResponse(resourceGroupName, securityConnectorName, applicationId, Context.NONE).getValue(); + } + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String applicationId, ApplicationInner application) { + 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + if (application == null) { + return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String apiVersion = "2022-07-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, applicationId, contentType, + accept, application, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String applicationId, ApplicationInner application, 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + if (application == null) { + return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String apiVersion = "2022-07-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, applicationId, contentType, accept, application, context); + } + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + String applicationId, ApplicationInner application) { + return createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, application) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String applicationId, ApplicationInner application, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, application, + context).block(); + } + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @param application Application over a subscription 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 Application over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner createOrUpdate(String resourceGroupName, String securityConnectorName, String applicationId, + ApplicationInner application) { + return createOrUpdateWithResponse(resourceGroupName, securityConnectorName, applicationId, application, + Context.NONE).getValue(); + } + + /** + * Delete an Application over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 applicationId) { + 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, applicationId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an Application over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 applicationId, 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 (applicationId == null) { + return Mono.error(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, applicationId, context); + } + + /** + * Delete an Application over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 applicationId) { + return deleteWithResponseAsync(resourceGroupName, securityConnectorName, applicationId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an Application over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @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 resourceGroupName, String securityConnectorName, + String applicationId, Context context) { + return deleteWithResponseAsync(resourceGroupName, securityConnectorName, applicationId, context).block(); + } + + /** + * Delete an Application over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param applicationId The security Application key - unique key for the standard application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 applicationId) { + deleteWithResponse(resourceGroupName, securityConnectorName, applicationId, Context.NONE); + } + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @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 a list of all relevant applications over a security connector level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName) { + 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 = "2022-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, 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 applications over a security connector level scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a list of all relevant applications over a security connector level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName, 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 = "2022-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, 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 applications over a security connector level scope. + * + * @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 a list of all relevant applications over a security connector level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a list of all relevant applications over a security connector level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @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 a list of all relevant applications over a security connector level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName)); + } + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a list of all relevant applications over a security connector level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, 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 a list of all relevant applications over a security connector level scope 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 all relevant applications over a security connector level scope 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/SecurityConnectorApplicationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsImpl.java new file mode 100644 index 000000000000..df7bd9afaedf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsImpl.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityConnectorApplicationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import com.azure.resourcemanager.security.models.Application; +import com.azure.resourcemanager.security.models.SecurityConnectorApplications; + +public final class SecurityConnectorApplicationsImpl implements SecurityConnectorApplications { + private static final ClientLogger LOGGER = new ClientLogger(SecurityConnectorApplicationsImpl.class); + + private final SecurityConnectorApplicationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecurityConnectorApplicationsImpl(SecurityConnectorApplicationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String applicationId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, applicationId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } + + public Application get(String resourceGroupName, String securityConnectorName, String applicationId) { + ApplicationInner inner = this.serviceClient().get(resourceGroupName, securityConnectorName, applicationId); + if (inner != null) { + return new ApplicationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String applicationId, ApplicationInner application, Context context) { + Response inner = this.serviceClient() + .createOrUpdateWithResponse(resourceGroupName, securityConnectorName, applicationId, application, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } + + public Application createOrUpdate(String resourceGroupName, String securityConnectorName, String applicationId, + ApplicationInner application) { + ApplicationInner inner + = this.serviceClient().createOrUpdate(resourceGroupName, securityConnectorName, applicationId, application); + if (inner != null) { + return new ApplicationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String securityConnectorName, + String applicationId, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, securityConnectorName, applicationId, context); + } + + public void delete(String resourceGroupName, String securityConnectorName, String applicationId) { + this.serviceClient().delete(resourceGroupName, securityConnectorName, applicationId); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, securityConnectorName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + private SecurityConnectorApplicationsClient 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/SecurityConnectorImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorImpl.java new file mode 100644 index 000000000000..47f5601ce9b1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityConnectorInner; +import com.azure.resourcemanager.security.models.CloudName; +import com.azure.resourcemanager.security.models.CloudOffering; +import com.azure.resourcemanager.security.models.EnvironmentData; +import com.azure.resourcemanager.security.models.SecurityConnector; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class SecurityConnectorImpl + implements SecurityConnector, SecurityConnector.Definition, SecurityConnector.Update { + private SecurityConnectorInner 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 Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String hierarchyIdentifier() { + return this.innerModel().hierarchyIdentifier(); + } + + public OffsetDateTime hierarchyIdentifierTrialEndDate() { + return this.innerModel().hierarchyIdentifierTrialEndDate(); + } + + public CloudName environmentName() { + return this.innerModel().environmentName(); + } + + public List offerings() { + List inner = this.innerModel().offerings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EnvironmentData environmentData() { + return this.innerModel().environmentData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SecurityConnectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String securityConnectorName; + + public SecurityConnectorImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SecurityConnector create() { + this.innerObject = serviceManager.serviceClient() + .getSecurityConnectors() + .createOrUpdateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityConnector create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityConnectors() + .createOrUpdateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityConnectorImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new SecurityConnectorInner(); + this.serviceManager = serviceManager; + this.securityConnectorName = name; + } + + public SecurityConnectorImpl update() { + return this; + } + + public SecurityConnector apply() { + this.innerObject = serviceManager.serviceClient() + .getSecurityConnectors() + .updateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityConnector apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityConnectors() + .updateWithResponse(resourceGroupName, securityConnectorName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityConnectorImpl(SecurityConnectorInner 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"); + } + + public SecurityConnector refresh() { + this.innerObject = serviceManager.serviceClient() + .getSecurityConnectors() + .getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, Context.NONE) + .getValue(); + return this; + } + + public SecurityConnector refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityConnectors() + .getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, context) + .getValue(); + return this; + } + + public SecurityConnectorImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SecurityConnectorImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SecurityConnectorImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public SecurityConnectorImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public SecurityConnectorImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public SecurityConnectorImpl withHierarchyIdentifier(String hierarchyIdentifier) { + this.innerModel().withHierarchyIdentifier(hierarchyIdentifier); + return this; + } + + public SecurityConnectorImpl withEnvironmentName(CloudName environmentName) { + this.innerModel().withEnvironmentName(environmentName); + return this; + } + + public SecurityConnectorImpl withOfferings(List offerings) { + this.innerModel().withOfferings(offerings); + return this; + } + + public SecurityConnectorImpl withEnvironmentData(EnvironmentData environmentData) { + this.innerModel().withEnvironmentData(environmentData); + return this; + } +} 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 new file mode 100644 index 000000000000..171903815a0a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsClientImpl.java @@ -0,0 +1,1034 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.SecurityConnectorsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityConnectorInner; +import com.azure.resourcemanager.security.implementation.models.SecurityConnectorsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecurityConnectorsClient. + */ +public final class SecurityConnectorsClientImpl implements SecurityConnectorsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecurityConnectorsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecurityConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityConnectorsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SecurityConnectorsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecurityConnectors to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecurityConnectors") + public interface SecurityConnectorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SecurityConnectorInner securityConnector, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SecurityConnectorInner securityConnector, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves details of a specific security connector. + * + * @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 the security connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String securityConnectorName) { + 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-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves details of a specific security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the security connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String securityConnectorName, 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-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, accept, context); + } + + /** + * Retrieves details of a specific security connector. + * + * @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 the security connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String securityConnectorName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, securityConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves details of a specific security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the security connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, securityConnectorName, context).block(); + } + + /** + * Retrieves details of a specific security connector. + * + * @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 the security connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityConnectorInner getByResourceGroup(String resourceGroupName, String securityConnectorName) { + return getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, Context.NONE).getValue(); + } + + /** + * Creates or updates a security connector. If a security connector is already created and a subsequent request is + * issued for the same security connector id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, SecurityConnectorInner securityConnector) { + 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 (securityConnector == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnector is required and cannot be null.")); + } else { + securityConnector.validate(); + } + final String apiVersion = "2024-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, contentType, accept, + securityConnector, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a security connector. If a security connector is already created and a subsequent request is + * issued for the same security connector id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, SecurityConnectorInner securityConnector, 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 (securityConnector == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnector is required and cannot be null.")); + } else { + securityConnector.validate(); + } + final String apiVersion = "2024-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, contentType, accept, securityConnector, context); + } + + /** + * Creates or updates a security connector. If a security connector is already created and a subsequent request is + * issued for the same security connector id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector) { + return createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, securityConnector) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a security connector. If a security connector is already created and a subsequent request is + * issued for the same security connector id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String securityConnectorName, SecurityConnectorInner securityConnector, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, securityConnectorName, securityConnector, context) + .block(); + } + + /** + * Creates or updates a security connector. If a security connector is already created and a subsequent request is + * issued for the same security connector id, then it will be updated. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityConnectorInner createOrUpdate(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector) { + return createOrUpdateWithResponse(resourceGroupName, securityConnectorName, securityConnector, Context.NONE) + .getValue(); + } + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, SecurityConnectorInner securityConnector) { + 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 (securityConnector == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnector is required and cannot be null.")); + } else { + securityConnector.validate(); + } + final String apiVersion = "2024-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, contentType, accept, securityConnector, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, SecurityConnectorInner securityConnector, 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 (securityConnector == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnector is required and cannot be null.")); + } else { + securityConnector.validate(); + } + final String apiVersion = "2024-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, contentType, accept, securityConnector, context); + } + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector) { + return updateWithResponseAsync(resourceGroupName, securityConnectorName, securityConnector) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector, Context context) { + return updateWithResponseAsync(resourceGroupName, securityConnectorName, securityConnector, context).block(); + } + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param securityConnector The security connector 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 the security connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityConnectorInner update(String resourceGroupName, String securityConnectorName, + SecurityConnectorInner securityConnector) { + return updateWithResponse(resourceGroupName, securityConnectorName, securityConnector, Context.NONE).getValue(); + } + + /** + * Deletes a security connector. + * + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String securityConnectorName) { + 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-08-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String securityConnectorName, + 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-08-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, context); + } + + /** + * Deletes a security connector. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String securityConnectorName) { + return deleteWithResponseAsync(resourceGroupName, securityConnectorName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a security connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String securityConnectorName, Context context) { + return deleteWithResponseAsync(resourceGroupName, securityConnectorName, context).block(); + } + + /** + * Deletes a security connector. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String securityConnectorName) { + deleteWithResponse(resourceGroupName, securityConnectorName, Context.NONE); + } + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security connectors response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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())); + } + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security connectors response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security connectors response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security connectors response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified 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 list of security connectors response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2024-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified subscription. + * + * @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 security connectors response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "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) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified 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 list of security connectors response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified subscription. + * + * @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 security connectors response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified 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 list of security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security connectors for the specified subscription. + * + * @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 security connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 list of security connectors response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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 security connectors response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * 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 security connectors response 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 security connectors response 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/SecurityConnectorsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsImpl.java new file mode 100644 index 000000000000..a59ca5bf3590 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityConnectorsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityConnectorInner; +import com.azure.resourcemanager.security.models.SecurityConnector; +import com.azure.resourcemanager.security.models.SecurityConnectors; + +public final class SecurityConnectorsImpl implements SecurityConnectors { + private static final ClientLogger LOGGER = new ClientLogger(SecurityConnectorsImpl.class); + + private final SecurityConnectorsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecurityConnectorsImpl(SecurityConnectorsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityConnectorImpl(inner.getValue(), this.manager())); + } + + public SecurityConnector getByResourceGroup(String resourceGroupName, String securityConnectorName) { + SecurityConnectorInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, securityConnectorName); + if (inner != null) { + return new SecurityConnectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String securityConnectorName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, securityConnectorName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String securityConnectorName) { + this.serviceClient().delete(resourceGroupName, securityConnectorName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityConnectorImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityConnectorImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityConnectorImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityConnectorImpl(inner1, this.manager())); + } + + public SecurityConnector 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))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, 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))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, 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))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, securityConnectorName, Context.NONE); + } + + public Response 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))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, securityConnectorName, context); + } + + private SecurityConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public SecurityConnectorImpl define(String name) { + return new SecurityConnectorImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactImpl.java new file mode 100644 index 000000000000..18231e20e42e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityContactInner; +import com.azure.resourcemanager.security.models.NotificationsSource; +import com.azure.resourcemanager.security.models.SecurityContact; +import com.azure.resourcemanager.security.models.SecurityContactName; +import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole; +import java.util.Collections; +import java.util.List; + +public final class SecurityContactImpl implements SecurityContact, SecurityContact.Definition { + private SecurityContactInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecurityContactImpl(SecurityContactInner 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 String emails() { + return this.innerModel().emails(); + } + + public String phone() { + return this.innerModel().phone(); + } + + public Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public List notificationsSources() { + List inner = this.innerModel().notificationsSources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SecurityContactPropertiesNotificationsByRole notificationsByRole() { + return this.innerModel().notificationsByRole(); + } + + public SecurityContactInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private SecurityContactName securityContactName; + + public SecurityContact create() { + this.innerObject = serviceManager.serviceClient() + .getSecurityContacts() + .createWithResponse(securityContactName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityContact create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityContacts() + .createWithResponse(securityContactName, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityContactImpl(SecurityContactName name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new SecurityContactInner(); + this.serviceManager = serviceManager; + this.securityContactName = name; + } + + public SecurityContact refresh() { + this.innerObject = serviceManager.serviceClient() + .getSecurityContacts() + .getWithResponse(securityContactName, Context.NONE) + .getValue(); + return this; + } + + public SecurityContact refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityContacts() + .getWithResponse(securityContactName, context) + .getValue(); + return this; + } + + public SecurityContactImpl withEmails(String emails) { + this.innerModel().withEmails(emails); + return this; + } + + public SecurityContactImpl withPhone(String phone) { + this.innerModel().withPhone(phone); + return this; + } + + public SecurityContactImpl withIsEnabled(Boolean isEnabled) { + this.innerModel().withIsEnabled(isEnabled); + return this; + } + + public SecurityContactImpl withNotificationsSources(List notificationsSources) { + this.innerModel().withNotificationsSources(notificationsSources); + return this; + } + + public SecurityContactImpl + withNotificationsByRole(SecurityContactPropertiesNotificationsByRole notificationsByRole) { + this.innerModel().withNotificationsByRole(notificationsByRole); + return this; + } +} 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 new file mode 100644 index 000000000000..b79059a4a7a4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java @@ -0,0 +1,615 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityContactsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; +import com.azure.resourcemanager.security.implementation.models.SecurityContactList; +import com.azure.resourcemanager.security.models.SecurityContactName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecurityContactsClient. + */ +public final class SecurityContactsClientImpl implements SecurityContactsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecurityContactsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecurityContactsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityContactsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(SecurityContactsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecurityContacts to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecurityContacts") + public interface SecurityContactsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SecurityContactInner securityContact, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get Default Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 default Security contact configurations for the subscription along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(SecurityContactName securityContactName) { + 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 (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + securityContactName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get Default Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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 default Security contact configurations for the subscription along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(SecurityContactName securityContactName, + 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 (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), securityContactName, + accept, context); + } + + /** + * Get Default Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 default Security contact configurations for the subscription on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(SecurityContactName securityContactName) { + return getWithResponseAsync(securityContactName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get Default Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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 default Security contact configurations for the subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(SecurityContactName securityContactName, Context context) { + return getWithResponseAsync(securityContactName, context).block(); + } + + /** + * Get Default Security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 default Security contact configurations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityContactInner get(SecurityContactName securityContactName) { + return getWithResponse(securityContactName, Context.NONE).getValue(); + } + + /** + * Create security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 contact details and configurations for notifications coming from Microsoft Defender for Cloud along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(SecurityContactName securityContactName, + SecurityContactInner securityContact) { + 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 (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + if (securityContact == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContact is required and cannot be null.")); + } else { + securityContact.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), securityContactName, contentType, accept, securityContact, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @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 contact details and configurations for notifications coming from Microsoft Defender for Cloud along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(SecurityContactName securityContactName, + SecurityContactInner securityContact, 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 (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + if (securityContact == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContact is required and cannot be null.")); + } else { + securityContact.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + securityContactName, contentType, accept, securityContact, context); + } + + /** + * Create security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 contact details and configurations for notifications coming from Microsoft Defender for Cloud on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(SecurityContactName securityContactName, + SecurityContactInner securityContact) { + return createWithResponseAsync(securityContactName, securityContact) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @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 contact details and configurations for notifications coming from Microsoft Defender for Cloud along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(SecurityContactName securityContactName, + SecurityContactInner securityContact, Context context) { + return createWithResponseAsync(securityContactName, securityContact, context).block(); + } + + /** + * Create security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @param securityContact Security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 contact details and configurations for notifications coming from Microsoft Defender for Cloud. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityContactInner create(SecurityContactName securityContactName, SecurityContactInner securityContact) { + return createWithResponse(securityContactName, securityContact, Context.NONE).getValue(); + } + + /** + * Delete security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(SecurityContactName securityContactName) { + 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 (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), securityContactName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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(SecurityContactName securityContactName, 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 (securityContactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + securityContactName, context); + } + + /** + * Delete security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(SecurityContactName securityContactName) { + return deleteWithResponseAsync(securityContactName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @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(SecurityContactName securityContactName, Context context) { + return deleteWithResponseAsync(securityContactName, context).block(); + } + + /** + * Delete security contact configurations for the subscription. + * + * @param securityContactName Name of the security contact object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(SecurityContactName securityContactName) { + deleteWithResponse(securityContactName, Context.NONE); + } + + /** + * List all security contact configurations 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 list of security contacts response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2023-12-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * List all security contact configurations for the subscription. + * + * @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 security contacts response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2023-12-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List all security contact configurations 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 list of security contacts response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all security contact configurations for the subscription. + * + * @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 security contacts response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all security contact configurations 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 list of security contacts response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all security contact configurations for the subscription. + * + * @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 security contacts response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 list of security contacts response 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 security contacts response 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/SecurityContactsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsImpl.java new file mode 100644 index 000000000000..cc7d4e28e1df --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsImpl.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityContactsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityContactInner; +import com.azure.resourcemanager.security.models.SecurityContact; +import com.azure.resourcemanager.security.models.SecurityContactName; +import com.azure.resourcemanager.security.models.SecurityContacts; + +public final class SecurityContactsImpl implements SecurityContacts { + private static final ClientLogger LOGGER = new ClientLogger(SecurityContactsImpl.class); + + private final SecurityContactsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecurityContactsImpl(SecurityContactsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(SecurityContactName securityContactName, Context context) { + Response inner = this.serviceClient().getWithResponse(securityContactName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityContactImpl(inner.getValue(), this.manager())); + } + + public SecurityContact get(SecurityContactName securityContactName) { + SecurityContactInner inner = this.serviceClient().get(securityContactName); + if (inner != null) { + return new SecurityContactImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(SecurityContactName securityContactName, Context context) { + return this.serviceClient().deleteWithResponse(securityContactName, context); + } + + public void delete(SecurityContactName securityContactName) { + this.serviceClient().delete(securityContactName); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityContactImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityContactImpl(inner1, this.manager())); + } + + public SecurityContact getById(String id) { + String securityContactNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "securityContacts"); + if (securityContactNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + SecurityContactName securityContactName = SecurityContactName.fromString(securityContactNameLocal); + return this.getWithResponse(securityContactName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String securityContactNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "securityContacts"); + if (securityContactNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + SecurityContactName securityContactName = SecurityContactName.fromString(securityContactNameLocal); + return this.getWithResponse(securityContactName, context); + } + + public void deleteById(String id) { + String securityContactNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "securityContacts"); + if (securityContactNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + SecurityContactName securityContactName = SecurityContactName.fromString(securityContactNameLocal); + this.deleteWithResponse(securityContactName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String securityContactNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "securityContacts"); + if (securityContactNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityContacts'.", id))); + } + SecurityContactName securityContactName = SecurityContactName.fromString(securityContactNameLocal); + return this.deleteWithResponse(securityContactName, context); + } + + private SecurityContactsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public SecurityContactImpl define(SecurityContactName name) { + return new SecurityContactImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorImpl.java new file mode 100644 index 000000000000..3be550485d1c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner; +import com.azure.resourcemanager.security.models.Identity; +import com.azure.resourcemanager.security.models.SecurityOperator; + +public final class SecurityOperatorImpl implements SecurityOperator { + private SecurityOperatorInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecurityOperatorImpl(SecurityOperatorInner 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 Identity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SecurityOperatorInner 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/SecurityOperatorsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorsClientImpl.java new file mode 100644 index 000000000000..702695276468 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorsClientImpl.java @@ -0,0 +1,585 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +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.SecurityOperatorsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner; +import com.azure.resourcemanager.security.implementation.models.SecurityOperatorList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecurityOperatorsClient. + */ +public final class SecurityOperatorsClientImpl implements SecurityOperatorsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecurityOperatorsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecurityOperatorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityOperatorsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(SecurityOperatorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecurityOperators to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecurityOperators") + public interface SecurityOperatorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, + @PathParam("securityOperatorName") String securityOperatorName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, + @PathParam("securityOperatorName") String securityOperatorName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, + @PathParam("securityOperatorName") String securityOperatorName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 operator for the requested scope along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String pricingName, + String securityOperatorName) { + 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + pricingName, securityOperatorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator for the requested scope along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String pricingName, String securityOperatorName, + 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName, + securityOperatorName, accept, context); + } + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 operator for the requested scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String pricingName, String securityOperatorName) { + return getWithResponseAsync(pricingName, securityOperatorName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator for the requested scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String pricingName, String securityOperatorName, + Context context) { + return getWithResponseAsync(pricingName, securityOperatorName, context).block(); + } + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 operator for the requested scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityOperatorInner get(String pricingName, String securityOperatorName) { + return getWithResponse(pricingName, securityOperatorName, Context.NONE).getValue(); + } + + /** + * Creates Microsoft Defender for Cloud security operator on the given scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 operator under a given subscription and pricing along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String pricingName, + String securityOperatorName) { + 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), pricingName, securityOperatorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates Microsoft Defender for Cloud security operator on the given scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator under a given subscription and pricing along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String pricingName, + String securityOperatorName, 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + pricingName, securityOperatorName, accept, context); + } + + /** + * Creates Microsoft Defender for Cloud security operator on the given scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 operator under a given subscription and pricing on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String pricingName, String securityOperatorName) { + return createOrUpdateWithResponseAsync(pricingName, securityOperatorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates Microsoft Defender for Cloud security operator on the given scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 operator under a given subscription and pricing along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String pricingName, String securityOperatorName, + Context context) { + return createOrUpdateWithResponseAsync(pricingName, securityOperatorName, context).block(); + } + + /** + * Creates Microsoft Defender for Cloud security operator on the given scope. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 operator under a given subscription and pricing. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityOperatorInner createOrUpdate(String pricingName, String securityOperatorName) { + return createOrUpdateWithResponse(pricingName, securityOperatorName, Context.NONE).getValue(); + } + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 pricingName, String securityOperatorName) { + 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), pricingName, securityOperatorName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 pricingName, String securityOperatorName, + 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName, + securityOperatorName, context); + } + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 pricingName, String securityOperatorName) { + return deleteWithResponseAsync(pricingName, securityOperatorName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @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 pricingName, String securityOperatorName, Context context) { + return deleteWithResponseAsync(pricingName, securityOperatorName, context).block(); + } + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @param securityOperatorName Name of the security operator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 pricingName, String securityOperatorName) { + deleteWithResponse(pricingName, securityOperatorName, Context.NONE); + } + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 SecurityOperator response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String pricingName) { + 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + pricingName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @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 SecurityOperator response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String pricingName, 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 (pricingName == null) { + return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), null, null)); + } + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 SecurityOperator response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String pricingName) { + return new PagedFlux<>(() -> listSinglePageAsync(pricingName)); + } + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @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 SecurityOperator response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String pricingName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(pricingName, context)); + } + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 SecurityOperator response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String pricingName) { + return new PagedIterable<>(listAsync(pricingName)); + } + + /** + * Lists Microsoft Defender for Cloud securityOperators in the subscription. + * + * @param pricingName Name of the pricing configuration. + * @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 SecurityOperator response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String pricingName, Context context) { + return new PagedIterable<>(listAsync(pricingName, context)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorsImpl.java new file mode 100644 index 000000000000..049b5b0207c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorsImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SecurityOperatorsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner; +import com.azure.resourcemanager.security.models.SecurityOperator; +import com.azure.resourcemanager.security.models.SecurityOperators; + +public final class SecurityOperatorsImpl implements SecurityOperators { + private static final ClientLogger LOGGER = new ClientLogger(SecurityOperatorsImpl.class); + + private final SecurityOperatorsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecurityOperatorsImpl(SecurityOperatorsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String pricingName, String securityOperatorName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(pricingName, securityOperatorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityOperatorImpl(inner.getValue(), this.manager())); + } + + public SecurityOperator get(String pricingName, String securityOperatorName) { + SecurityOperatorInner inner = this.serviceClient().get(pricingName, securityOperatorName); + if (inner != null) { + return new SecurityOperatorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String pricingName, String securityOperatorName, + Context context) { + Response inner + = this.serviceClient().createOrUpdateWithResponse(pricingName, securityOperatorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityOperatorImpl(inner.getValue(), this.manager())); + } + + public SecurityOperator createOrUpdate(String pricingName, String securityOperatorName) { + SecurityOperatorInner inner = this.serviceClient().createOrUpdate(pricingName, securityOperatorName); + if (inner != null) { + return new SecurityOperatorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String pricingName, String securityOperatorName, + Context context) { + return this.serviceClient().deleteWithResponse(pricingName, securityOperatorName, context); + } + + public void deleteByResourceGroup(String pricingName, String securityOperatorName) { + this.serviceClient().delete(pricingName, securityOperatorName); + } + + public PagedIterable list(String pricingName) { + PagedIterable inner = this.serviceClient().list(pricingName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityOperatorImpl(inner1, this.manager())); + } + + public PagedIterable list(String pricingName, Context context) { + PagedIterable inner = this.serviceClient().list(pricingName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityOperatorImpl(inner1, this.manager())); + } + + private SecurityOperatorsClient 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/SecuritySolutionImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionImpl.java index a62297af1298..0a7979533a79 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; import com.azure.resourcemanager.security.models.ProvisioningState; import com.azure.resourcemanager.security.models.SecurityFamily; @@ -36,6 +37,10 @@ public String location() { return this.innerModel().location(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public SecurityFamily securityFamily() { return this.innerModel().securityFamily(); } 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 84189c7ddba7..2f40dd354f30 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.SecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; -import com.azure.resourcemanager.security.models.SecuritySolutionList; +import com.azure.resourcemanager.security.implementation.models.SecuritySolutionList; import reactor.core.publisher.Mono; /** @@ -59,149 +59,39 @@ public final class SecuritySolutionsClientImpl implements SecuritySolutionsClien * The interface defining all the services for SecurityCenterSecuritySolutions to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterSecuri") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecuritySolutions") public interface SecuritySolutionsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("securitySolutionName") String securitySolutionName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("securitySolutionName") String securitySolutionName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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); - } - - /** - * Gets a list of Security Solutions 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 Security Solutions for the subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - 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, - 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 Security Solutions for the subscription. - * - * @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 Security Solutions for the subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(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, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Gets a list of Security Solutions 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 Security Solutions for the subscription as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Gets a list of Security Solutions for the subscription. - * - * @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 Security Solutions for the subscription as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets a list of Security Solutions 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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); - } - - /** - * Gets a list of Security Solutions for the subscription. - * - * @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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** * Gets a specific Security Solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param securitySolutionName Name of security solution. @@ -235,16 +125,15 @@ private Mono> getWithResponseAsync(String resour final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, ascLocation, securitySolutionName, apiVersion, accept, context)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, securitySolutionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Gets a specific Security Solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param securitySolutionName Name of security solution. @@ -279,15 +168,14 @@ private Mono> getWithResponseAsync(String resour 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, ascLocation, - securitySolutionName, apiVersion, accept, context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + ascLocation, securitySolutionName, accept, context); } /** * Gets a specific Security Solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param securitySolutionName Name of security solution. @@ -306,8 +194,7 @@ private Mono getAsync(String resourceGroupName, String as /** * Gets a specific Security Solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param securitySolutionName Name of security solution. @@ -326,8 +213,7 @@ public Response getWithResponse(String resourceGroupName, /** * Gets a specific Security Solution. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param securitySolutionName Name of security solution. @@ -341,6 +227,115 @@ public SecuritySolutionInner get(String resourceGroupName, String ascLocation, S return getWithResponse(resourceGroupName, ascLocation, securitySolutionName, Context.NONE).getValue(); } + /** + * Gets a list of Security Solutions 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 Security Solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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(), apiVersion, this.client.getSubscriptionId(), + 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 Security Solutions for the subscription. + * + * @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 Security Solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of Security Solutions 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 Security Solutions for the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @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 Security Solutions for the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Security Solutions 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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of Security Solutions for the subscription. + * + * @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 Security Solutions for the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + /** * Get the next page of items. * @@ -348,7 +343,8 @@ public SecuritySolutionInner get(String resourceGroupName, String ascLocation, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of Security Solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -374,7 +370,8 @@ private Mono> listNextSinglePageAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list of Security Solutions for the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsImpl.java index d62f6a016422..394b424678f5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,26 +27,12 @@ public SecuritySolutionsImpl(SecuritySolutionsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySolutionImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySolutionImpl(inner1, this.manager())); - } - public Response getWithResponse(String resourceGroupName, String ascLocation, String securitySolutionName, Context context) { Response inner = this.serviceClient().getWithResponse(resourceGroupName, ascLocation, securitySolutionName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SecuritySolutionImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecuritySolutionImpl(inner.getValue(), this.manager())); } public SecuritySolution get(String resourceGroupName, String ascLocation, String securitySolutionName) { @@ -58,6 +44,16 @@ public SecuritySolution get(String resourceGroupName, String ascLocation, String } } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySolutionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySolutionImpl(inner1, this.manager())); + } + private SecuritySolutionsClient serviceClient() { return this.innerClient; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDataListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDataListImpl.java index ba50dde128ad..e565ba915823 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDataListImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDataListImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasClientImpl.java index 1ab60160231b..78ba8768ee90 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -54,24 +54,24 @@ public final class SecuritySolutionsReferenceDatasClientImpl implements Security * The interface defining all the services for SecurityCenterSecuritySolutionsReferenceDatas to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterSecuri") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecuritySolutionsReferenceDatas") public interface SecuritySolutionsReferenceDatasService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegion(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> listByHomeRegion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); } /** @@ -95,7 +95,7 @@ private Mono> listWithResponse final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -123,7 +123,7 @@ private Mono> listWithResponse 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, accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); } /** @@ -192,8 +192,8 @@ public SecuritySolutionsReferenceDataListInner list() { final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), - ascLocation, apiVersion, accept, context)) + .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -226,8 +226,8 @@ public SecuritySolutionsReferenceDataListInner list() { final String apiVersion = "2020-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, - apiVersion, accept, context); + return service.listByHomeRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + ascLocation, accept, context); } /** diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasImpl.java index 34d947eb2a2d..d968f41a4159 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsReferenceDatasImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -28,12 +28,8 @@ public SecuritySolutionsReferenceDatasImpl(SecuritySolutionsReferenceDatasClient public Response listWithResponse(Context context) { Response inner = this.serviceClient().listWithResponse(context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SecuritySolutionsReferenceDataListImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecuritySolutionsReferenceDataListImpl(inner.getValue(), this.manager())); } public SecuritySolutionsReferenceDataList list() { @@ -49,12 +45,8 @@ public Response listByHomeRegionWithResponse Context context) { Response inner = this.serviceClient().listByHomeRegionWithResponse(ascLocation, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SecuritySolutionsReferenceDataListImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecuritySolutionsReferenceDataListImpl(inner.getValue(), this.manager())); } public SecuritySolutionsReferenceDataList listByHomeRegion(String ascLocation) { 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 index 599dc2af3a29..5fb9b208ccc7 100644 --- 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 @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.SecurityStandardInner; import com.azure.resourcemanager.security.models.PartialAssessmentProperties; @@ -32,6 +33,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String displayName() { return this.innerModel().displayName(); } 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 index 64e8b6052f64..2ff4481ead35 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,7 +30,7 @@ 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 com.azure.resourcemanager.security.implementation.models.SecurityStandardList; import reactor.core.publisher.Mono; /** @@ -62,40 +62,40 @@ public final class SecurityStandardsClientImpl implements SecurityStandardsClien * The interface defining all the services for SecurityCenterSecurityStandards to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterSecuri") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSecurityStandards") 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, + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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); + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("standardId") String standardId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SecurityStandardInner standard, + Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "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, + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("standardId") String standardId, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/securityStandards") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -103,149 +103,13 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @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)); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -276,10 +140,7 @@ private Mono> getWithResponseAsync(String scope, /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -310,10 +171,7 @@ private Mono> getWithResponseAsync(String scope, /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -329,10 +187,7 @@ private Mono getAsync(String scope, String standardId) { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -348,10 +203,7 @@ public Response getWithResponse(String scope, String stan /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -366,10 +218,7 @@ public 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -396,20 +245,18 @@ private Mono> createOrUpdateWithResponseAsync(St standard.validate(); } final String apiVersion = "2024-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId, - standard, accept, context)) + contentType, accept, standard, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -437,19 +284,17 @@ private Mono> createOrUpdateWithResponseAsync(St standard.validate(); } final String apiVersion = "2024-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId, standard, accept, - context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId, contentType, accept, + standard, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -467,10 +312,7 @@ private Mono createOrUpdateAsync(String scope, String sta /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -488,10 +330,7 @@ public Response createOrUpdateWithResponse(String scope, /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -507,10 +346,7 @@ public SecurityStandardInner createOrUpdate(String scope, String standardId, Sec /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -530,20 +366,15 @@ private Mono> deleteWithResponseAsync(String scope, String standa 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)) + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, scope, standardId, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -564,18 +395,14 @@ private Mono> deleteWithResponseAsync(String scope, String standa 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); + return service.delete(this.client.getEndpoint(), apiVersion, scope, standardId, 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -590,10 +417,7 @@ private Mono deleteAsync(String scope, String standardId) { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -609,10 +433,7 @@ public Response deleteWithResponse(String scope, String standardId, Contex /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -623,6 +444,121 @@ public void delete(String scope, String standardId) { deleteWithResponse(scope, standardId, Context.NONE); } + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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 the next page of items. * @@ -630,7 +566,8 @@ public void delete(String scope, String standardId) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @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> listNextSinglePageAsync(String nextLink) { @@ -656,7 +593,8 @@ private Mono> listNextSinglePageAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @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> listNextSinglePageAsync(String nextLink, Context context) { 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 index b86bd0fb7901..e04090591001 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,24 +27,10 @@ public SecurityStandardsImpl(SecurityStandardsClient 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; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityStandardImpl(inner.getValue(), this.manager())); } public SecurityStandard get(String scope, String standardId) { @@ -64,6 +50,16 @@ public void deleteByResourceGroup(String scope, String standardId) { this.serviceClient().delete(scope, standardId); } + 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 SecurityStandard getById(String id) { String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "scope"); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySubAssessmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySubAssessmentImpl.java new file mode 100644 index 000000000000..145fa6a00237 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySubAssessmentImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import com.azure.resourcemanager.security.models.AdditionalData; +import com.azure.resourcemanager.security.models.ResourceDetails; +import com.azure.resourcemanager.security.models.SecuritySubAssessment; +import com.azure.resourcemanager.security.models.SubAssessmentStatus; +import java.time.OffsetDateTime; + +public final class SecuritySubAssessmentImpl implements SecuritySubAssessment { + private SecuritySubAssessmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecuritySubAssessmentImpl(SecuritySubAssessmentInner 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 String idPropertiesId() { + return this.innerModel().idPropertiesId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public SubAssessmentStatus status() { + return this.innerModel().status(); + } + + public String remediation() { + return this.innerModel().remediation(); + } + + public String impact() { + return this.innerModel().impact(); + } + + public String category() { + return this.innerModel().category(); + } + + public String description() { + return this.innerModel().description(); + } + + public OffsetDateTime timeGenerated() { + return this.innerModel().timeGenerated(); + } + + public ResourceDetails resourceDetails() { + return this.innerModel().resourceDetails(); + } + + public AdditionalData additionalData() { + return this.innerModel().additionalData(); + } + + public SecuritySubAssessmentInner 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/SecurityTaskImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityTaskImpl.java new file mode 100644 index 000000000000..52cd09b80130 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityTaskImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.azure.resourcemanager.security.models.SecurityTask; +import com.azure.resourcemanager.security.models.SecurityTaskParameters; +import java.time.OffsetDateTime; + +public final class SecurityTaskImpl implements SecurityTask { + private SecurityTaskInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecurityTaskImpl(SecurityTaskInner 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 String state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationTimeUtc() { + return this.innerModel().creationTimeUtc(); + } + + public SecurityTaskParameters securityTaskParameters() { + return this.innerModel().securityTaskParameters(); + } + + public OffsetDateTime lastStateChangeTimeUtc() { + return this.innerModel().lastStateChangeTimeUtc(); + } + + public String subState() { + return this.innerModel().subState(); + } + + public SecurityTaskInner 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/SensitivitySettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SensitivitySettingsClientImpl.java new file mode 100644 index 000000000000..22d9acf38a50 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SensitivitySettingsClientImpl.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.SensitivitySettingsClient; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsListResponseInner; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner; +import com.azure.resourcemanager.security.models.UpdateSensitivitySettingsRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SensitivitySettingsClient. + */ +public final class SensitivitySettingsClientImpl implements SensitivitySettingsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SensitivitySettingsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SensitivitySettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SensitivitySettingsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SensitivitySettingsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSensitivitySettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSensitivitySettings") + public interface SensitivitySettingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/sensitivitySettings/current") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Put("/providers/Microsoft.Security/sensitivitySettings/current") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") UpdateSensitivitySettingsRequest sensitivitySettings, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/sensitivitySettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets data sensitivity settings for sensitive data discovery. + * + * @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2023-02-15-preview"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets data sensitivity settings for sensitive data discovery. + * + * @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2023-02-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, accept, context); + } + + /** + * Gets data sensitivity settings for sensitive data discovery. + * + * @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 data sensitivity settings for sensitive data discovery on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync() { + return getWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets data sensitivity settings for sensitive data discovery. + * + * @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 data sensitivity settings for sensitive data discovery along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(Context context) { + return getWithResponseAsync(context).block(); + } + + /** + * Gets data sensitivity settings for sensitive data discovery. + * + * @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 data sensitivity settings for sensitive data discovery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetSensitivitySettingsResponseInner get() { + return getWithResponse(Context.NONE).getValue(); + } + + /** + * Create or update data sensitivity settings for sensitive data discovery. + * + * @param sensitivitySettings The data sensitivity settings to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + createOrUpdateWithResponseAsync(UpdateSensitivitySettingsRequest sensitivitySettings) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (sensitivitySettings == null) { + return Mono + .error(new IllegalArgumentException("Parameter sensitivitySettings is required and cannot be null.")); + } else { + sensitivitySettings.validate(); + } + final String apiVersion = "2023-02-15-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, contentType, accept, + sensitivitySettings, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update data sensitivity settings for sensitive data discovery. + * + * @param sensitivitySettings The data sensitivity settings to update. + * @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 data sensitivity settings for sensitive data discovery along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + createOrUpdateWithResponseAsync(UpdateSensitivitySettingsRequest sensitivitySettings, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (sensitivitySettings == null) { + return Mono + .error(new IllegalArgumentException("Parameter sensitivitySettings is required and cannot be null.")); + } else { + sensitivitySettings.validate(); + } + final String apiVersion = "2023-02-15-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, contentType, accept, sensitivitySettings, + context); + } + + /** + * Create or update data sensitivity settings for sensitive data discovery. + * + * @param sensitivitySettings The data sensitivity settings to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 data sensitivity settings for sensitive data discovery on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + createOrUpdateAsync(UpdateSensitivitySettingsRequest sensitivitySettings) { + return createOrUpdateWithResponseAsync(sensitivitySettings).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update data sensitivity settings for sensitive data discovery. + * + * @param sensitivitySettings The data sensitivity settings to update. + * @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 data sensitivity settings for sensitive data discovery along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + createOrUpdateWithResponse(UpdateSensitivitySettingsRequest sensitivitySettings, Context context) { + return createOrUpdateWithResponseAsync(sensitivitySettings, context).block(); + } + + /** + * Create or update data sensitivity settings for sensitive data discovery. + * + * @param sensitivitySettings The data sensitivity settings to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 data sensitivity settings for sensitive data discovery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetSensitivitySettingsResponseInner createOrUpdate(UpdateSensitivitySettingsRequest sensitivitySettings) { + return createOrUpdateWithResponse(sensitivitySettings, Context.NONE).getValue(); + } + + /** + * Gets a list with a single sensitivity settings resource. + * + * @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 with a single sensitivity settings resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2023-02-15-preview"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list with a single sensitivity settings 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 with a single sensitivity settings resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2023-02-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, accept, context); + } + + /** + * Gets a list with a single sensitivity settings resource. + * + * @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 with a single sensitivity settings resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list with a single sensitivity settings 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 with a single sensitivity settings resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Gets a list with a single sensitivity settings resource. + * + * @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 with a single sensitivity settings resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetSensitivitySettingsListResponseInner list() { + return listWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SensitivitySettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SensitivitySettingsImpl.java new file mode 100644 index 000000000000..36010d6973b4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SensitivitySettingsImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SensitivitySettingsClient; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsListResponseInner; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner; +import com.azure.resourcemanager.security.models.GetSensitivitySettingsListResponse; +import com.azure.resourcemanager.security.models.GetSensitivitySettingsResponse; +import com.azure.resourcemanager.security.models.SensitivitySettings; +import com.azure.resourcemanager.security.models.UpdateSensitivitySettingsRequest; + +public final class SensitivitySettingsImpl implements SensitivitySettings { + private static final ClientLogger LOGGER = new ClientLogger(SensitivitySettingsImpl.class); + + private final SensitivitySettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SensitivitySettingsImpl(SensitivitySettingsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(Context context) { + Response inner = this.serviceClient().getWithResponse(context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetSensitivitySettingsResponseImpl(inner.getValue(), this.manager())); + } + + public GetSensitivitySettingsResponse get() { + GetSensitivitySettingsResponseInner inner = this.serviceClient().get(); + if (inner != null) { + return new GetSensitivitySettingsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response + createOrUpdateWithResponse(UpdateSensitivitySettingsRequest sensitivitySettings, Context context) { + Response inner + = this.serviceClient().createOrUpdateWithResponse(sensitivitySettings, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetSensitivitySettingsResponseImpl(inner.getValue(), this.manager())); + } + + public GetSensitivitySettingsResponse createOrUpdate(UpdateSensitivitySettingsRequest sensitivitySettings) { + GetSensitivitySettingsResponseInner inner = this.serviceClient().createOrUpdate(sensitivitySettings); + if (inner != null) { + return new GetSensitivitySettingsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetSensitivitySettingsListResponseImpl(inner.getValue(), this.manager())); + } + + public GetSensitivitySettingsListResponse list() { + GetSensitivitySettingsListResponseInner inner = this.serviceClient().list(); + if (inner != null) { + return new GetSensitivitySettingsListResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private SensitivitySettingsClient 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/ServerVulnerabilityAssessmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentImpl.java index f3a42ff3a40a..46974c2d9456 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentInner; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessment; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentPropertiesProvisioningState; @@ -31,6 +32,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public ServerVulnerabilityAssessmentPropertiesProvisioningState provisioningState() { return this.innerModel().provisioningState(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java index e27cdff5f0ec..6ec6b7086f8e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -62,223 +62,63 @@ public final class ServerVulnerabilityAssessmentsClientImpl implements ServerVul * The interface defining all the services for SecurityCenterServerVulnerabilityAssessments to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterServer") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterServerVulnerabilityAssessments") public interface ServerVulnerabilityAssessmentsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments") - @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/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, @PathParam("resourceName") String resourceName, @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, @PathParam("resourceName") String resourceName, @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, @PathParam("resourceName") String resourceName, - @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - } - - /** - * Gets a list of server vulnerability assessment onboarding statuses on a given 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 server vulnerability assessment onboarding statuses on a given resource along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByExtendedResourceWithResponseAsync( - 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets a list of server vulnerability assessment onboarding statuses on a given 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 server vulnerability assessment onboarding statuses on a given resource along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByExtendedResourceWithResponseAsync( - 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); - } - - /** - * Gets a list of server vulnerability assessment onboarding statuses on a given 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 server vulnerability assessment onboarding statuses on a given resource on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listByExtendedResourceAsync(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName) { - return listByExtendedResourceWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets a list of server vulnerability assessment onboarding statuses on a given 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 server vulnerability assessment onboarding statuses on a given resource along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listByExtendedResourceWithResponse( - String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { - return listByExtendedResourceWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - context).block(); - } + @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, Context context); - /** - * Gets a list of server vulnerability assessment onboarding statuses on a given 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 server vulnerability assessment onboarding statuses on a given resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ServerVulnerabilityAssessmentsListInner listByExtendedResource(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName) { - return listByExtendedResourceWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, - Context.NONE).getValue(); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByExtendedResource( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, @HeaderParam("Accept") String accept, Context context); } /** * Gets a server vulnerability assessment onboarding statuses on a given 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -310,24 +150,23 @@ private Mono> getWithResponseAsync( if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } - final String serverVulnerabilityAssessment = "default"; final String apiVersion = "2020-01-01"; + final String serverVulnerabilityAssessment = "default"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, - apiVersion, accept, context)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, accept, + context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Gets a server vulnerability assessment onboarding statuses on a given 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -360,22 +199,21 @@ private Mono> getWithResponseAsync( if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } - final String serverVulnerabilityAssessment = "default"; final String apiVersion = "2020-01-01"; + final String serverVulnerabilityAssessment = "default"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, accept, context); } /** * Gets a server vulnerability assessment onboarding statuses on a given 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -392,11 +230,10 @@ private Mono getAsync(String resourceGroupNa /** * Gets a server vulnerability assessment onboarding statuses on a given 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -412,11 +249,10 @@ public Response getWithResponse(String resou /** * Gets a server vulnerability assessment onboarding statuses on a given 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -433,11 +269,10 @@ public ServerVulnerabilityAssessmentInner get(String resourceGroupName, String r * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. * - * @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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -469,13 +304,13 @@ private Mono> createOrUpdateWithRes if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } - final String serverVulnerabilityAssessment = "default"; final String apiVersion = "2020-01-01"; + final String serverVulnerabilityAssessment = "default"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, - apiVersion, accept, context)) + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, + serverVulnerabilityAssessment, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -483,11 +318,10 @@ private Mono> createOrUpdateWithRes * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. * - * @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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -520,23 +354,23 @@ private Mono> createOrUpdateWithRes if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } - final String serverVulnerabilityAssessment = "default"; final String apiVersion = "2020-01-01"; + final String serverVulnerabilityAssessment = "default"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, accept, + context); } /** * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. * - * @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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -554,11 +388,10 @@ private Mono createOrUpdateAsync(String reso * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. * - * @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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -576,11 +409,10 @@ public Response createOrUpdateWithResponse(S * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. * - * @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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -596,11 +428,10 @@ public ServerVulnerabilityAssessmentInner createOrUpdate(String resourceGroupNam /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -631,24 +462,22 @@ private Mono>> deleteWithResponseAsync(String resource if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } - final String serverVulnerabilityAssessment = "default"; final String apiVersion = "2020-01-01"; - final String accept = "application/json"; + final String serverVulnerabilityAssessment = "default"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, - apiVersion, accept, context)) + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, + serverVulnerabilityAssessment, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -680,22 +509,20 @@ private Mono>> deleteWithResponseAsync(String resource if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } - final String serverVulnerabilityAssessment = "default"; final String apiVersion = "2020-01-01"; - final String accept = "application/json"; + final String serverVulnerabilityAssessment = "default"; context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, context); } /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -713,11 +540,10 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -737,11 +563,10 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -756,11 +581,10 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -777,11 +601,10 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -797,11 +620,10 @@ private Mono deleteAsync(String resourceGroupName, String resourceNamespac /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -818,11 +640,10 @@ private Mono deleteAsync(String resourceGroupName, String resourceNamespac /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -835,11 +656,10 @@ public void delete(String resourceGroupName, String resourceNamespace, String re /** * Removing server vulnerability assessment from a 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. * @param resourceType The type of the resource. - * @param resourceName Name of the resource. + * @param resourceName The 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. @@ -850,4 +670,157 @@ public void delete(String resourceGroupName, String resourceNamespace, String re Context context) { deleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context).block(); } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. + * @param resourceType The type of the resource. + * @param resourceName The 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 server vulnerability assessment onboarding statuses on a given resource along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceWithResponseAsync( + 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(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. + * @param resourceType The type of the resource. + * @param resourceName The 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 server vulnerability assessment onboarding statuses on a given resource along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceWithResponseAsync( + 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(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, resourceNamespace, resourceType, resourceName, accept, context); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. + * @param resourceType The type of the resource. + * @param resourceName The 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 server vulnerability assessment onboarding statuses on a given resource on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByExtendedResourceAsync(String resourceGroupName, + String resourceNamespace, String resourceType, String resourceName) { + return listByExtendedResourceWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. + * @param resourceType The type of the resource. + * @param resourceName The 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 server vulnerability assessment onboarding statuses on a given resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByExtendedResourceWithResponse( + String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { + return listByExtendedResourceWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, + context).block(); + } + + /** + * Gets a list of server vulnerability assessment onboarding statuses on a given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The parent resource provider namespace. + * @param resourceType The type of the resource. + * @param resourceName The 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 server vulnerability assessment onboarding statuses on a given resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentsListInner listByExtendedResource(String resourceGroupName, + String resourceNamespace, String resourceType, String resourceName) { + return listByExtendedResourceWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, + Context.NONE).getValue(); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsImpl.java index 778c09f3a929..594c46c0b6e1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -28,40 +28,12 @@ public ServerVulnerabilityAssessmentsImpl(ServerVulnerabilityAssessmentsClient i this.serviceManager = serviceManager; } - public Response listByExtendedResourceWithResponse(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, Context context) { - Response inner = this.serviceClient() - .listByExtendedResourceWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, - context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ServerVulnerabilityAssessmentsListImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ServerVulnerabilityAssessmentsList listByExtendedResource(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName) { - ServerVulnerabilityAssessmentsListInner inner = this.serviceClient() - .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName); - if (inner != null) { - return new ServerVulnerabilityAssessmentsListImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getWithResponse(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { Response inner = this.serviceClient() .getWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); } public ServerVulnerabilityAssessment get(String resourceGroupName, String resourceNamespace, String resourceType, @@ -79,12 +51,8 @@ public Response createOrUpdateWithResponse(String String resourceNamespace, String resourceType, String resourceName, Context context) { Response inner = this.serviceClient() .createOrUpdateWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); } public ServerVulnerabilityAssessment createOrUpdate(String resourceGroupName, String resourceNamespace, @@ -107,6 +75,26 @@ public void delete(String resourceGroupName, String resourceNamespace, String re this.serviceClient().delete(resourceGroupName, resourceNamespace, resourceType, resourceName, context); } + public Response listByExtendedResourceWithResponse(String resourceGroupName, + String resourceNamespace, String resourceType, String resourceName, Context context) { + Response inner = this.serviceClient() + .listByExtendedResourceWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ServerVulnerabilityAssessmentsListImpl(inner.getValue(), this.manager())); + } + + public ServerVulnerabilityAssessmentsList listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName) { + ServerVulnerabilityAssessmentsListInner inner = this.serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName); + if (inner != null) { + return new ServerVulnerabilityAssessmentsListImpl(inner, this.manager()); + } else { + return null; + } + } + private ServerVulnerabilityAssessmentsClient serviceClient() { return this.innerClient; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsListImpl.java index c377ae4d1544..47e53614668f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsListImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsListImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingImpl.java index 3314afa36aa7..ed7b886876d0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -8,6 +8,7 @@ import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsSettingInner; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSetting; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKind; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingProperties; public final class ServerVulnerabilityAssessmentsSettingImpl implements ServerVulnerabilityAssessmentsSetting { private ServerVulnerabilityAssessmentsSettingInner innerObject; @@ -36,6 +37,10 @@ public ServerVulnerabilityAssessmentsSettingKind kind() { return this.innerModel().kind(); } + public ServerVulnerabilityAssessmentsSettingProperties properties() { + return this.innerModel().properties(); + } + public SystemData systemData() { return this.innerModel().systemData(); } 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 cbedeb40b1f5..68e07d1c178b 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,8 +30,8 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsSettingsClient; import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsSettingInner; +import com.azure.resourcemanager.security.implementation.models.ServerVulnerabilityAssessmentsSettingsList; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingsList; import reactor.core.publisher.Mono; /** @@ -65,43 +65,43 @@ public final class ServerVulnerabilityAssessmentsSettingsClientImpl * The interface defining all the services for SecurityCenterServerVulnerabilityAssessmentsSettings to be used by * the proxy service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterServer") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterServerVulnerabilityAssessmentsSettings") public interface ServerVulnerabilityAssessmentsSettingsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("settingKind") ServerVulnerabilityAssessmentsSettingKindName settingKind, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + Mono> createOrUpdate( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("settingKind") ServerVulnerabilityAssessmentsSettingKindName settingKind, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, @BodyParam("application/json") ServerVulnerabilityAssessmentsSettingInner serverVulnerabilityAssessmentsSetting, - @HeaderParam("Accept") String accept, Context context); + Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("settingKind") ServerVulnerabilityAssessmentsSettingKindName settingKind, + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingKind") ServerVulnerabilityAssessmentsSettingKindName settingKind, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -109,125 +109,10 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } - /** - * Get a list of all the server vulnerability assessments settings over a subscription level scope. - * - * @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 the server vulnerability assessments settings over a subscription level scope along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - 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 = "2023-05-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - 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 the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(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 = "2023-05-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Get a list of all the server vulnerability assessments settings over a subscription level scope. - * - * @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 the server vulnerability assessments settings over a subscription level scope as paginated - * response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); - } - - /** - * Get a list of all the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope as paginated - * response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); - } - - /** - * Get a list of all the server vulnerability assessments settings over a subscription level scope. - * - * @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 the server vulnerability assessments settings over a subscription level scope as paginated - * response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); - } - - /** - * Get a list of all the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope as paginated - * response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); - } - /** * Get a server vulnerability assessments setting of the requested kind, that is set on the subscription. * @@ -372,10 +257,12 @@ private Mono> createOrUpdat serverVulnerabilityAssessmentsSetting.validate(); } final String apiVersion = "2023-05-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), settingKind, serverVulnerabilityAssessmentsSetting, accept, context)) + this.client.getSubscriptionId(), settingKind, contentType, accept, + serverVulnerabilityAssessmentsSetting, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -413,10 +300,11 @@ private Mono> createOrUpdat serverVulnerabilityAssessmentsSetting.validate(); } final String apiVersion = "2023-05-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - settingKind, serverVulnerabilityAssessmentsSetting, accept, context); + settingKind, contentType, accept, serverVulnerabilityAssessmentsSetting, context); } /** @@ -496,10 +384,9 @@ private Mono> deleteWithResponseAsync(ServerVulnerabilityAssessme return Mono.error(new IllegalArgumentException("Parameter settingKind is required and cannot be null.")); } final String apiVersion = "2023-05-01"; - final String accept = "application/json"; return FluxUtil .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), settingKind, accept, context)) + this.client.getSubscriptionId(), settingKind, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -528,10 +415,9 @@ private Mono> deleteWithResponseAsync(ServerVulnerabilityAssessme return Mono.error(new IllegalArgumentException("Parameter settingKind is required and cannot be null.")); } final String apiVersion = "2023-05-01"; - final String accept = "application/json"; context = this.client.mergeContext(context); return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingKind, - accept, context); + context); } /** @@ -577,6 +463,121 @@ public void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind) { deleteWithResponse(settingKind, Context.NONE); } + /** + * Get a list of all the server vulnerability assessments settings over a subscription level scope. + * + * @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 the server vulnerability assessments settings over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2023-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2023-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get a list of all the server vulnerability assessments settings over a subscription level scope. + * + * @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 the server vulnerability assessments settings over a subscription level scope as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all the server vulnerability assessments settings over a subscription level scope. + * + * @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 the server vulnerability assessments settings over a subscription level scope as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all the server vulnerability assessments settings over a subscription level 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 a list of all the server vulnerability assessments settings over a subscription level scope as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + /** * Get the next page of items. * @@ -584,8 +585,8 @@ public void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 page of a server vulnerability assessments settings list along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a list of all the server vulnerability assessments settings over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> @@ -615,8 +616,8 @@ public void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 page of a server vulnerability assessments settings list along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a list of all the server vulnerability assessments settings over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsImpl.java index 674bdfe3be35..61271faf8c07 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -28,28 +28,12 @@ public ServerVulnerabilityAssessmentsSettingsImpl(ServerVulnerabilityAssessments this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new ServerVulnerabilityAssessmentsSettingImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, - inner1 -> new ServerVulnerabilityAssessmentsSettingImpl(inner1, this.manager())); - } - public Response getWithResponse(ServerVulnerabilityAssessmentsSettingKindName settingKind, Context context) { Response inner = this.serviceClient().getWithResponse(settingKind, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ServerVulnerabilityAssessmentsSettingImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ServerVulnerabilityAssessmentsSettingImpl(inner.getValue(), this.manager())); } public ServerVulnerabilityAssessmentsSetting get(ServerVulnerabilityAssessmentsSettingKindName settingKind) { @@ -66,12 +50,8 @@ public Response createOrUpdateWithRespons ServerVulnerabilityAssessmentsSettingInner serverVulnerabilityAssessmentsSetting, Context context) { Response inner = this.serviceClient() .createOrUpdateWithResponse(settingKind, serverVulnerabilityAssessmentsSetting, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ServerVulnerabilityAssessmentsSettingImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ServerVulnerabilityAssessmentsSettingImpl(inner.getValue(), this.manager())); } public ServerVulnerabilityAssessmentsSetting createOrUpdate( @@ -95,6 +75,18 @@ public void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind) { this.serviceClient().delete(settingKind); } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ServerVulnerabilityAssessmentsSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ServerVulnerabilityAssessmentsSettingImpl(inner1, this.manager())); + } + private ServerVulnerabilityAssessmentsSettingsClient serviceClient() { return this.innerClient; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingImpl.java index 112bd4997904..0a3e814cb301 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingImpl.java @@ -1,12 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.SettingInner; import com.azure.resourcemanager.security.models.Setting; import com.azure.resourcemanager.security.models.SettingKind; +import com.azure.resourcemanager.security.models.SettingProperties; public final class SettingImpl implements Setting { private SettingInner innerObject; @@ -34,6 +36,14 @@ public SettingKind kind() { return this.innerModel().kind(); } + public SettingProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + public SettingInner innerModel() { return this.innerObject; } 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 c2b395c38c0e..2d7aaadd2b0b 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -29,8 +29,8 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.SettingsClient; import com.azure.resourcemanager.security.fluent.models.SettingInner; +import com.azure.resourcemanager.security.implementation.models.SettingsList; import com.azure.resourcemanager.security.models.SettingName; -import com.azure.resourcemanager.security.models.SettingsList; import reactor.core.publisher.Mono; /** @@ -61,32 +61,31 @@ public final class SettingsClientImpl implements SettingsClient { * The interface defining all the services for SecurityCenterSettings to be used by the proxy service to perform * REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterSettin") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSettings") public interface SettingsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> get(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); + @PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> update(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context); + @PathParam("settingName") SettingName settingName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SettingInner setting, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("settingName") SettingName settingName, @BodyParam("application/json") SettingInner setting, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -94,114 +93,7 @@ Mono> update(@HostParam("$host") String endpoint, @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - 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 = "2022-05-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - 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())); - } - - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(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 = "2022-05-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); - } - - /** - * Settings about different configurations in Microsoft Defender for Cloud. - * - * @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 subscription settings list as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -336,10 +228,11 @@ private Mono> updateWithResponseAsync(SettingName setting setting.validate(); } final String apiVersion = "2022-05-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), settingName, setting, accept, context)) + this.client.getSubscriptionId(), settingName, contentType, accept, setting, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -374,10 +267,11 @@ private Mono> updateWithResponseAsync(SettingName setting setting.validate(); } final String apiVersion = "2022-05-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, - setting, accept, context); + contentType, accept, setting, context); } /** @@ -426,6 +320,113 @@ public SettingInner update(SettingName settingName, SettingInner setting) { return updateWithResponse(settingName, setting, Context.NONE).getValue(); } + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2022-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2022-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Settings about different configurations in Microsoft Defender for Cloud. + * + * @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 subscription settings list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + /** * Get the next page of items. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsImpl.java index 720d3730dd63..d68c96951952 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,24 +27,10 @@ public SettingsImpl(SettingsClient innerClient, com.azure.resourcemanager.securi this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SettingImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SettingImpl(inner1, this.manager())); - } - public Response getWithResponse(SettingName settingName, Context context) { Response inner = this.serviceClient().getWithResponse(settingName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SettingImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SettingImpl(inner.getValue(), this.manager())); } public Setting get(SettingName settingName) { @@ -58,12 +44,8 @@ public Setting get(SettingName settingName) { public Response updateWithResponse(SettingName settingName, SettingInner setting, Context context) { Response inner = this.serviceClient().updateWithResponse(settingName, setting, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SettingImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SettingImpl(inner.getValue(), this.manager())); } public Setting update(SettingName settingName, SettingInner setting) { @@ -75,6 +57,16 @@ public Setting update(SettingName settingName, SettingInner setting) { } } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SettingImpl(inner1, this.manager())); + } + private SettingsClient serviceClient() { return this.innerClient; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java new file mode 100644 index 000000000000..9f4b7b8c9402 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java @@ -0,0 +1,835 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.Post; +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.SqlVulnerabilityAssessmentBaselineRulesClient; +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResultsInput; +import com.azure.resourcemanager.security.models.RulesResultsInput; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentBaselineRulesClient. + */ +public final class SqlVulnerabilityAssessmentBaselineRulesClientImpl + implements SqlVulnerabilityAssessmentBaselineRulesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlVulnerabilityAssessmentBaselineRulesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentBaselineRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentBaselineRulesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SqlVulnerabilityAssessmentBaselineRulesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSqlVulnerabilityAssessmentBaselineRules to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSqlVulnerabilityAssessmentBaselineRules") + public interface SqlVulnerabilityAssessmentBaselineRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("ruleId") String ruleId, + @QueryParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("ruleId") String ruleId, + @QueryParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RuleResultsInput body, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("ruleId") String ruleId, + @QueryParam("databaseName") String databaseName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> add(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RulesResultsInput body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 results for a given rule in the Baseline along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, String ruleId, + String databaseName) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, ruleId, databaseName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 results for a given rule in the Baseline along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, String ruleId, String databaseName, + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, ruleId, databaseName, accept, context); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 results for a given rule in the Baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String ruleId) { + final String databaseName = null; + return getWithResponseAsync(resourceId, ruleId, databaseName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 results for a given rule in the Baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, String ruleId, String databaseName, + Context context) { + return getWithResponseAsync(resourceId, ruleId, databaseName, context).block(); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RuleResultsInner get(String resourceId, String ruleId) { + final String databaseName = null; + return getWithResponse(resourceId, ruleId, databaseName, Context.NONE).getValue(); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The baseline results for this rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 rule results along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceId, String ruleId, + String databaseName, RuleResultsInput body) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, ruleId, + databaseName, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The baseline results for this rule. + * @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 rule results along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceId, String ruleId, + String databaseName, RuleResultsInput body, 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, ruleId, databaseName, accept, + body, context); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 rule results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceId, String ruleId) { + final String databaseName = null; + final RuleResultsInput body = null; + return createOrUpdateWithResponseAsync(resourceId, ruleId, databaseName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The baseline results for this rule. + * @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 rule results along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceId, String ruleId, String databaseName, + RuleResultsInput body, Context context) { + return createOrUpdateWithResponseAsync(resourceId, ruleId, databaseName, body, context).block(); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RuleResultsInner createOrUpdate(String resourceId, String ruleId) { + final String databaseName = null; + final RuleResultsInput body = null; + return createOrUpdateWithResponse(resourceId, ruleId, databaseName, body, Context.NONE).getValue(); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 ruleId, String databaseName) { + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), apiVersion, resourceId, ruleId, databaseName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 ruleId, String databaseName, + 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 (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, resourceId, ruleId, databaseName, context); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 resourceId, String ruleId) { + final String databaseName = null; + return deleteWithResponseAsync(resourceId, ruleId, databaseName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule Id. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 ruleId, String databaseName, Context context) { + return deleteWithResponseAsync(resourceId, ruleId, databaseName, context).block(); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param ruleId The rule 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 resourceId, String ruleId) { + final String databaseName = null; + deleteWithResponse(resourceId, ruleId, databaseName, Context.NONE); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 results for all rules in the Baseline along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId, String databaseName) { + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, databaseName, 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 the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 results for all rules in the Baseline along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId, String databaseName, + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, resourceId, databaseName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 results for all rules in the Baseline as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, String databaseName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, databaseName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the results for all rules in the Baseline as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId) { + final String databaseName = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, databaseName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 results for all rules in the Baseline as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, String databaseName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, databaseName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the results for all rules in the Baseline as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId) { + final String databaseName = null; + return new PagedIterable<>(listAsync(resourceId, databaseName)); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 results for all rules in the Baseline as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId, String databaseName, Context context) { + return new PagedIterable<>(listAsync(resourceId, databaseName, context)); + } + + /** + * Set a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 rules results along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addWithResponseAsync(String resourceId, String databaseName, + RulesResultsInput body) { + 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 (body != null) { + body.validate(); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.add(this.client.getEndpoint(), apiVersion, resourceId, databaseName, accept, + body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Set a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The content of the action request. + * @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 rules results along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addWithResponseAsync(String resourceId, String databaseName, + RulesResultsInput body, 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 (body != null) { + body.validate(); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.add(this.client.getEndpoint(), apiVersion, resourceId, databaseName, accept, body, context); + } + + /** + * Set a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 rules results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addAsync(String resourceId) { + final String databaseName = null; + final RulesResultsInput body = null; + return addWithResponseAsync(resourceId, databaseName, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Set a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @param body The content of the action request. + * @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 rules results along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addWithResponse(String resourceId, String databaseName, RulesResultsInput body, + Context context) { + return addWithResponseAsync(resourceId, databaseName, body, context).block(); + } + + /** + * Set a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RulesResultsInner add(String resourceId) { + final String databaseName = null; + final RulesResultsInput body = null; + return addWithResponse(resourceId, databaseName, body, Context.NONE).getValue(); + } + + /** + * Gets the results for all rules in the Baseline. + * + * 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 the results for all rules in the Baseline 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())); + } + + /** + * Gets the results for all rules in the Baseline. + * + * 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 the results for all rules in the Baseline 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/SqlVulnerabilityAssessmentBaselineRulesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesImpl.java new file mode 100644 index 000000000000..e34bb9aa43a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentBaselineRulesClient; +import com.azure.resourcemanager.security.fluent.models.RuleResultsInner; +import com.azure.resourcemanager.security.fluent.models.RulesResultsInner; +import com.azure.resourcemanager.security.models.RuleResults; +import com.azure.resourcemanager.security.models.RulesResults; +import com.azure.resourcemanager.security.models.RulesResultsInput; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentBaselineRules; + +public final class SqlVulnerabilityAssessmentBaselineRulesImpl implements SqlVulnerabilityAssessmentBaselineRules { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentBaselineRulesImpl.class); + + private final SqlVulnerabilityAssessmentBaselineRulesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SqlVulnerabilityAssessmentBaselineRulesImpl(SqlVulnerabilityAssessmentBaselineRulesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceId, String ruleId, String databaseName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceId, ruleId, databaseName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RuleResultsImpl(inner.getValue(), this.manager())); + } + + public RuleResults get(String resourceId, String ruleId) { + RuleResultsInner inner = this.serviceClient().get(resourceId, ruleId); + if (inner != null) { + return new RuleResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceId, String ruleId, String databaseName, Context context) { + return this.serviceClient().deleteWithResponse(resourceId, ruleId, databaseName, context); + } + + public void delete(String resourceId, String ruleId) { + this.serviceClient().delete(resourceId, ruleId); + } + + public PagedIterable list(String resourceId) { + PagedIterable inner = this.serviceClient().list(resourceId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RuleResultsImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceId, String databaseName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceId, databaseName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RuleResultsImpl(inner1, this.manager())); + } + + public Response addWithResponse(String resourceId, String databaseName, RulesResultsInput body, + Context context) { + Response inner + = this.serviceClient().addWithResponse(resourceId, databaseName, body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RulesResultsImpl(inner.getValue(), this.manager())); + } + + public RulesResults add(String resourceId) { + RulesResultsInner inner = this.serviceClient().add(resourceId); + if (inner != null) { + return new RulesResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public RuleResults getById(String id) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselineRules'.", id))); + } + String localDatabaseName = null; + return this.getWithResponse(resourceId, ruleId, localDatabaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String databaseName, Context context) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselineRules'.", id))); + } + return this.getWithResponse(resourceId, ruleId, databaseName, context); + } + + public void deleteById(String id) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselineRules'.", id))); + } + String localDatabaseName = null; + this.deleteWithResponse(resourceId, ruleId, localDatabaseName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, String databaseName, Context context) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String ruleId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "ruleId"); + if (ruleId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselineRules'.", id))); + } + return this.deleteWithResponse(resourceId, ruleId, databaseName, context); + } + + private SqlVulnerabilityAssessmentBaselineRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public RuleResultsImpl define(String name) { + return new RuleResultsImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanOperationResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanOperationResultImpl.java new file mode 100644 index 000000000000..f2434a7f7eb1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanOperationResultImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.SqlVulnerabilityAssessmentScanOperationResultInner; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanOperationResult; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanOperationResultProperties; + +public final class SqlVulnerabilityAssessmentScanOperationResultImpl + implements SqlVulnerabilityAssessmentScanOperationResult { + private SqlVulnerabilityAssessmentScanOperationResultInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SqlVulnerabilityAssessmentScanOperationResultImpl(SqlVulnerabilityAssessmentScanOperationResultInner 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 SqlVulnerabilityAssessmentScanOperationResultProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SqlVulnerabilityAssessmentScanOperationResultInner 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/SqlVulnerabilityAssessmentScanResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsClientImpl.java new file mode 100644 index 000000000000..c421f7f32215 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsClientImpl.java @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.implementation.models.ScanResults; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentScanResultsClient. + */ +public final class SqlVulnerabilityAssessmentScanResultsClientImpl + implements SqlVulnerabilityAssessmentScanResultsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlVulnerabilityAssessmentScanResultsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentScanResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentScanResultsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SqlVulnerabilityAssessmentScanResultsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSqlVulnerabilityAssessmentScanResults to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSqlVulnerabilityAssessmentScanResults") + public interface SqlVulnerabilityAssessmentScanResultsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("scanId") String scanId, + @PathParam("scanResultId") String scanResultId, @QueryParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("scanId") String scanId, + @QueryParam("databaseName") String databaseName, @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. + * @param scanResultId The rule Id of the results. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scan results of a single rule in a scan record along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scanId, String scanResultId, String resourceId, + String databaseName) { + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, scanId, scanResultId, + databaseName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. + * @param scanResultId The rule Id of the results. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan results of a single rule in a scan record along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scanId, String scanResultId, String resourceId, + String databaseName, Context context) { + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, scanId, scanResultId, databaseName, + accept, context); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. + * @param scanResultId The rule Id of the results. + * @param resourceId The fully qualified Azure Resource manager identifier 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 the scan results of a single rule in a scan record on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scanId, String scanResultId, String resourceId) { + final String databaseName = null; + return getWithResponseAsync(scanId, scanResultId, resourceId, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. + * @param scanResultId The rule Id of the results. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan results of a single rule in a scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scanId, String scanResultId, String resourceId, + String databaseName, Context context) { + return getWithResponseAsync(scanId, scanResultId, resourceId, databaseName, context).block(); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. + * @param scanResultId The rule Id of the results. + * @param resourceId The fully qualified Azure Resource manager identifier 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 the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanResultInner get(String scanId, String scanResultId, String resourceId) { + final String databaseName = null; + return getWithResponse(scanId, scanResultId, resourceId, databaseName, Context.NONE).getValue(); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scan results for a single scan record along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scanId, String resourceId, + String databaseName) { + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, scanId, + databaseName, 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 scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan results for a single scan record along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scanId, String resourceId, + String databaseName, Context context) { + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, resourceId, scanId, databaseName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scan results for a single scan record as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scanId, String resourceId, String databaseName) { + return new PagedFlux<>(() -> listSinglePageAsync(scanId, resourceId, databaseName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier 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 scan results for a single scan record as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scanId, String resourceId) { + final String databaseName = null; + return new PagedFlux<>(() -> listSinglePageAsync(scanId, resourceId, databaseName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan results for a single scan record as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scanId, String resourceId, String databaseName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(scanId, resourceId, databaseName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier 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 scan results for a single scan record as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scanId, String resourceId) { + final String databaseName = null; + return new PagedIterable<>(listAsync(scanId, resourceId, databaseName)); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan results for a single scan record as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scanId, String resourceId, String databaseName, Context context) { + return new PagedIterable<>(listAsync(scanId, resourceId, databaseName, context)); + } + + /** + * Gets a list of scan results for a single scan record. + * + * 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 scan results for a single scan record 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.")); + } + 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())); + } + + /** + * Gets a list of scan results for a single scan record. + * + * 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 scan results for a single scan record 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.")); + } + 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/SqlVulnerabilityAssessmentScanResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java new file mode 100644 index 000000000000..682c44194149 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.models.ScanResult; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanResults; + +public final class SqlVulnerabilityAssessmentScanResultsImpl implements SqlVulnerabilityAssessmentScanResults { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentScanResultsImpl.class); + + private final SqlVulnerabilityAssessmentScanResultsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SqlVulnerabilityAssessmentScanResultsImpl(SqlVulnerabilityAssessmentScanResultsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String scanId, String scanResultId, String resourceId, + String databaseName, Context context) { + Response inner + = this.serviceClient().getWithResponse(scanId, scanResultId, resourceId, databaseName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScanResultImpl(inner.getValue(), this.manager())); + } + + public ScanResult get(String scanId, String scanResultId, String resourceId) { + ScanResultInner inner = this.serviceClient().get(scanId, scanResultId, resourceId); + if (inner != null) { + return new ScanResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String scanId, String resourceId) { + PagedIterable inner = this.serviceClient().list(scanId, resourceId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ScanResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String scanId, String resourceId, String databaseName, Context context) { + PagedIterable inner = this.serviceClient().list(scanId, resourceId, databaseName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ScanResultImpl(inner1, this.manager())); + } + + private SqlVulnerabilityAssessmentScanResultsClient 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/SqlVulnerabilityAssessmentScansClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 000000000000..6b0a5c2b27f7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,793 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.models.ScanV2Inner; +import com.azure.resourcemanager.security.fluent.models.SqlVulnerabilityAssessmentScanOperationResultInner; +import com.azure.resourcemanager.security.implementation.models.ScansV2; +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 SqlVulnerabilityAssessmentScansClient. + */ +public final class SqlVulnerabilityAssessmentScansClientImpl implements SqlVulnerabilityAssessmentScansClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlVulnerabilityAssessmentScansService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentScansClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SqlVulnerabilityAssessmentScansService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSqlVulnerabilityAssessmentScans to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSqlVulnerabilityAssessmentScans") + public interface SqlVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/initiateScan") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> initiateScan(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/scanOperationResults/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getScanOperationResult( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("operationId") String operationId, @QueryParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("scanId") String scanId, + @QueryParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("databaseName") String databaseName, @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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>> initiateScanWithResponseAsync(String resourceId, String databaseName) { + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.initiateScan(this.client.getEndpoint(), apiVersion, resourceId, + databaseName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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>> initiateScanWithResponseAsync(String resourceId, String databaseName, + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.initiateScan(this.client.getEndpoint(), apiVersion, resourceId, databaseName, accept, context); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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, SqlVulnerabilityAssessmentScanOperationResultInner> + beginInitiateScanAsync(String resourceId, String databaseName) { + Mono>> mono = initiateScanWithResponseAsync(resourceId, databaseName); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlVulnerabilityAssessmentScanOperationResultInner.class, + SqlVulnerabilityAssessmentScanOperationResultInner.class, this.client.getContext()); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId 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, SqlVulnerabilityAssessmentScanOperationResultInner> + beginInitiateScanAsync(String resourceId) { + final String databaseName = null; + Mono>> mono = initiateScanWithResponseAsync(resourceId, databaseName); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlVulnerabilityAssessmentScanOperationResultInner.class, + SqlVulnerabilityAssessmentScanOperationResultInner.class, this.client.getContext()); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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, SqlVulnerabilityAssessmentScanOperationResultInner> + beginInitiateScanAsync(String resourceId, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = initiateScanWithResponseAsync(resourceId, databaseName, context); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlVulnerabilityAssessmentScanOperationResultInner.class, + SqlVulnerabilityAssessmentScanOperationResultInner.class, context); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId 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, SqlVulnerabilityAssessmentScanOperationResultInner> + beginInitiateScan(String resourceId) { + final String databaseName = null; + return this.beginInitiateScanAsync(resourceId, databaseName).getSyncPoller(); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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, SqlVulnerabilityAssessmentScanOperationResultInner> + beginInitiateScan(String resourceId, String databaseName, Context context) { + return this.beginInitiateScanAsync(resourceId, databaseName, context).getSyncPoller(); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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 initiateScanAsync(String resourceId, + String databaseName) { + return beginInitiateScanAsync(resourceId, databaseName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId 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 initiateScanAsync(String resourceId) { + final String databaseName = null; + return beginInitiateScanAsync(resourceId, databaseName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiateScanAsync(String resourceId, + String databaseName, Context context) { + return beginInitiateScanAsync(resourceId, databaseName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId 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 SqlVulnerabilityAssessmentScanOperationResultInner initiateScan(String resourceId) { + final String databaseName = null; + return initiateScanAsync(resourceId, databaseName).block(); + } + + /** + * Initiates a vulnerability assessment scan. + * + * @param resourceId The resourceId parameter. + * @param databaseName The databaseName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentScanOperationResultInner initiateScan(String resourceId, String databaseName, + Context context) { + return initiateScanAsync(resourceId, databaseName, context).block(); + } + + /** + * Gets the result of a scan operation initiated by the InitiateScan action. + * + * @param resourceId The resourceId parameter. + * @param operationId The operationId parameter. + * @param databaseName The databaseName 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 result of a scan operation initiated by the InitiateScan action along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getScanOperationResultWithResponseAsync(String resourceId, String operationId, String databaseName) { + 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getScanOperationResult(this.client.getEndpoint(), apiVersion, resourceId, + operationId, databaseName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the result of a scan operation initiated by the InitiateScan action. + * + * @param resourceId The resourceId parameter. + * @param operationId The operationId parameter. + * @param databaseName The databaseName 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 result of a scan operation initiated by the InitiateScan action along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getScanOperationResultWithResponseAsync( + String resourceId, String operationId, String databaseName, 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 (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getScanOperationResult(this.client.getEndpoint(), apiVersion, resourceId, operationId, + databaseName, accept, context); + } + + /** + * Gets the result of a scan operation initiated by the InitiateScan action. + * + * @param resourceId The resourceId parameter. + * @param operationId The operationId 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 result of a scan operation initiated by the InitiateScan action on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getScanOperationResultAsync(String resourceId, + String operationId) { + final String databaseName = null; + return getScanOperationResultWithResponseAsync(resourceId, operationId, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the result of a scan operation initiated by the InitiateScan action. + * + * @param resourceId The resourceId parameter. + * @param operationId The operationId parameter. + * @param databaseName The databaseName 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 result of a scan operation initiated by the InitiateScan action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getScanOperationResultWithResponse( + String resourceId, String operationId, String databaseName, Context context) { + return getScanOperationResultWithResponseAsync(resourceId, operationId, databaseName, context).block(); + } + + /** + * Gets the result of a scan operation initiated by the InitiateScan action. + * + * @param resourceId The resourceId parameter. + * @param operationId The operationId 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 result of a scan operation initiated by the InitiateScan action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentScanOperationResultInner getScanOperationResult(String resourceId, + String operationId) { + final String databaseName = null; + return getScanOperationResultWithResponse(resourceId, operationId, databaseName, Context.NONE).getValue(); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scan details of a single scan record along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scanId, String resourceId, String databaseName) { + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, scanId, databaseName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan details of a single scan record along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scanId, String resourceId, String databaseName, + Context context) { + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, scanId, databaseName, accept, context); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param resourceId The fully qualified Azure Resource manager identifier 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 the scan details of a single scan record on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scanId, String resourceId) { + final String databaseName = null; + return getWithResponseAsync(scanId, resourceId, databaseName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan details of a single scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scanId, String resourceId, String databaseName, + Context context) { + return getWithResponseAsync(scanId, resourceId, databaseName, context).block(); + } + + /** + * Gets the scan details of a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan. + * @param resourceId The fully qualified Azure Resource manager identifier 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 the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanV2Inner get(String scanId, String resourceId) { + final String databaseName = null; + return getWithResponse(scanId, resourceId, databaseName, Context.NONE).getValue(); + } + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scan records along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId, String databaseName) { + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.list(this.client.getEndpoint(), apiVersion, resourceId, databaseName, 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 scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan records along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceId, String databaseName, + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, resourceId, databaseName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, String databaseName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, databaseName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId) { + final String databaseName = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, databaseName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, String databaseName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId, databaseName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId) { + final String databaseName = null; + return new PagedIterable<>(listAsync(resourceId, databaseName)); + } + + /** + * Gets a list of scan records. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param databaseName The name of the database to assess. Required when the API is called on the parent resource + * (e.g., server level) rather than on a specific database resource, since the database name is not part of the + * resource URI. This is the only way to assess system databases (e.g., master), which cannot be referenced directly + * in the resource URI. + * @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 scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId, String databaseName, Context context) { + return new PagedIterable<>(listAsync(resourceId, databaseName, context)); + } + + /** + * Gets a list of scan records. + * + * 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 scan records 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())); + } + + /** + * Gets a list of scan records. + * + * 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 scan records 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/SqlVulnerabilityAssessmentScansImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansImpl.java new file mode 100644 index 000000000000..9e58d6ba708d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.models.ScanV2Inner; +import com.azure.resourcemanager.security.fluent.models.SqlVulnerabilityAssessmentScanOperationResultInner; +import com.azure.resourcemanager.security.models.ScanV2; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanOperationResult; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScans; + +public final class SqlVulnerabilityAssessmentScansImpl implements SqlVulnerabilityAssessmentScans { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentScansImpl.class); + + private final SqlVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SqlVulnerabilityAssessmentScansImpl(SqlVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SqlVulnerabilityAssessmentScanOperationResult initiateScan(String resourceId) { + SqlVulnerabilityAssessmentScanOperationResultInner inner = this.serviceClient().initiateScan(resourceId); + if (inner != null) { + return new SqlVulnerabilityAssessmentScanOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlVulnerabilityAssessmentScanOperationResult initiateScan(String resourceId, String databaseName, + Context context) { + SqlVulnerabilityAssessmentScanOperationResultInner inner + = this.serviceClient().initiateScan(resourceId, databaseName, context); + if (inner != null) { + return new SqlVulnerabilityAssessmentScanOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getScanOperationResultWithResponse(String resourceId, + String operationId, String databaseName, Context context) { + Response inner + = this.serviceClient().getScanOperationResultWithResponse(resourceId, operationId, databaseName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlVulnerabilityAssessmentScanOperationResultImpl(inner.getValue(), this.manager())); + } + + public SqlVulnerabilityAssessmentScanOperationResult getScanOperationResult(String resourceId, String operationId) { + SqlVulnerabilityAssessmentScanOperationResultInner inner + = this.serviceClient().getScanOperationResult(resourceId, operationId); + if (inner != null) { + return new SqlVulnerabilityAssessmentScanOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scanId, String resourceId, String databaseName, Context context) { + Response inner = this.serviceClient().getWithResponse(scanId, resourceId, databaseName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScanV2Impl(inner.getValue(), this.manager())); + } + + public ScanV2 get(String scanId, String resourceId) { + ScanV2Inner inner = this.serviceClient().get(scanId, resourceId); + if (inner != null) { + return new ScanV2Impl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceId) { + PagedIterable inner = this.serviceClient().list(resourceId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ScanV2Impl(inner1, this.manager())); + } + + public PagedIterable list(String resourceId, String databaseName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceId, databaseName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ScanV2Impl(inner1, this.manager())); + } + + private SqlVulnerabilityAssessmentScansClient 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/SqlVulnerabilityAssessmentSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentSettingsImpl.java new file mode 100644 index 000000000000..d72d820d279e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentSettingsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.SqlVulnerabilityAssessmentSettingsInner; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentSettings; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentSettingsProperties; + +public final class SqlVulnerabilityAssessmentSettingsImpl implements SqlVulnerabilityAssessmentSettings { + private SqlVulnerabilityAssessmentSettingsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SqlVulnerabilityAssessmentSettingsImpl(SqlVulnerabilityAssessmentSettingsInner 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 SqlVulnerabilityAssessmentSettingsProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SqlVulnerabilityAssessmentSettingsInner 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/SqlVulnerabilityAssessmentSettingsOperationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentSettingsOperationsClientImpl.java new file mode 100644 index 000000000000..4594b1608b44 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentSettingsOperationsClientImpl.java @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentSettingsOperationsClient; +import com.azure.resourcemanager.security.fluent.models.SqlVulnerabilityAssessmentSettingsInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentSettingsOperationsClient. + */ +public final class SqlVulnerabilityAssessmentSettingsOperationsClientImpl + implements SqlVulnerabilityAssessmentSettingsOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlVulnerabilityAssessmentSettingsOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentSettingsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentSettingsOperationsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SqlVulnerabilityAssessmentSettingsOperationsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSqlVulnerabilityAssessmentSettingsOperations to be used + * by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSqlVulnerabilityAssessmentSettingsOperations") + public interface SqlVulnerabilityAssessmentSettingsOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlVulnerabilityAssessmentSettingsInner body, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, Context context); + } + + /** + * Gets the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the SQL Vulnerability Assessment settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId) { + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the SQL Vulnerability Assessment settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, accept, context); + } + + /** + * Gets the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the SQL Vulnerability Assessment settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId) { + return getWithResponseAsync(resourceId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the SQL Vulnerability Assessment settings along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, Context context) { + return getWithResponseAsync(resourceId, context).block(); + } + + /** + * Gets the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the SQL Vulnerability Assessment settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentSettingsInner get(String resourceId) { + return getWithResponse(resourceId, Context.NONE).getValue(); + } + + /** + * Creates or updates the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param body The SQL Vulnerability Assessment settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sQL Vulnerability Assessment settings resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceId, + SqlVulnerabilityAssessmentSettingsInner body) { + 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 (body != null) { + body.validate(); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param body The SQL Vulnerability Assessment settings. + * @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 sQL Vulnerability Assessment settings resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceId, + SqlVulnerabilityAssessmentSettingsInner body, 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 (body != null) { + body.validate(); + } + final String apiVersion = "2026-04-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, accept, body, context); + } + + /** + * Creates or updates the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 sQL Vulnerability Assessment settings resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceId) { + final SqlVulnerabilityAssessmentSettingsInner body = null; + return createOrUpdateWithResponseAsync(resourceId, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param body The SQL Vulnerability Assessment settings. + * @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 sQL Vulnerability Assessment settings resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceId, + SqlVulnerabilityAssessmentSettingsInner body, Context context) { + return createOrUpdateWithResponseAsync(resourceId, body, context).block(); + } + + /** + * Creates or updates the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 sQL Vulnerability Assessment settings resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentSettingsInner createOrUpdate(String resourceId) { + final SqlVulnerabilityAssessmentSettingsInner body = null; + return createOrUpdateWithResponse(resourceId, body, Context.NONE).getValue(); + } + + /** + * Deletes the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceId) { + 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.")); + } + final String apiVersion = "2026-04-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, resourceId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2026-04-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, resourceId, context); + } + + /** + * Deletes the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceId) { + return deleteWithResponseAsync(resourceId).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceId, Context context) { + return deleteWithResponseAsync(resourceId, context).block(); + } + + /** + * Deletes the SQL Vulnerability Assessment settings. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceId) { + deleteWithResponse(resourceId, Context.NONE); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentSettingsOperationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentSettingsOperationsImpl.java new file mode 100644 index 000000000000..60fd21019a33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentSettingsOperationsImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SqlVulnerabilityAssessmentSettingsOperationsClient; +import com.azure.resourcemanager.security.fluent.models.SqlVulnerabilityAssessmentSettingsInner; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentSettings; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentSettingsOperations; + +public final class SqlVulnerabilityAssessmentSettingsOperationsImpl + implements SqlVulnerabilityAssessmentSettingsOperations { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentSettingsOperationsImpl.class); + + private final SqlVulnerabilityAssessmentSettingsOperationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SqlVulnerabilityAssessmentSettingsOperationsImpl( + SqlVulnerabilityAssessmentSettingsOperationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlVulnerabilityAssessmentSettingsImpl(inner.getValue(), this.manager())); + } + + public SqlVulnerabilityAssessmentSettings get(String resourceId) { + SqlVulnerabilityAssessmentSettingsInner inner = this.serviceClient().get(resourceId); + if (inner != null) { + return new SqlVulnerabilityAssessmentSettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String resourceId, + SqlVulnerabilityAssessmentSettingsInner body, Context context) { + Response inner + = this.serviceClient().createOrUpdateWithResponse(resourceId, body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlVulnerabilityAssessmentSettingsImpl(inner.getValue(), this.manager())); + } + + public SqlVulnerabilityAssessmentSettings createOrUpdate(String resourceId) { + SqlVulnerabilityAssessmentSettingsInner inner = this.serviceClient().createOrUpdate(resourceId); + if (inner != null) { + return new SqlVulnerabilityAssessmentSettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceId, Context context) { + return this.serviceClient().deleteWithResponse(resourceId, context); + } + + public void delete(String resourceId) { + this.serviceClient().delete(resourceId); + } + + private SqlVulnerabilityAssessmentSettingsOperationsClient 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/StandardAssignmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentImpl.java index 1f22bc22750b..999c40f2c81b 100644 --- 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 @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.StandardAssignmentInner; import com.azure.resourcemanager.security.models.AssignedStandardItem; @@ -39,6 +40,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String displayName() { return this.innerModel().displayName(); } 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 index 796a9c6fb278..3242ac81687a 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -30,7 +30,7 @@ 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 com.azure.resourcemanager.security.implementation.models.StandardAssignmentsList; import reactor.core.publisher.Mono; /** @@ -62,44 +62,44 @@ public final class StandardAssignmentsClientImpl implements StandardAssignmentsC * The interface defining all the services for SecurityCenterStandardAssignments to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterStanda") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterStandardAssignments") 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, + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, - @PathParam("standardAssignmentName") String standardAssignmentName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @PathParam("standardAssignmentName") String standardAssignmentName, @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, + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @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); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StandardAssignmentInner standardAssignment, Context context); - @Headers({ "Content-Type: application/json" }) + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "resourceId", encoded = true) String resourceId, - @PathParam("standardAssignmentName") String standardAssignmentName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @PathParam("standardAssignmentName") String standardAssignmentName, 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, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -107,7 +107,7 @@ Mono> list(@HostParam("$host") String endpoint @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -115,7 +115,7 @@ Mono> listNext(@PathParam(value = "nextLink", * * 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 resourceId The fully qualified Azure Resource manager 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. @@ -140,8 +140,8 @@ private Mono> getWithResponseAsync(String reso 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)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, resourceId, + standardAssignmentName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -150,7 +150,7 @@ private Mono> getWithResponseAsync(String reso * * 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 resourceId The fully qualified Azure Resource manager 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. @@ -176,7 +176,7 @@ private Mono> getWithResponseAsync(String reso 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); + return service.get(this.client.getEndpoint(), apiVersion, resourceId, standardAssignmentName, accept, context); } /** @@ -184,7 +184,7 @@ private Mono> getWithResponseAsync(String reso * * 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 resourceId The fully qualified Azure Resource manager 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. @@ -202,7 +202,7 @@ private Mono getAsync(String resourceId, String standar * * 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 resourceId The fully qualified Azure Resource manager 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. @@ -221,7 +221,7 @@ public Response getWithResponse(String resourceId, Stri * * 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 resourceId The fully qualified Azure Resource manager 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. @@ -240,7 +240,7 @@ public StandardAssignmentInner get(String resourceId, String standardAssignmentN * 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 resourceId The fully qualified Azure Resource manager 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. @@ -270,10 +270,11 @@ private Mono> createWithResponseAsync(String r standardAssignment.validate(); } final String apiVersion = "2024-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.create(this.client.getEndpoint(), resourceId, standardAssignmentName, - apiVersion, standardAssignment, accept, context)) + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, resourceId, + standardAssignmentName, contentType, accept, standardAssignment, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -284,7 +285,7 @@ private Mono> createWithResponseAsync(String r * 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 resourceId The fully qualified Azure Resource manager 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. @@ -315,10 +316,11 @@ private Mono> createWithResponseAsync(String r standardAssignment.validate(); } final String apiVersion = "2024-08-01"; + final String contentType = "application/json"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, - standardAssignment, accept, context); + return service.create(this.client.getEndpoint(), apiVersion, resourceId, standardAssignmentName, contentType, + accept, standardAssignment, context); } /** @@ -328,7 +330,7 @@ private Mono> createWithResponseAsync(String r * 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 resourceId The fully qualified Azure Resource manager 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. @@ -350,7 +352,7 @@ private Mono createAsync(String resourceId, String stan * 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 resourceId The fully qualified Azure Resource manager 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. @@ -372,7 +374,7 @@ public Response createWithResponse(String resourceId, S * 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 resourceId The fully qualified Azure Resource manager 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. @@ -393,7 +395,7 @@ public StandardAssignmentInner create(String resourceId, String standardAssignme * standard assignment is the part of its ID preceding * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager 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. @@ -414,10 +416,9 @@ private Mono> deleteWithResponseAsync(String resourceId, String s 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)) + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, resourceId, + standardAssignmentName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -428,7 +429,7 @@ private Mono> deleteWithResponseAsync(String resourceId, String s * standard assignment is the part of its ID preceding * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager 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. @@ -451,10 +452,8 @@ private Mono> deleteWithResponseAsync(String resourceId, String s 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); + return service.delete(this.client.getEndpoint(), apiVersion, resourceId, standardAssignmentName, context); } /** @@ -464,7 +463,7 @@ private Mono> deleteWithResponseAsync(String resourceId, String s * standard assignment is the part of its ID preceding * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager 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. @@ -483,7 +482,7 @@ private Mono deleteAsync(String resourceId, String standardAssignmentName) * standard assignment is the part of its ID preceding * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager 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. @@ -503,7 +502,7 @@ public Response deleteWithResponse(String resourceId, String standardAssig * standard assignment is the part of its ID preceding * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager 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. @@ -517,10 +516,7 @@ public 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})'. + * @param scope The fully qualified Azure Resource manager identifier 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. @@ -548,10 +544,7 @@ private Mono> listSinglePageAsync(String /** * 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 scope The fully qualified Azure Resource manager identifier 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. @@ -579,10 +572,7 @@ private Mono> listSinglePageAsync(String /** * 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 scope The fully qualified Azure Resource manager identifier 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. @@ -596,10 +586,7 @@ private PagedFlux listAsync(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 scope The fully qualified Azure Resource manager identifier 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. @@ -615,10 +602,7 @@ private PagedFlux listAsync(String scope, Context conte /** * 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 scope The fully qualified Azure Resource manager identifier 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. @@ -633,10 +617,7 @@ public 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 scope The fully qualified Azure Resource manager identifier 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. @@ -656,8 +637,8 @@ public PagedIterable list(String scope, Context context * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @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> listNextSinglePageAsync(String nextLink) { @@ -683,8 +664,8 @@ private Mono> listNextSinglePageAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @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> listNextSinglePageAsync(String nextLink, Context context) { 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 index 5b5c54acdfb2..1adc00ae7d47 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -31,12 +31,8 @@ public Response getWithResponse(String resourceId, String st 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; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StandardAssignmentImpl(inner.getValue(), this.manager())); } public StandardAssignment get(String resourceId, String standardAssignmentName) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardImpl.java new file mode 100644 index 000000000000..e2adb6fa24e4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardImpl.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.StandardInner; +import com.azure.resourcemanager.security.models.Standard; +import com.azure.resourcemanager.security.models.StandardComponentProperties; +import com.azure.resourcemanager.security.models.StandardSupportedClouds; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class StandardImpl implements Standard, Standard.Definition, Standard.Update { + private StandardInner 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 Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String standardType() { + return this.innerModel().standardType(); + } + + public String description() { + return this.innerModel().description(); + } + + public String category() { + return this.innerModel().category(); + } + + public List components() { + List inner = this.innerModel().components(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List supportedClouds() { + List inner = this.innerModel().supportedClouds(); + 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 String resourceGroupName() { + return resourceGroupName; + } + + public StandardInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String standardId; + + public StandardImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Standard create() { + this.innerObject = serviceManager.serviceClient() + .getStandards() + .createOrUpdateWithResponse(resourceGroupName, standardId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Standard create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStandards() + .createOrUpdateWithResponse(resourceGroupName, standardId, this.innerModel(), context) + .getValue(); + return this; + } + + StandardImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new StandardInner(); + this.serviceManager = serviceManager; + this.standardId = name; + } + + public StandardImpl update() { + return this; + } + + public Standard apply() { + this.innerObject = serviceManager.serviceClient() + .getStandards() + .createOrUpdateWithResponse(resourceGroupName, standardId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Standard apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStandards() + .createOrUpdateWithResponse(resourceGroupName, standardId, this.innerModel(), context) + .getValue(); + return this; + } + + StandardImpl(StandardInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.standardId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "standards"); + } + + public Standard refresh() { + this.innerObject = serviceManager.serviceClient() + .getStandards() + .getByResourceGroupWithResponse(resourceGroupName, standardId, Context.NONE) + .getValue(); + return this; + } + + public Standard refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStandards() + .getByResourceGroupWithResponse(resourceGroupName, standardId, context) + .getValue(); + return this; + } + + public StandardImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public StandardImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public StandardImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public StandardImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public StandardImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public StandardImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public StandardImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public StandardImpl withCategory(String category) { + this.innerModel().withCategory(category); + return this; + } + + public StandardImpl withComponents(List components) { + this.innerModel().withComponents(components); + return this; + } + + public StandardImpl withSupportedClouds(List supportedClouds) { + this.innerModel().withSupportedClouds(supportedClouds); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardsClientImpl.java new file mode 100644 index 000000000000..fb016612efa7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardsClientImpl.java @@ -0,0 +1,857 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.StandardsClient; +import com.azure.resourcemanager.security.fluent.models.StandardInner; +import com.azure.resourcemanager.security.implementation.models.StandardList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StandardsClient. + */ +public final class StandardsClientImpl implements StandardsClient { + /** + * The proxy service used to perform REST calls. + */ + private final StandardsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of StandardsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StandardsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(StandardsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterStandards to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterStandards") + public interface StandardsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards/{standardId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("standardId") String standardId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards/{standardId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("standardId") String standardId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StandardInner standard, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards/{standardId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("standardId") String standardId, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/standards") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a specific security standard for the requested scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String standardId) { + 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 (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, standardId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific security standard for the requested scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + 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 (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 (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, standardId, accept, context); + } + + /** + * Get a specific security standard for the requested scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String standardId) { + return getByResourceGroupWithResponseAsync(resourceGroupName, standardId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific security standard for the requested scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String standardId, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, standardId, context).block(); + } + + /** + * Get a specific security standard for the requested scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StandardInner getByResourceGroup(String resourceGroupName, String standardId) { + return getByResourceGroupWithResponse(resourceGroupName, standardId, Context.NONE).getValue(); + } + + /** + * Create a security standard on the given scope. Available only for custom standards. Will create/update the + * required standard definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId, + StandardInner standard) { + 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 (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 = "2021-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, standardId, contentType, accept, standard, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a security standard on the given scope. Available only for custom standards. Will create/update the + * required standard definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId, + StandardInner standard, 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 (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 = "2021-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, standardId, contentType, accept, standard, context); + } + + /** + * Create a security standard on the given scope. Available only for custom standards. Will create/update the + * required standard definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId, + StandardInner standard) { + return createOrUpdateWithResponseAsync(resourceGroupName, standardId, standard) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a security standard on the given scope. Available only for custom standards. Will create/update the + * required standard definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId, + StandardInner standard, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, standardId, standard, context).block(); + } + + /** + * Create a security standard on the given scope. Available only for custom standards. Will create/update the + * required standard definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 StandardInner createOrUpdate(String resourceGroupName, String standardId, StandardInner standard) { + return createOrUpdateWithResponse(resourceGroupName, standardId, standard, Context.NONE).getValue(); + } + + /** + * Delete a security standard on a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId) { + 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 (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, standardId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a security standard on a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, 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 (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 (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + standardId, context); + } + + /** + * Delete a security standard on a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId) { + return deleteWithResponseAsync(resourceGroupName, standardId).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a security standard on a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId, Context context) { + return deleteWithResponseAsync(resourceGroupName, standardId, context).block(); + } + + /** + * Delete a security standard on a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 resourceGroupName, String standardId) { + deleteWithResponse(resourceGroupName, standardId, Context.NONE); + } + + /** + * Get security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 standards on all your resources inside a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, 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 security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standards on all your resources inside a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 standards on all your resources inside a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standards on all your resources inside a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 standards on all your resources inside a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get security standards on all your resources inside a scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standards on all your resources inside a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a list of all relevant security standards over a subscription level scope. + * + * @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 subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 subscription level 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 a list of all relevant security standards over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2021-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) + .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 subscription level scope. + * + * @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 subscription level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant security standards over a subscription level 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 a list of all relevant security standards over a subscription level scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant security standards over a subscription level scope. + * + * @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 subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all relevant security standards over a subscription level 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 a list of all relevant security standards over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 security standards on all your resources inside a scope 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 security standards on all your resources inside a scope 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)); + } + + /** + * 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 all relevant security standards over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 all relevant security standards over a subscription level scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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/StandardsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardsImpl.java new file mode 100644 index 000000000000..436049981a35 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardsImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.StandardsClient; +import com.azure.resourcemanager.security.fluent.models.StandardInner; +import com.azure.resourcemanager.security.models.Standard; +import com.azure.resourcemanager.security.models.Standards; + +public final class StandardsImpl implements Standards { + private static final ClientLogger LOGGER = new ClientLogger(StandardsImpl.class); + + private final StandardsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public StandardsImpl(StandardsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String standardId, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, standardId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StandardImpl(inner.getValue(), this.manager())); + } + + public Standard getByResourceGroup(String resourceGroupName, String standardId) { + StandardInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, standardId); + if (inner != null) { + return new StandardImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String standardId, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, standardId, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String standardId) { + this.serviceClient().delete(resourceGroupName, standardId); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StandardImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StandardImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StandardImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StandardImpl(inner1, this.manager())); + } + + public Standard 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 standardId = ResourceManagerUtils.getValueFromIdByName(id, "standards"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standards'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, standardId, 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 standardId = ResourceManagerUtils.getValueFromIdByName(id, "standards"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standards'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, standardId, 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 standardId = ResourceManagerUtils.getValueFromIdByName(id, "standards"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standards'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, standardId, Context.NONE); + } + + public Response 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 standardId = ResourceManagerUtils.getValueFromIdByName(id, "standards"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standards'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, standardId, context); + } + + private StandardsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public StandardImpl define(String name) { + return new StandardImpl(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 new file mode 100644 index 000000000000..4fd841a5c40b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SubAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import com.azure.resourcemanager.security.implementation.models.SecuritySubAssessmentList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SubAssessmentsClient. + */ +public final class SubAssessmentsClientImpl implements SubAssessmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SubAssessmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SubAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubAssessmentsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(SubAssessmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSubAssessments to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterSubAssessments") + public interface SubAssessmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, + @PathParam("subAssessmentName") String subAssessmentName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/subAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAll(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) 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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment 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 security sub-assessment on your scanned resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String assessmentName, + String subAssessmentName) { + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (subAssessmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter subAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, scope, assessmentName, + subAssessmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment 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 security sub-assessment on your scanned resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String assessmentName, + String subAssessmentName, 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (subAssessmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter subAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, assessmentName, subAssessmentName, accept, + context); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment 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 security sub-assessment on your scanned resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String assessmentName, String subAssessmentName) { + return getWithResponseAsync(scope, assessmentName, subAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment 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 security sub-assessment on your scanned resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String assessmentName, + String subAssessmentName, Context context) { + return getWithResponseAsync(scope, assessmentName, subAssessmentName, context).block(); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment type. + * @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment 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 security sub-assessment on your scanned resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecuritySubAssessmentInner get(String scope, String assessmentName, String subAssessmentName) { + return getWithResponse(scope, assessmentName, subAssessmentName, Context.NONE).getValue(); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, String assessmentName) { + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), apiVersion, scope, assessmentName, 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 security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, String assessmentName, + 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 (assessmentName == null) { + return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String assessmentName) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, assessmentName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String assessmentName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, assessmentName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String assessmentName) { + return new PagedIterable<>(listAsync(scope, assessmentName)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a scope. + * + * @param scope The scope of the sub-assessment. + * @param assessmentName The security assessment key - unique key for the assessment 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 security sub-assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String assessmentName, Context context) { + return new PagedIterable<>(listAsync(scope, assessmentName, context)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync(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 = "2019-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAll(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 security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync(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 = "2019-01-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listAll(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 security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync(String scope) { + return new PagedFlux<>(() -> listAllSinglePageAsync(scope), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync(String scope, Context context) { + return new PagedFlux<>(() -> listAllSinglePageAsync(scope, context), + nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll(String scope) { + return new PagedIterable<>(listAllAsync(scope)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security sub-assessments on all your scanned resources inside a subscription scope as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll(String scope, Context context) { + return new PagedIterable<>(listAllAsync(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 security sub-assessments on all your scanned resources inside a scope 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 security sub-assessments on all your scanned resources inside a scope 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)); + } + + /** + * 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 security sub-assessments on all your scanned resources inside a subscription scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(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 security sub-assessments on all your scanned resources inside a subscription scope along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(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/SubAssessmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsImpl.java new file mode 100644 index 000000000000..693d05c9f87c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.SubAssessmentsClient; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; +import com.azure.resourcemanager.security.models.SecuritySubAssessment; +import com.azure.resourcemanager.security.models.SubAssessments; + +public final class SubAssessmentsImpl implements SubAssessments { + private static final ClientLogger LOGGER = new ClientLogger(SubAssessmentsImpl.class); + + private final SubAssessmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SubAssessmentsImpl(SubAssessmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String scope, String assessmentName, + String subAssessmentName, Context context) { + Response inner + = this.serviceClient().getWithResponse(scope, assessmentName, subAssessmentName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecuritySubAssessmentImpl(inner.getValue(), this.manager())); + } + + public SecuritySubAssessment get(String scope, String assessmentName, String subAssessmentName) { + SecuritySubAssessmentInner inner = this.serviceClient().get(scope, assessmentName, subAssessmentName); + if (inner != null) { + return new SecuritySubAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String scope, String assessmentName) { + PagedIterable inner = this.serviceClient().list(scope, assessmentName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String assessmentName, Context context) { + PagedIterable inner = this.serviceClient().list(scope, assessmentName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listAll(String scope) { + PagedIterable inner = this.serviceClient().listAll(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listAll(String scope, Context context) { + PagedIterable inner = this.serviceClient().listAll(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecuritySubAssessmentImpl(inner1, this.manager())); + } + + private SubAssessmentsClient 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/TasksClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java new file mode 100644 index 000000000000..3b63fa9d765a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java @@ -0,0 +1,1334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.TasksClient; +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.azure.resourcemanager.security.implementation.models.SecurityTaskList; +import com.azure.resourcemanager.security.models.TaskUpdateActionType; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TasksClient. + */ +public final class TasksClientImpl implements TasksClient { + /** + * The proxy service used to perform REST calls. + */ + private final TasksService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of TasksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TasksClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(TasksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterTasks to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterTasks") + public interface TasksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResourceGroupLevelTask(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("taskName") String taskName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateResourceGroupLevelTaskState(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("taskName") String taskName, + @PathParam("taskUpdateActionType") TaskUpdateActionType taskUpdateActionType, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionLevelTask(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @PathParam("taskName") String taskName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateSubscriptionLevelTaskState(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @PathParam("taskName") String taskName, + @PathParam("taskUpdateActionType") TaskUpdateActionType taskUpdateActionType, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceGroupLevelTaskWithResponseAsync(String resourceGroupName, + String ascLocation, String taskName) { + 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getResourceGroupLevelTask(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, taskName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceGroupLevelTaskWithResponseAsync(String resourceGroupName, + String ascLocation, String taskName, 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getResourceGroupLevelTask(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, taskName, accept, context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getResourceGroupLevelTaskAsync(String resourceGroupName, String ascLocation, + String taskName) { + return getResourceGroupLevelTaskWithResponseAsync(resourceGroupName, ascLocation, taskName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceGroupLevelTaskWithResponse(String resourceGroupName, + String ascLocation, String taskName, Context context) { + return getResourceGroupLevelTaskWithResponseAsync(resourceGroupName, ascLocation, taskName, context).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityTaskInner getResourceGroupLevelTask(String resourceGroupName, String ascLocation, String taskName) { + return getResourceGroupLevelTaskWithResponse(resourceGroupName, ascLocation, taskName, Context.NONE).getValue(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + String ascLocation, String filter) { + 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, filter, 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())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + String ascLocation, String filter, 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String ascLocation, + String filter) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, ascLocation, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String ascLocation) { + final String filter = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, ascLocation, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String ascLocation, + String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, ascLocation, filter, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, ascLocation, filter)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation, + String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, ascLocation, filter, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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> updateResourceGroupLevelTaskStateWithResponseAsync(String resourceGroupName, + String ascLocation, String taskName, TaskUpdateActionType taskUpdateActionType) { + 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + return FluxUtil + .withContext(context -> service.updateResourceGroupLevelTaskState(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, taskName, taskUpdateActionType, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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> updateResourceGroupLevelTaskStateWithResponseAsync(String resourceGroupName, + String ascLocation, String taskName, TaskUpdateActionType taskUpdateActionType, 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + context = this.client.mergeContext(context); + return service.updateResourceGroupLevelTaskState(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, taskName, taskUpdateActionType, context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 updateResourceGroupLevelTaskStateAsync(String resourceGroupName, String ascLocation, + String taskName, TaskUpdateActionType taskUpdateActionType) { + return updateResourceGroupLevelTaskStateWithResponseAsync(resourceGroupName, ascLocation, taskName, + taskUpdateActionType).flatMap(ignored -> Mono.empty()); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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 updateResourceGroupLevelTaskStateWithResponse(String resourceGroupName, String ascLocation, + String taskName, TaskUpdateActionType taskUpdateActionType, Context context) { + return updateResourceGroupLevelTaskStateWithResponseAsync(resourceGroupName, ascLocation, taskName, + taskUpdateActionType, context).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 updateResourceGroupLevelTaskState(String resourceGroupName, String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType) { + updateResourceGroupLevelTaskStateWithResponse(resourceGroupName, ascLocation, taskName, taskUpdateActionType, + Context.NONE); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionLevelTaskWithResponseAsync(String ascLocation, + String taskName) { + 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 (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getSubscriptionLevelTask(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, taskName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionLevelTaskWithResponseAsync(String ascLocation, + String taskName, 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 (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getSubscriptionLevelTask(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + ascLocation, taskName, accept, context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSubscriptionLevelTaskAsync(String ascLocation, String taskName) { + return getSubscriptionLevelTaskWithResponseAsync(ascLocation, taskName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionLevelTaskWithResponse(String ascLocation, String taskName, + Context context) { + return getSubscriptionLevelTaskWithResponseAsync(ascLocation, taskName, context).block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be 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 security task that we recommend to do in order to strengthen security. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityTaskInner getSubscriptionLevelTask(String ascLocation, String taskName) { + return getSubscriptionLevelTaskWithResponse(ascLocation, taskName, Context.NONE).getValue(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync(String ascLocation, String filter) { + 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.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, filter, 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())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionSinglePageAsync(String ascLocation, String filter, + 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.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHomeRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, + filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, String filter) { + return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation, filter), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + final String filter = null; + return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation, filter), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation, String filter, Context context) { + return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation, filter, context), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation) { + final String filter = null; + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, filter)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation, String filter, Context context) { + return new PagedIterable<>(listByHomeRegionAsync(ascLocation, filter, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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> updateSubscriptionLevelTaskStateWithResponseAsync(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType) { + 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 (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + return FluxUtil + .withContext(context -> service.updateSubscriptionLevelTaskState(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, taskName, taskUpdateActionType, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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> updateSubscriptionLevelTaskStateWithResponseAsync(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType, 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 (taskName == null) { + return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + return Mono + .error(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + context = this.client.mergeContext(context); + return service.updateSubscriptionLevelTaskState(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, taskName, taskUpdateActionType, context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 updateSubscriptionLevelTaskStateAsync(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType) { + return updateSubscriptionLevelTaskStateWithResponseAsync(ascLocation, taskName, taskUpdateActionType) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @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 updateSubscriptionLevelTaskStateWithResponse(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType, Context context) { + return updateSubscriptionLevelTaskStateWithResponseAsync(ascLocation, taskName, taskUpdateActionType, context) + .block(); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param taskName Name of the task object, will be a GUID. + * @param taskUpdateActionType Type of the action to do on the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 updateSubscriptionLevelTaskState(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType) { + updateSubscriptionLevelTaskStateWithResponse(ascLocation, taskName, taskUpdateActionType, Context.NONE); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + 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 = "2015-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + filter, 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())); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, 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 = "2015-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @param filter OData filter. Optional. + * @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 security task recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, 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 list of security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * 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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync(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.listByHomeRegionNext(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 security task recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHomeRegionNextSinglePageAsync(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.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * 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 security task 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 list of security task 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/TasksImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java new file mode 100644 index 000000000000..eaec5ee484d6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.TasksClient; +import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; +import com.azure.resourcemanager.security.models.SecurityTask; +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); + + private final TasksClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public TasksImpl(TasksClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getResourceGroupLevelTaskWithResponse(String resourceGroupName, String ascLocation, + String taskName, Context context) { + Response inner = this.serviceClient() + .getResourceGroupLevelTaskWithResponse(resourceGroupName, ascLocation, taskName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityTaskImpl(inner.getValue(), this.manager())); + } + + public SecurityTask getResourceGroupLevelTask(String resourceGroupName, String ascLocation, String taskName) { + SecurityTaskInner inner + = this.serviceClient().getResourceGroupLevelTask(resourceGroupName, ascLocation, taskName); + if (inner != null) { + return new SecurityTaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, ascLocation); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String ascLocation, String filter, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, ascLocation, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public Response updateResourceGroupLevelTaskStateWithResponse(String resourceGroupName, String ascLocation, + String taskName, TaskUpdateActionType taskUpdateActionType, Context context) { + return this.serviceClient() + .updateResourceGroupLevelTaskStateWithResponse(resourceGroupName, ascLocation, taskName, + taskUpdateActionType, context); + } + + public void updateResourceGroupLevelTaskState(String resourceGroupName, String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType) { + this.serviceClient() + .updateResourceGroupLevelTaskState(resourceGroupName, ascLocation, taskName, taskUpdateActionType); + } + + public Response getSubscriptionLevelTaskWithResponse(String ascLocation, String taskName, + Context context) { + Response inner + = this.serviceClient().getSubscriptionLevelTaskWithResponse(ascLocation, taskName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityTaskImpl(inner.getValue(), this.manager())); + } + + public SecurityTask getSubscriptionLevelTask(String ascLocation, String taskName) { + SecurityTaskInner inner = this.serviceClient().getSubscriptionLevelTask(ascLocation, taskName); + if (inner != null) { + return new SecurityTaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByHomeRegion(String ascLocation) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public PagedIterable listByHomeRegion(String ascLocation, String filter, Context context) { + PagedIterable inner = this.serviceClient().listByHomeRegion(ascLocation, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public Response updateSubscriptionLevelTaskStateWithResponse(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType, Context context) { + return this.serviceClient() + .updateSubscriptionLevelTaskStateWithResponse(ascLocation, taskName, taskUpdateActionType, context); + } + + public void updateSubscriptionLevelTaskState(String ascLocation, String taskName, + TaskUpdateActionType taskUpdateActionType) { + this.serviceClient().updateSubscriptionLevelTaskState(ascLocation, taskName, taskUpdateActionType); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityTaskImpl(inner1, this.manager())); + } + + private TasksClient 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/TopologiesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java index 6c47435cd68d..dc0df91a3fc4 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.TopologiesClient; import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; -import com.azure.resourcemanager.security.models.TopologyList; +import com.azure.resourcemanager.security.implementation.models.TopologyList; import reactor.core.publisher.Mono; /** @@ -59,61 +59,66 @@ public final class TopologiesClientImpl implements TopologiesClient { * The interface defining all the services for SecurityCenterTopologies to be used by the proxy service to perform * REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterTopolo") + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterTopologies") public interface TopologiesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @PathParam("topologyResourceName") String topologyResourceName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegion(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> listByHomeRegion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, - @PathParam("topologyResourceName") String topologyResourceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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); + Mono> listByHomeRegionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByHomeRegionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Gets a list that allows to build a topology view of a subscription. + * Gets a specific topology component. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 that allows to build a topology view of a subscription along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return a specific topology component along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> getWithResponseAsync(String resourceGroupName, String ascLocation, + String topologyResourceName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -122,28 +127,41 @@ private Mono> listSinglePageAsync() { 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (topologyResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter topologyResourceName 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, - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, topologyResourceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets a list that allows to build a topology view of a subscription. + * Gets a specific topology component. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. * @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 that allows to build a topology view of a subscription along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return a specific topology component along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> getWithResponseAsync(String resourceGroupName, String ascLocation, + String topologyResourceName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -152,69 +170,77 @@ private Mono> listSinglePageAsync(Context c 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 (ascLocation == null) { + return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (topologyResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter topologyResourceName 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, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, + ascLocation, topologyResourceName, accept, context); } /** - * Gets a list that allows to build a topology view of a subscription. + * Gets a specific topology component. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 that allows to build a topology view of a subscription as paginated response with - * {@link PagedFlux}. + * @return a specific topology component on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String ascLocation, + String topologyResourceName) { + return getWithResponseAsync(resourceGroupName, ascLocation, topologyResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Gets a list that allows to build a topology view of a subscription. + * Gets a specific topology component. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. * @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 that allows to build a topology view of a subscription as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets a list that allows to build a topology view of a 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 that allows to build a topology view of a subscription as paginated response with - * {@link PagedIterable}. + * @return a specific topology component along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String ascLocation, + String topologyResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, ascLocation, topologyResourceName, context).block(); } /** - * Gets a list that allows to build a topology view of a subscription. + * Gets a specific topology component. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param topologyResourceName Name of a topology resources collection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 that allows to build a topology view of a subscription as paginated response with - * {@link PagedIterable}. + * @return a specific topology component. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public TopologyResourceInner get(String resourceGroupName, String ascLocation, String topologyResourceName) { + return getWithResponse(resourceGroupName, ascLocation, topologyResourceName, Context.NONE).getValue(); } /** @@ -244,8 +270,8 @@ private Mono> listByHomeRegionSinglePageAsy final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), - ascLocation, apiVersion, accept, context)) + .withContext(context -> service.listByHomeRegion(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, 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())); @@ -281,7 +307,7 @@ private Mono> listByHomeRegionSinglePageAsy final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByHomeRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, apiVersion, + .listByHomeRegion(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); @@ -356,21 +382,15 @@ public PagedIterable listByHomeRegion(String ascLocation, } /** - * Gets a specific topology component. + * Gets a list that allows to build a topology view of a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param topologyResourceName Name of a topology resources collection. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 topology component along with {@link Response} on successful completion of {@link Mono}. + * @return a list that allows to build a topology view of a subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String ascLocation, - String topologyResourceName) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -379,42 +399,28 @@ private Mono> getWithResponseAsync(String resour 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (topologyResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter topologyResourceName 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, ascLocation, topologyResourceName, apiVersion, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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 specific topology component. + * Gets a list that allows to build a topology view of a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param topologyResourceName Name of a topology resources collection. * @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 topology component along with {@link Response} on successful completion of {@link Mono}. + * @return a list that allows to build a topology view of a subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String ascLocation, - String topologyResourceName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -423,80 +429,69 @@ private Mono> getWithResponseAsync(String resour 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 (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (topologyResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter topologyResourceName 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, ascLocation, - topologyResourceName, apiVersion, accept, context); + return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Gets a specific topology component. + * Gets a list that allows to build a topology view of a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param topologyResourceName Name of a topology resources collection. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 topology component on successful completion of {@link Mono}. + * @return a list that allows to build a topology view of a subscription as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String ascLocation, - String topologyResourceName) { - return getWithResponseAsync(resourceGroupName, ascLocation, topologyResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Gets a specific topology component. + * Gets a list that allows to build a topology view of a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param topologyResourceName Name of a topology resources collection. * @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 topology component along with {@link Response}. + * @return a list that allows to build a topology view of a subscription as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String ascLocation, - String topologyResourceName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, topologyResourceName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Gets a specific topology component. + * Gets a list that allows to build a topology view of a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param topologyResourceName Name of a topology resources collection. + * @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 that allows to build a topology view of a subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list that allows to build a topology view of a subscription. + * + * @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 topology component. + * @return a list that allows to build a topology view of a subscription as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopologyResourceInner get(String resourceGroupName, String ascLocation, String topologyResourceName) { - return getWithResponse(resourceGroupName, ascLocation, topologyResourceName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** @@ -506,10 +501,11 @@ public TopologyResourceInner get(String resourceGroupName, String ascLocation, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list that allows to build a topology view of a subscription and location along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -518,7 +514,8 @@ private Mono> listNextSinglePageAsync(Strin 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)) + return FluxUtil + .withContext(context -> service.listByHomeRegionNext(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())); @@ -532,10 +529,12 @@ private Mono> listNextSinglePageAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list that allows to build a topology view of a subscription and location along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, + Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -545,7 +544,7 @@ private Mono> listNextSinglePageAsync(Strin } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -557,10 +556,11 @@ private Mono> listNextSinglePageAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list that allows to build a topology view of a subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -569,8 +569,7 @@ private Mono> listByHomeRegionNextSinglePag new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, context)) + 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())); @@ -584,11 +583,11 @@ private Mono> listByHomeRegionNextSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 PagedResponse} on successful completion of {@link Mono}. + * @return a list that allows to build a topology view of a subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, - Context context) { + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -598,7 +597,7 @@ private Mono> listByHomeRegionNextSinglePag } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByHomeRegionNext(nextLink, this.client.getEndpoint(), accept, 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/TopologiesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesImpl.java index 368bedb9ddc8..2f1714b9b58f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; @@ -27,14 +27,21 @@ public TopologiesImpl(TopologiesClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); + public Response getWithResponse(String resourceGroupName, String ascLocation, + String topologyResourceName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, ascLocation, topologyResourceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TopologyResourceImpl(inner.getValue(), this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); + public TopologyResource get(String resourceGroupName, String ascLocation, String topologyResourceName) { + TopologyResourceInner inner = this.serviceClient().get(resourceGroupName, ascLocation, topologyResourceName); + if (inner != null) { + return new TopologyResourceImpl(inner, this.manager()); + } else { + return null; + } } public PagedIterable listByHomeRegion(String ascLocation) { @@ -47,25 +54,14 @@ public PagedIterable listByHomeRegion(String ascLocation, Cont return ResourceManagerUtils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); } - public Response getWithResponse(String resourceGroupName, String ascLocation, - String topologyResourceName, Context context) { - Response inner - = this.serviceClient().getWithResponse(resourceGroupName, ascLocation, topologyResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new TopologyResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); } - public TopologyResource get(String resourceGroupName, String ascLocation, String topologyResourceName) { - TopologyResourceInner inner = this.serviceClient().get(resourceGroupName, ascLocation, topologyResourceName); - if (inner != null) { - return new TopologyResourceImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopologyResourceImpl(inner1, this.manager())); } private TopologiesClient serviceClient() { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologyResourceImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologyResourceImpl.java index 33b2c36fb716..28d7d9720b4f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologyResourceImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologyResourceImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; import com.azure.resourcemanager.security.models.TopologyResource; import com.azure.resourcemanager.security.models.TopologySingleResource; @@ -38,6 +39,10 @@ public String location() { return this.innerModel().location(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public OffsetDateTime calculatedDateTime() { return this.innerModel().calculatedDateTime(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingImpl.java new file mode 100644 index 000000000000..71401d2b3550 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.WorkspaceSettingInner; +import com.azure.resourcemanager.security.models.WorkspaceSetting; + +public final class WorkspaceSettingImpl + implements WorkspaceSetting, WorkspaceSetting.Definition, WorkspaceSetting.Update { + private WorkspaceSettingInner 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 workspaceId() { + return this.innerModel().workspaceId(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public WorkspaceSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String workspaceSettingName; + + public WorkspaceSetting create() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceSettings() + .createWithResponse(workspaceSettingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceSetting create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceSettings() + .createWithResponse(workspaceSettingName, this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceSettingImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new WorkspaceSettingInner(); + this.serviceManager = serviceManager; + this.workspaceSettingName = name; + } + + public WorkspaceSettingImpl update() { + return this; + } + + public WorkspaceSetting apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceSettings() + .updateWithResponse(workspaceSettingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceSetting apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceSettings() + .updateWithResponse(workspaceSettingName, this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceSettingImpl(WorkspaceSettingInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.workspaceSettingName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaceSettings"); + } + + public WorkspaceSetting refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceSettings() + .getWithResponse(workspaceSettingName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceSetting refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceSettings() + .getWithResponse(workspaceSettingName, context) + .getValue(); + return this; + } + + public WorkspaceSettingImpl withWorkspaceId(String workspaceId) { + this.innerModel().withWorkspaceId(workspaceId); + return this; + } + + public WorkspaceSettingImpl withScope(String scope) { + this.innerModel().withScope(scope); + return this; + } +} 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 new file mode 100644 index 000000000000..ce096fb68c5b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java @@ -0,0 +1,766 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.WorkspaceSettingsClient; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; +import com.azure.resourcemanager.security.implementation.models.WorkspaceSettingList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceSettingsClient. + */ +public final class WorkspaceSettingsClientImpl implements WorkspaceSettingsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspaceSettingsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of WorkspaceSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceSettingsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(WorkspaceSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterWorkspaceSettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SecurityCenterWorkspaceSettings") + public interface WorkspaceSettingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, Context context); + + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workspaceSettingName) { + 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + workspaceSettingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workspaceSettingName, 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), workspaceSettingName, + accept, context); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String workspaceSettingName) { + return getWithResponseAsync(workspaceSettingName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String workspaceSettingName, Context context) { + return getWithResponseAsync(workspaceSettingName, context).block(); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceSettingInner get(String workspaceSettingName) { + return getWithResponse(workspaceSettingName, Context.NONE).getValue(); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting) { + 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), workspaceSettingName, contentType, accept, workspaceSetting, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting, 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + workspaceSettingName, contentType, accept, workspaceSetting, context); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting) { + return createWithResponseAsync(workspaceSettingName, workspaceSetting) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting, Context context) { + return createWithResponseAsync(workspaceSettingName, workspaceSetting, context).block(); + } + + /** + * creating settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceSettingInner create(String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + return createWithResponse(workspaceSettingName, workspaceSetting, Context.NONE).getValue(); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting) { + 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), workspaceSettingName, contentType, accept, workspaceSetting, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting, 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + workspaceSettingName, contentType, accept, workspaceSetting, context); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting) { + return updateWithResponseAsync(workspaceSettingName, workspaceSetting) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @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 configures where to store the OMS agent data for workspaces under a scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String workspaceSettingName, + WorkspaceSettingInner workspaceSetting, Context context) { + return updateWithResponseAsync(workspaceSettingName, workspaceSetting, context).block(); + } + + /** + * Settings about where we should store your security data and logs. + * + * @param workspaceSettingName Name of the security setting. + * @param workspaceSetting Security data setting object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 configures where to store the OMS agent data for workspaces under a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceSettingInner update(String workspaceSettingName, WorkspaceSettingInner workspaceSetting) { + return updateWithResponse(workspaceSettingName, workspaceSetting, Context.NONE).getValue(); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceSettingName) { + 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), workspaceSettingName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @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 workspaceSettingName, 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 (workspaceSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + workspaceSettingName, context); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceSettingName) { + return deleteWithResponseAsync(workspaceSettingName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @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 workspaceSettingName, Context context) { + return deleteWithResponseAsync(workspaceSettingName, context).block(); + } + + /** + * Deletes the custom workspace settings for this subscription. new VMs will report to the default workspace. + * + * @param workspaceSettingName Name of the security setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceSettingName) { + deleteWithResponse(workspaceSettingName, Context.NONE); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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 = "2017-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + 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())); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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 = "2017-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) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Settings about where we should store your security data and logs. If the result is empty, it means that no + * custom-workspace configuration was set. + * + * @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 workspace settings response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 list of workspace settings response 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 workspace settings response 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/WorkspaceSettingsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsImpl.java new file mode 100644 index 000000000000..9cbe9f253866 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsImpl.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.WorkspaceSettingsClient; +import com.azure.resourcemanager.security.fluent.models.WorkspaceSettingInner; +import com.azure.resourcemanager.security.models.WorkspaceSetting; +import com.azure.resourcemanager.security.models.WorkspaceSettings; + +public final class WorkspaceSettingsImpl implements WorkspaceSettings { + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceSettingsImpl.class); + + private final WorkspaceSettingsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public WorkspaceSettingsImpl(WorkspaceSettingsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String workspaceSettingName, Context context) { + Response inner = this.serviceClient().getWithResponse(workspaceSettingName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceSettingImpl(inner.getValue(), this.manager())); + } + + public WorkspaceSetting get(String workspaceSettingName) { + WorkspaceSettingInner inner = this.serviceClient().get(workspaceSettingName); + if (inner != null) { + return new WorkspaceSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String workspaceSettingName, Context context) { + return this.serviceClient().deleteWithResponse(workspaceSettingName, context); + } + + public void delete(String workspaceSettingName) { + this.serviceClient().delete(workspaceSettingName); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceSettingImpl(inner1, this.manager())); + } + + public WorkspaceSetting getById(String id) { + String workspaceSettingName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + return this.getWithResponse(workspaceSettingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String workspaceSettingName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + return this.getWithResponse(workspaceSettingName, context); + } + + public void deleteById(String id) { + String workspaceSettingName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + this.deleteWithResponse(workspaceSettingName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String workspaceSettingName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceSettings"); + if (workspaceSettingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaceSettings'.", id))); + } + return this.deleteWithResponse(workspaceSettingName, context); + } + + private WorkspaceSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public WorkspaceSettingImpl define(String name) { + return new WorkspaceSettingImpl(name, this.manager()); + } +} 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/implementation/models/AlertList.java similarity index 79% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AlertList.java index 67541f5bea5a..8f516f2b3a04 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/implementation/models/AlertList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,26 +16,26 @@ /** * List of security alerts. */ -@Fluent +@Immutable public final class AlertList implements JsonSerializable { /* - * describes security alert properties. + * The Alert items on this page */ private List value; /* - * The URI to fetch the next page. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of AlertList class. */ - public AlertList() { + private AlertList() { } /** - * Get the value property: describes security alert properties. + * Get the value property: The Alert items on this page. * * @return the value value. */ @@ -44,18 +44,7 @@ public List value() { } /** - * Set the value property: describes security alert properties. - * - * @param value the value value to set. - * @return the AlertList object itself. - */ - public AlertList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -81,6 +70,7 @@ public void validate() { 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(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AlertsSuppressionRulesList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AlertsSuppressionRulesList.java new file mode 100644 index 000000000000..7252c4f5e6ab --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AlertsSuppressionRulesList.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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 java.io.IOException; +import java.util.List; + +/** + * Suppression rules list for subscription. + */ +@Immutable +public final class AlertsSuppressionRulesList implements JsonSerializable { + /* + * The AlertsSuppressionRule items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of AlertsSuppressionRulesList class. + */ + private AlertsSuppressionRulesList() { + } + + /** + * Get the value property: The AlertsSuppressionRule items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model AlertsSuppressionRulesList")); + } else { + value().forEach(e -> e.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)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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/implementation/models/AllowedConnectionsList.java similarity index 94% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AllowedConnectionsList.java index 856df5411a66..68e929a67fe8 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/implementation/models/AllowedConnectionsList.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -31,7 +31,7 @@ public final class AllowedConnectionsList implements JsonSerializable { + /* + * Collection of applications in this page + */ + private List value; + + /* + * The URI to fetch the next page + */ + private String nextLink; + + /** + * Creates an instance of ApplicationsList class. + */ + private ApplicationsList() { + } + + /** + * Get the value property: Collection of applications in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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(); + 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/implementation/models/AscLocationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AscLocationList.java new file mode 100644 index 000000000000..8217c94f0eed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AscLocationList.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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 java.io.IOException; +import java.util.List; + +/** + * List of locations where ASC saves your data. + */ +@Immutable +public final class AscLocationList implements JsonSerializable { + /* + * List of locations + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of AscLocationList class. + */ + private AscLocationList() { + } + + /** + * Get the value property: List of locations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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(); + 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/implementation/models/AssignmentList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AssignmentList.java new file mode 100644 index 000000000000..030df10ee48d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AssignmentList.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.AssignmentInner; +import java.io.IOException; +import java.util.List; + +/** + * Page of a standard assignment list. + */ +@Immutable +public final class AssignmentList implements JsonSerializable { + /* + * Collection of standardAssignments in this page + */ + private List value; + + /* + * The URI to fetch the next page + */ + private String nextLink; + + /** + * Creates an instance of AssignmentList class. + */ + private AssignmentList() { + } + + /** + * Get the value property: Collection of standardAssignments in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignmentList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignmentList 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 AssignmentList. + */ + public static AssignmentList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignmentList deserializedAssignmentList = new AssignmentList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AssignmentInner.fromJson(reader1)); + deserializedAssignmentList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAssignmentList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignmentList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AutoProvisioningSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AutoProvisioningSettingList.java new file mode 100644 index 000000000000..9733fbf9f7fa --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AutoProvisioningSettingList.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.AutoProvisioningSettingInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the auto provisioning settings response. + */ +@Immutable +public final class AutoProvisioningSettingList implements JsonSerializable { + /* + * List of all the auto provisioning settings + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of AutoProvisioningSettingList class. + */ + private AutoProvisioningSettingList() { + } + + /** + * Get the value property: List of all the auto provisioning settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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)); + 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/implementation/models/AutomationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AutomationList.java new file mode 100644 index 000000000000..2fc5e0b8672a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AutomationList.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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 java.io.IOException; +import java.util.List; + +/** + * List of security automations response. + */ +@Immutable +public final class AutomationList implements JsonSerializable { + /* + * The Automation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of AutomationList class. + */ + private AutomationList() { + } + + /** + * Get the value property: The Automation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model AutomationList")); + } else { + value().forEach(e -> e.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)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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/implementation/models/AzureDevOpsProjectListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AzureDevOpsProjectListResponse.java new file mode 100644 index 000000000000..de21b3805bc9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AzureDevOpsProjectListResponse.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.AzureDevOpsProjectInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class AzureDevOpsProjectListResponse implements JsonSerializable { + /* + * The AzureDevOpsProject items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of AzureDevOpsProjectListResponse class. + */ + private AzureDevOpsProjectListResponse() { + } + + /** + * Get the value property: The AzureDevOpsProject items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 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/implementation/models/AzureDevOpsRepositoryListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AzureDevOpsRepositoryListResponse.java new file mode 100644 index 000000000000..ee1c3d7b149c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/AzureDevOpsRepositoryListResponse.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.AzureDevOpsRepositoryInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class AzureDevOpsRepositoryListResponse implements JsonSerializable { + /* + * The AzureDevOpsRepository items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of AzureDevOpsRepositoryListResponse class. + */ + private AzureDevOpsRepositoryListResponse() { + } + + /** + * Get the value property: The AzureDevOpsRepository items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 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/implementation/models/ComplianceList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ComplianceList.java new file mode 100644 index 000000000000..ae2b4dc6bf93 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ComplianceList.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.ComplianceInner; +import java.io.IOException; +import java.util.List; + +/** + * List of Compliance objects response. + */ +@Immutable +public final class ComplianceList implements JsonSerializable { + /* + * List of Compliance objects + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of ComplianceList class. + */ + private ComplianceList() { + } + + /** + * Get the value property: List of Compliance objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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(); + 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/implementation/models/ComplianceResultList.java similarity index 82% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ComplianceResultList.java index 1b57193054db..9deacc17b132 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/implementation/models/ComplianceResultList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,26 +17,26 @@ /** * List of compliance results response. */ -@Fluent +@Immutable public final class ComplianceResultList implements JsonSerializable { /* - * List of compliance results + * The ComplianceResult items on this page */ private List value; /* - * The URI to fetch the next page. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of ComplianceResultList class. */ - public ComplianceResultList() { + private ComplianceResultList() { } /** - * Get the value property: List of compliance results. + * Get the value property: The ComplianceResult items on this page. * * @return the value value. */ @@ -45,18 +45,7 @@ public List value() { } /** - * Set the value property: List of compliance results. - * - * @param value the value value to set. - * @return the ComplianceResultList object itself. - */ - public ComplianceResultList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -87,6 +76,7 @@ public void validate() { 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(); } 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/implementation/models/CustomRecommendationsList.java similarity index 85% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendationsList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/CustomRecommendationsList.java index a418a799f9a7..2e2c815ea40c 100644 --- 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/implementation/models/CustomRecommendationsList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * A list of Custom Recommendations. */ -@Fluent +@Immutable public final class CustomRecommendationsList implements JsonSerializable { /* * Collection of Custom Recommendations @@ -31,7 +31,7 @@ public final class CustomRecommendationsList implements JsonSerializable { + /* + * List of Defender for Storage settings. + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of DefenderForStorageSettingList class. + */ + private DefenderForStorageSettingList() { + } + + /** + * Get the value property: List of Defender for Storage settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 DefenderForStorageSettingList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForStorageSettingList 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 DefenderForStorageSettingList. + */ + public static DefenderForStorageSettingList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForStorageSettingList deserializedDefenderForStorageSettingList + = new DefenderForStorageSettingList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DefenderForStorageSettingInner.fromJson(reader1)); + deserializedDefenderForStorageSettingList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDefenderForStorageSettingList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForStorageSettingList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/DevOpsConfigurationListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/DevOpsConfigurationListResponse.java new file mode 100644 index 000000000000..838228e281a8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/DevOpsConfigurationListResponse.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.DevOpsConfigurationInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class DevOpsConfigurationListResponse implements JsonSerializable { + /* + * The DevOpsConfiguration items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of DevOpsConfigurationListResponse class. + */ + private DevOpsConfigurationListResponse() { + } + + /** + * Get the value property: The DevOpsConfiguration items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 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/DeviceSecurityGroupList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/DeviceSecurityGroupList.java similarity index 85% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/DeviceSecurityGroupList.java index ba1035de43ff..730a35231c7c 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/implementation/models/DeviceSecurityGroupList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * List of device security groups. */ -@Fluent +@Immutable public final class DeviceSecurityGroupList implements JsonSerializable { /* * List of device security group objects @@ -31,7 +31,7 @@ public final class DeviceSecurityGroupList implements JsonSerializable value() { return this.value; } - /** - * Set the value property: List of device security group objects. - * - * @param value the value value to set. - * @return the DeviceSecurityGroupList object itself. - */ - public DeviceSecurityGroupList withValue(List value) { - this.value = value; - return this; - } - /** * Get the nextLink property: The URI to fetch the next page. * 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/implementation/models/DiscoveredSecuritySolutionList.java similarity index 85% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/DiscoveredSecuritySolutionList.java index a78d169ddc63..d47ba4379339 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/implementation/models/DiscoveredSecuritySolutionList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * The DiscoveredSecuritySolutionList model. */ -@Fluent +@Immutable public final class DiscoveredSecuritySolutionList implements JsonSerializable { /* * The value property. @@ -31,7 +31,7 @@ public final class DiscoveredSecuritySolutionList implements JsonSerializable value() { return this.value; } - /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the DiscoveredSecuritySolutionList object itself. - */ - public DiscoveredSecuritySolutionList withValue(List value) { - this.value = value; - return this; - } - /** * Get the nextLink property: The URI to fetch the next page. * 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/implementation/models/ExternalSecuritySolutionList.java similarity index 82% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ExternalSecuritySolutionList.java index d0a9f510e379..6055b33d9802 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/implementation/models/ExternalSecuritySolutionList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * The ExternalSecuritySolutionList model. */ -@Fluent +@Immutable public final class ExternalSecuritySolutionList implements JsonSerializable { /* * The value property. @@ -24,14 +24,14 @@ public final class ExternalSecuritySolutionList implements JsonSerializable value; /* - * The URI to fetch the next page. + * The nextLink property. */ private String nextLink; /** * Creates an instance of ExternalSecuritySolutionList class. */ - public ExternalSecuritySolutionList() { + private ExternalSecuritySolutionList() { } /** @@ -44,18 +44,7 @@ public List value() { } /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the ExternalSecuritySolutionList object itself. - */ - public ExternalSecuritySolutionList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The nextLink property. * * @return the nextLink value. */ diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GitHubRepositoryListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GitHubRepositoryListResponse.java new file mode 100644 index 000000000000..16a64dd083be --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GitHubRepositoryListResponse.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.GitHubRepositoryInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class GitHubRepositoryListResponse implements JsonSerializable { + /* + * The GitHubRepository items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of GitHubRepositoryListResponse class. + */ + private GitHubRepositoryListResponse() { + } + + /** + * Get the value property: The GitHubRepository items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 GitHubRepositoryListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubRepositoryListResponse 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 GitHubRepositoryListResponse. + */ + public static GitHubRepositoryListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubRepositoryListResponse deserializedGitHubRepositoryListResponse = new GitHubRepositoryListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GitHubRepositoryInner.fromJson(reader1)); + deserializedGitHubRepositoryListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGitHubRepositoryListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubRepositoryListResponse; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GitLabProjectListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GitLabProjectListResponse.java new file mode 100644 index 000000000000..92d7e1c4b4fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GitLabProjectListResponse.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.GitLabProjectInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Immutable +public final class GitLabProjectListResponse implements JsonSerializable { + /* + * The GitLabProject items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of GitLabProjectListResponse class. + */ + private GitLabProjectListResponse() { + } + + /** + * Get the value property: The GitLabProject items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 GitLabProjectListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitLabProjectListResponse 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 GitLabProjectListResponse. + */ + public static GitLabProjectListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitLabProjectListResponse deserializedGitLabProjectListResponse = new GitLabProjectListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> GitLabProjectInner.fromJson(reader1)); + deserializedGitLabProjectListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGitLabProjectListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGitLabProjectListResponse; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GovernanceAssignmentsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GovernanceAssignmentsList.java new file mode 100644 index 000000000000..0843d3cb6d9d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GovernanceAssignmentsList.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.GovernanceAssignmentInner; +import java.io.IOException; +import java.util.List; + +/** + * Page of a governance assignments list. + */ +@Immutable +public final class GovernanceAssignmentsList implements JsonSerializable { + /* + * Collection of governance assignments in this page + */ + private List value; + + /* + * The URI to fetch the next page + */ + private String nextLink; + + /** + * Creates an instance of GovernanceAssignmentsList class. + */ + private GovernanceAssignmentsList() { + } + + /** + * Get the value property: Collection of governance assignments in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 GovernanceAssignmentsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GovernanceAssignmentsList 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 GovernanceAssignmentsList. + */ + public static GovernanceAssignmentsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GovernanceAssignmentsList deserializedGovernanceAssignmentsList = new GovernanceAssignmentsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GovernanceAssignmentInner.fromJson(reader1)); + deserializedGovernanceAssignmentsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGovernanceAssignmentsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGovernanceAssignmentsList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GovernanceRuleList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GovernanceRuleList.java new file mode 100644 index 000000000000..f801528ee6c7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/GovernanceRuleList.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.GovernanceRuleInner; +import java.io.IOException; +import java.util.List; + +/** + * Page of a governance rules list. + */ +@Immutable +public final class GovernanceRuleList implements JsonSerializable { + /* + * Collection of governance rules in this page + */ + private List value; + + /* + * The URI to fetch the next page + */ + private String nextLink; + + /** + * Creates an instance of GovernanceRuleList class. + */ + private GovernanceRuleList() { + } + + /** + * Get the value property: Collection of governance rules in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 GovernanceRuleList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GovernanceRuleList 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 GovernanceRuleList. + */ + public static GovernanceRuleList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GovernanceRuleList deserializedGovernanceRuleList = new GovernanceRuleList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GovernanceRuleInner.fromJson(reader1)); + deserializedGovernanceRuleList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGovernanceRuleList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGovernanceRuleList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/HealthReportsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/HealthReportsList.java new file mode 100644 index 000000000000..d07338172e4a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/HealthReportsList.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.HealthReportInner; +import java.io.IOException; +import java.util.List; + +/** + * Page of health reports list. + */ +@Immutable +public final class HealthReportsList implements JsonSerializable { + /* + * The HealthReport items on this page. + */ + private List value; + + /* + * The link to the next page of items. + */ + private String nextLink; + + /** + * Creates an instance of HealthReportsList class. + */ + private HealthReportsList() { + } + + /** + * Get the value property: The HealthReport items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 HealthReportsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HealthReportsList 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 HealthReportsList. + */ + public static HealthReportsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HealthReportsList deserializedHealthReportsList = new HealthReportsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> HealthReportInner.fromJson(reader1)); + deserializedHealthReportsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedHealthReportsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHealthReportsList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/InformationProtectionPolicyList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/InformationProtectionPolicyList.java new file mode 100644 index 000000000000..3098ba9a94fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/InformationProtectionPolicyList.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.InformationProtectionPolicyInner; +import java.io.IOException; +import java.util.List; + +/** + * Information protection policies response. + */ +@Immutable +public final class InformationProtectionPolicyList implements JsonSerializable { + /* + * List of information protection policies + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of InformationProtectionPolicyList class. + */ + private InformationProtectionPolicyList() { + } + + /** + * Get the value property: List of information protection policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InformationProtectionPolicyList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InformationProtectionPolicyList 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 InformationProtectionPolicyList. + */ + public static InformationProtectionPolicyList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InformationProtectionPolicyList deserializedInformationProtectionPolicyList + = new InformationProtectionPolicyList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> InformationProtectionPolicyInner.fromJson(reader1)); + deserializedInformationProtectionPolicyList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedInformationProtectionPolicyList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInformationProtectionPolicyList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecurityAggregatedAlertList.java similarity index 80% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecurityAggregatedAlertList.java index f536eaa28fe7..e119034e7902 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedAlertList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecurityAggregatedAlertList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,26 +17,26 @@ /** * List of IoT Security solution aggregated alert data. */ -@Fluent +@Immutable public final class IoTSecurityAggregatedAlertList implements JsonSerializable { /* - * List of aggregated alerts data. + * The IoTSecurityAggregatedAlert items on this page */ private List value; /* - * When there is too much alert data for one page, use this URI to fetch the next page. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of IoTSecurityAggregatedAlertList class. */ - public IoTSecurityAggregatedAlertList() { + private IoTSecurityAggregatedAlertList() { } /** - * Get the value property: List of aggregated alerts data. + * Get the value property: The IoTSecurityAggregatedAlert items on this page. * * @return the value value. */ @@ -45,18 +45,7 @@ public List value() { } /** - * Set the value property: List of aggregated alerts data. - * - * @param value the value value to set. - * @return the IoTSecurityAggregatedAlertList object itself. - */ - public IoTSecurityAggregatedAlertList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: When there is too much alert data for one page, use this URI to fetch the next page. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -88,6 +77,7 @@ public void validate() { 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(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecurityAggregatedRecommendationList.java similarity index 80% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendationList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecurityAggregatedRecommendationList.java index ec5eccc6a8d2..79fcc61790d7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecurityAggregatedRecommendationList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecurityAggregatedRecommendationList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,27 +17,27 @@ /** * List of IoT Security solution aggregated recommendations. */ -@Fluent +@Immutable public final class IoTSecurityAggregatedRecommendationList implements JsonSerializable { /* - * List of aggregated recommendations data. + * The IoTSecurityAggregatedRecommendation items on this page */ private List value; /* - * When there is too much alert data for one page, use this URI to fetch the next page. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of IoTSecurityAggregatedRecommendationList class. */ - public IoTSecurityAggregatedRecommendationList() { + private IoTSecurityAggregatedRecommendationList() { } /** - * Get the value property: List of aggregated recommendations data. + * Get the value property: The IoTSecurityAggregatedRecommendation items on this page. * * @return the value value. */ @@ -46,18 +46,7 @@ public List value() { } /** - * Set the value property: List of aggregated recommendations data. - * - * @param value the value value to set. - * @return the IoTSecurityAggregatedRecommendationList object itself. - */ - public IoTSecurityAggregatedRecommendationList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: When there is too much alert data for one page, use this URI to fetch the next page. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -89,6 +78,7 @@ public void validate() { 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(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecuritySolutionsList.java similarity index 82% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionsList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecuritySolutionsList.java index 2dcb3fedb98c..f5ff66a5adcc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/IoTSecuritySolutionsList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/IoTSecuritySolutionsList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,26 +17,26 @@ /** * List of IoT Security solutions. */ -@Fluent +@Immutable public final class IoTSecuritySolutionsList implements JsonSerializable { /* - * List of IoT Security solutions + * The IoTSecuritySolutionModel items on this page */ private List value; /* - * The URI to fetch the next page. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of IoTSecuritySolutionsList class. */ - public IoTSecuritySolutionsList() { + private IoTSecuritySolutionsList() { } /** - * Get the value property: List of IoT Security solutions. + * Get the value property: The IoTSecuritySolutionModel items on this page. * * @return the value value. */ @@ -45,18 +45,7 @@ public List value() { } /** - * Set the value property: List of IoT Security solutions. - * - * @param value the value value to set. - * @return the IoTSecuritySolutionsList object itself. - */ - public IoTSecuritySolutionsList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -87,6 +76,7 @@ public void validate() { 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(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPoliciesList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/JitNetworkAccessPoliciesList.java similarity index 82% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPoliciesList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/JitNetworkAccessPoliciesList.java index 5cac14ff5ba1..394a912f7b8b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JitNetworkAccessPoliciesList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/JitNetworkAccessPoliciesList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * The JitNetworkAccessPoliciesList model. */ -@Fluent +@Immutable public final class JitNetworkAccessPoliciesList implements JsonSerializable { /* * The value property. @@ -24,14 +24,14 @@ public final class JitNetworkAccessPoliciesList implements JsonSerializable value; /* - * The URI to fetch the next page. + * The nextLink property. */ private String nextLink; /** * Creates an instance of JitNetworkAccessPoliciesList class. */ - public JitNetworkAccessPoliciesList() { + private JitNetworkAccessPoliciesList() { } /** @@ -44,18 +44,7 @@ public List value() { } /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the JitNetworkAccessPoliciesList object itself. - */ - public JitNetworkAccessPoliciesList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The nextLink property. * * @return the nextLink value. */ diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/OperationListResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..54133dac7c75 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@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 OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult 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 OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateEndpointConnectionListResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..332a14e62fb2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.PrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PrivateEndpointConnection list operation. + */ +@Immutable +public final class PrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * The PrivateEndpointConnection items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PrivateEndpointConnectionListResult class. + */ + private PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: The PrivateEndpointConnection items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model PrivateEndpointConnectionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /** + * {@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 PrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionListResult 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 PrivateEndpointConnectionListResult. + */ + public static PrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionListResult deserializedPrivateEndpointConnectionListResult + = new PrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedPrivateEndpointConnectionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateEndpointConnectionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionListResult; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateLinkGroupResourceListResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateLinkGroupResourceListResult.java new file mode 100644 index 000000000000..0aeded1bdc3c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateLinkGroupResourceListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.PrivateLinkGroupResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PrivateLinkGroupResource list operation. + */ +@Immutable +public final class PrivateLinkGroupResourceListResult implements JsonSerializable { + /* + * The PrivateLinkGroupResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PrivateLinkGroupResourceListResult class. + */ + private PrivateLinkGroupResourceListResult() { + } + + /** + * Get the value property: The PrivateLinkGroupResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model PrivateLinkGroupResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkGroupResourceListResult.class); + + /** + * {@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 PrivateLinkGroupResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkGroupResourceListResult 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 PrivateLinkGroupResourceListResult. + */ + public static PrivateLinkGroupResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkGroupResourceListResult deserializedPrivateLinkGroupResourceListResult + = new PrivateLinkGroupResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkGroupResourceInner.fromJson(reader1)); + deserializedPrivateLinkGroupResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateLinkGroupResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkGroupResourceListResult; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateLinksList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateLinksList.java new file mode 100644 index 000000000000..69709d563dc4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/PrivateLinksList.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.PrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * Paginated list of private link resources. Contains an array of private links and optional pagination information. + */ +@Immutable +public final class PrivateLinksList implements JsonSerializable { + /* + * The PrivateLinkResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PrivateLinksList class. + */ + private PrivateLinksList() { + } + + /** + * Get the value property: The PrivateLinkResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 PrivateLinksList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinksList 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 PrivateLinksList. + */ + public static PrivateLinksList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinksList deserializedPrivateLinksList = new PrivateLinksList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResourceInner.fromJson(reader1)); + deserializedPrivateLinksList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateLinksList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinksList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceAssessmentList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceAssessmentList.java new file mode 100644 index 000000000000..c4ced636e783 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceAssessmentList.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.RegulatoryComplianceAssessmentInner; +import java.io.IOException; +import java.util.List; + +/** + * List of regulatory compliance assessment response. + */ +@Immutable +public final class RegulatoryComplianceAssessmentList implements JsonSerializable { + /* + * The RegulatoryComplianceAssessment items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of RegulatoryComplianceAssessmentList class. + */ + private RegulatoryComplianceAssessmentList() { + } + + /** + * Get the value property: The RegulatoryComplianceAssessment items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model RegulatoryComplianceAssessmentList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceAssessmentList.class); + + /** + * {@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 RegulatoryComplianceAssessmentList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceAssessmentList 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 RegulatoryComplianceAssessmentList. + */ + public static RegulatoryComplianceAssessmentList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceAssessmentList deserializedRegulatoryComplianceAssessmentList + = new RegulatoryComplianceAssessmentList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RegulatoryComplianceAssessmentInner.fromJson(reader1)); + deserializedRegulatoryComplianceAssessmentList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceAssessmentList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceControlList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceControlList.java new file mode 100644 index 000000000000..808c3c165586 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceControlList.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.RegulatoryComplianceControlInner; +import java.io.IOException; +import java.util.List; + +/** + * List of regulatory compliance controls response. + */ +@Immutable +public final class RegulatoryComplianceControlList implements JsonSerializable { + /* + * The RegulatoryComplianceControl items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of RegulatoryComplianceControlList class. + */ + private RegulatoryComplianceControlList() { + } + + /** + * Get the value property: The RegulatoryComplianceControl items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model RegulatoryComplianceControlList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceControlList.class); + + /** + * {@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 RegulatoryComplianceControlList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceControlList 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 RegulatoryComplianceControlList. + */ + public static RegulatoryComplianceControlList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceControlList deserializedRegulatoryComplianceControlList + = new RegulatoryComplianceControlList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RegulatoryComplianceControlInner.fromJson(reader1)); + deserializedRegulatoryComplianceControlList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRegulatoryComplianceControlList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceControlList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceStandardList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceStandardList.java new file mode 100644 index 000000000000..44bd46cd266f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/RegulatoryComplianceStandardList.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.RegulatoryComplianceStandardInner; +import java.io.IOException; +import java.util.List; + +/** + * List of regulatory compliance standards response. + */ +@Immutable +public final class RegulatoryComplianceStandardList implements JsonSerializable { + /* + * The RegulatoryComplianceStandard items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of RegulatoryComplianceStandardList class. + */ + private RegulatoryComplianceStandardList() { + } + + /** + * Get the value property: The RegulatoryComplianceStandard items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model RegulatoryComplianceStandardList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceStandardList.class); + + /** + * {@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 RegulatoryComplianceStandardList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceStandardList 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 RegulatoryComplianceStandardList. + */ + public static RegulatoryComplianceStandardList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceStandardList deserializedRegulatoryComplianceStandardList + = new RegulatoryComplianceStandardList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RegulatoryComplianceStandardInner.fromJson(reader1)); + deserializedRegulatoryComplianceStandardList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRegulatoryComplianceStandardList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceStandardList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ScanResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ScanResults.java new file mode 100644 index 000000000000..bf07a050cc4b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ScanResults.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.ScanResultInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of vulnerability assessment scan results. + */ +@Immutable +public final class ScanResults implements JsonSerializable { + /* + * List of vulnerability assessment scan results. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of ScanResults class. + */ + private ScanResults() { + } + + /** + * Get the value property: List of vulnerability assessment scan results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 ScanResults from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanResults 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 ScanResults. + */ + public static ScanResults fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanResults deserializedScanResults = new ScanResults(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ScanResultInner.fromJson(reader1)); + deserializedScanResults.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedScanResults.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedScanResults; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ScansV2.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ScansV2.java new file mode 100644 index 000000000000..e5d959d4f8c3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ScansV2.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.ScanV2Inner; +import java.io.IOException; +import java.util.List; + +/** + * A list of vulnerability assessment scan records. + */ +@Immutable +public final class ScansV2 implements JsonSerializable { + /* + * List of vulnerability assessment scan records. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of ScansV2 class. + */ + private ScansV2() { + } + + /** + * Get the value property: List of vulnerability assessment scan records. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 ScansV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScansV2 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 ScansV2. + */ + public static ScansV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScansV2 deserializedScansV2 = new ScansV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ScanV2Inner.fromJson(reader1)); + deserializedScansV2.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedScansV2.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedScansV2; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecureScoreControlDefinitionList.java similarity index 86% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecureScoreControlDefinitionList.java index 66130545f1db..e2724a9d12e1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlDefinitionList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecureScoreControlDefinitionList.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -19,23 +19,23 @@ @Immutable public final class SecureScoreControlDefinitionList implements JsonSerializable { /* - * Collection of security controls definition in this page + * Collection of security control definitions. */ private List value; /* - * The URI to fetch the next page. + * The URL to get the next page of results. */ private String nextLink; /** * Creates an instance of SecureScoreControlDefinitionList class. */ - public SecureScoreControlDefinitionList() { + private SecureScoreControlDefinitionList() { } /** - * Get the value property: Collection of security controls definition in this page. + * Get the value property: Collection of security control definitions. * * @return the value value. */ @@ -44,7 +44,7 @@ public List value() { } /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The URL to get the next page of results. * * @return the nextLink value. */ @@ -69,6 +69,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecureScoreControlList.java similarity index 93% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecureScoreControlList.java index cf2fdc9b247e..ba3066a34957 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecureScoreControlList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecureScoreControlList.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -31,7 +31,7 @@ public final class SecureScoreControlList implements JsonSerializable { + /* + * The SecurityConnector items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SecurityConnectorsList class. + */ + private SecurityConnectorsList() { + } + + /** + * Get the value property: The SecurityConnector items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SecurityConnectorsList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityConnectorsList.class); + + /** + * {@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 SecurityConnectorsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityConnectorsList 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 SecurityConnectorsList. + */ + public static SecurityConnectorsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityConnectorsList deserializedSecurityConnectorsList = new SecurityConnectorsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SecurityConnectorInner.fromJson(reader1)); + deserializedSecurityConnectorsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSecurityConnectorsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityConnectorsList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityContactList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityContactList.java new file mode 100644 index 000000000000..4dc3f74e4ddb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityContactList.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.SecurityContactInner; +import java.io.IOException; +import java.util.List; + +/** + * List of security contacts response. + */ +@Immutable +public final class SecurityContactList implements JsonSerializable { + /* + * The SecurityContact items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SecurityContactList class. + */ + private SecurityContactList() { + } + + /** + * Get the value property: The SecurityContact items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SecurityContactList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityContactList.class); + + /** + * {@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 SecurityContactList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityContactList 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 SecurityContactList. + */ + public static SecurityContactList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityContactList deserializedSecurityContactList = new SecurityContactList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SecurityContactInner.fromJson(reader1)); + deserializedSecurityContactList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSecurityContactList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityContactList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityOperatorList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityOperatorList.java new file mode 100644 index 000000000000..50d932525d9c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityOperatorList.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.SecurityOperatorInner; +import java.io.IOException; +import java.util.List; + +/** + * List of SecurityOperator response. + */ +@Immutable +public final class SecurityOperatorList implements JsonSerializable { + /* + * List of SecurityOperator configurations + */ + private List value; + + /** + * Creates an instance of SecurityOperatorList class. + */ + private SecurityOperatorList() { + } + + /** + * Get the value property: List of SecurityOperator configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SecurityOperatorList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityOperatorList.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 SecurityOperatorList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityOperatorList 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 SecurityOperatorList. + */ + public static SecurityOperatorList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityOperatorList deserializedSecurityOperatorList = new SecurityOperatorList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SecurityOperatorInner.fromJson(reader1)); + deserializedSecurityOperatorList.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityOperatorList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecuritySolutionList.java similarity index 83% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecuritySolutionList.java index 733d97c0bf15..070a23d37f65 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecuritySolutionList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecuritySolutionList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * The SecuritySolutionList model. */ -@Fluent +@Immutable public final class SecuritySolutionList implements JsonSerializable { /* * The value property. @@ -24,14 +24,14 @@ public final class SecuritySolutionList implements JsonSerializable value; /* - * The URI to fetch the next page. + * The nextLink property. */ private String nextLink; /** * Creates an instance of SecuritySolutionList class. */ - public SecuritySolutionList() { + private SecuritySolutionList() { } /** @@ -44,18 +44,7 @@ public List value() { } /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the SecuritySolutionList object itself. - */ - public SecuritySolutionList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The nextLink property. * * @return the nextLink value. */ diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityStandardList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityStandardList.java similarity index 95% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityStandardList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityStandardList.java index 50e04d217291..0fa9d2815282 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityStandardList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityStandardList.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -31,7 +31,7 @@ public final class SecurityStandardList implements JsonSerializable { + /* + * List of security sub-assessments + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of SecuritySubAssessmentList class. + */ + private SecuritySubAssessmentList() { + } + + /** + * Get the value property: List of security sub-assessments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuritySubAssessmentList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySubAssessmentList 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 SecuritySubAssessmentList. + */ + public static SecuritySubAssessmentList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySubAssessmentList deserializedSecuritySubAssessmentList = new SecuritySubAssessmentList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SecuritySubAssessmentInner.fromJson(reader1)); + deserializedSecuritySubAssessmentList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSecuritySubAssessmentList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySubAssessmentList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityTaskList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityTaskList.java new file mode 100644 index 000000000000..4a6bd3cd2db3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SecurityTaskList.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.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.SecurityTaskInner; +import java.io.IOException; +import java.util.List; + +/** + * List of security task recommendations. + */ +@Immutable +public final class SecurityTaskList implements JsonSerializable { + /* + * The SecurityTask items on this page + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of SecurityTaskList class. + */ + private SecurityTaskList() { + } + + /** + * Get the value property: The SecurityTask items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityTaskList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityTaskList 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 SecurityTaskList. + */ + public static SecurityTaskList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityTaskList deserializedSecurityTaskList = new SecurityTaskList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SecurityTaskInner.fromJson(reader1)); + deserializedSecurityTaskList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSecurityTaskList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityTaskList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentsSettingsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ServerVulnerabilityAssessmentsSettingsList.java similarity index 86% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentsSettingsList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ServerVulnerabilityAssessmentsSettingsList.java index 7503bab33025..c369483e8d38 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ServerVulnerabilityAssessmentsSettingsList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/ServerVulnerabilityAssessmentsSettingsList.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -20,23 +20,23 @@ public final class ServerVulnerabilityAssessmentsSettingsList implements JsonSerializable { /* - * A collection of server vulnerability assessments settings in this page + * The ServerVulnerabilityAssessmentsSetting items on this page. */ private List value; /* - * The URI to fetch the next page + * The link to the next page of items. */ private String nextLink; /** * Creates an instance of ServerVulnerabilityAssessmentsSettingsList class. */ - public ServerVulnerabilityAssessmentsSettingsList() { + private ServerVulnerabilityAssessmentsSettingsList() { } /** - * Get the value property: A collection of server vulnerability assessments settings in this page. + * Get the value property: The ServerVulnerabilityAssessmentsSetting items on this page. * * @return the value value. */ @@ -45,7 +45,7 @@ public List value() { } /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -70,6 +70,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SettingsList.java similarity index 86% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SettingsList.java index 3068e91b37c4..4dc7ff7c1715 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SettingsList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/SettingsList.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * Subscription settings list. */ -@Fluent +@Immutable public final class SettingsList implements JsonSerializable { /* * The settings list. @@ -31,7 +31,7 @@ public final class SettingsList implements JsonSerializable { /** * Creates an instance of SettingsList class. */ - public SettingsList() { + private SettingsList() { } /** @@ -43,17 +43,6 @@ public List value() { return this.value; } - /** - * Set the value property: The settings list. - * - * @param value the value value to set. - * @return the SettingsList object itself. - */ - public SettingsList withValue(List value) { - this.value = value; - return this; - } - /** * Get the nextLink property: The URI to fetch the next page. * @@ -81,6 +70,7 @@ public void validate() { 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(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignmentsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/StandardAssignmentsList.java similarity index 95% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignmentsList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/StandardAssignmentsList.java index d702e4d8e776..32826a0fb6cf 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignmentsList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/StandardAssignmentsList.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -31,7 +31,7 @@ public final class StandardAssignmentsList implements JsonSerializable { + /* + * Collection of standards in this page + */ + private List value; + + /* + * The URI to fetch the next page + */ + private String nextLink; + + /** + * Creates an instance of StandardList class. + */ + private StandardList() { + } + + /** + * Get the value property: Collection of standards in this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI to fetch the next page. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StandardList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StandardList 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 StandardList. + */ + public static StandardList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StandardList deserializedStandardList = new StandardList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> StandardInner.fromJson(reader1)); + deserializedStandardList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedStandardList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStandardList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/TopologyList.java similarity index 92% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyList.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/TopologyList.java index 41812f0fed13..72828820501f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TopologyList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/TopologyList.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.security.models; +package com.azure.resourcemanager.security.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -24,14 +24,14 @@ public final class TopologyList implements JsonSerializable { private List value; /* - * The URI to fetch the next page. + * The nextLink property. */ private String nextLink; /** * Creates an instance of TopologyList class. */ - public TopologyList() { + private TopologyList() { } /** @@ -44,7 +44,7 @@ public List value() { } /** - * Get the nextLink property: The URI to fetch the next page. + * Get the nextLink property: The nextLink property. * * @return the nextLink value. */ diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/WorkspaceSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/WorkspaceSettingList.java new file mode 100644 index 000000000000..ae7959619984 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/models/WorkspaceSettingList.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.implementation.models; + +import com.azure.core.annotation.Immutable; +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.WorkspaceSettingInner; +import java.io.IOException; +import java.util.List; + +/** + * List of workspace settings response. + */ +@Immutable +public final class WorkspaceSettingList implements JsonSerializable { + /* + * The WorkspaceSetting items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of WorkspaceSettingList class. + */ + private WorkspaceSettingList() { + } + + /** + * Get the value property: The WorkspaceSetting items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model WorkspaceSettingList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceSettingList.class); + + /** + * {@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 WorkspaceSettingList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceSettingList 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 WorkspaceSettingList. + */ + public static WorkspaceSettingList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceSettingList deserializedWorkspaceSettingList = new WorkspaceSettingList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkspaceSettingInner.fromJson(reader1)); + deserializedWorkspaceSettingList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspaceSettingList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceSettingList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/package-info.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/package-info.java index 25e2d88d9864..121b88bb290f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/package-info.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the implementations for SecurityCenter. - * API spec for Microsoft.Security (Azure Security Center) resource provider. + * Package containing the implementations for Security. + * API spec for Microsoft.Security (Azure Security Center) alerts resource provider. */ package com.azure.resourcemanager.security.implementation; 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 9a554de0f695..4d1ffa9ecccf 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,17 +12,17 @@ */ public final class AadConnectivityState extends ExpandableStringEnum { /** - * Static value Discovered for AadConnectivityState. + * Discovered. */ public static final AadConnectivityState DISCOVERED = fromString("Discovered"); /** - * Static value NotLicensed for AadConnectivityState. + * NotLicensed. */ public static final AadConnectivityState NOT_LICENSED = fromString("NotLicensed"); /** - * Static value Connected for AadConnectivityState. + * Connected. */ public static final AadConnectivityState CONNECTED = fromString("Connected"); 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 deleted file mode 100644 index 713dcac7eb43..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateAutoGenerated.java +++ /dev/null @@ -1,96 +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.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 implements JsonSerializable { - /* - * The connectivity state of the external AAD solution - */ - private AadConnectivityState connectivityState; - - /** - * Creates an instance of AadConnectivityStateAutoGenerated class. - */ - public AadConnectivityStateAutoGenerated() { - } - - /** - * Get the connectivityState property: The connectivity state of the external AAD solution. - * - * @return the connectivityState value. - */ - public AadConnectivityState connectivityState() { - return this.connectivityState; - } - - /** - * Set the connectivityState property: The connectivity state of the external AAD solution. - * - * @param connectivityState the connectivityState value to set. - * @return the AadConnectivityStateAutoGenerated object itself. - */ - public AadConnectivityStateAutoGenerated withConnectivityState(AadConnectivityState connectivityState) { - this.connectivityState = connectivityState; - 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("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 2de9ac7b3f0f..34f05e9ad366 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 @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -14,7 +15,7 @@ /** * Represents an AAD identity protection solution which sends logs to an OMS workspace. */ -@Fluent +@Immutable public final class AadExternalSecuritySolution extends ExternalSecuritySolutionInner { /* * The kind of the external solution @@ -26,6 +27,11 @@ public final class AadExternalSecuritySolution extends ExternalSecuritySolutionI */ private AadSolutionProperties properties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * Location where the resource is stored */ @@ -49,7 +55,7 @@ public final class AadExternalSecuritySolution extends ExternalSecuritySolutionI /** * Creates an instance of AadExternalSecuritySolution class. */ - public AadExternalSecuritySolution() { + private AadExternalSecuritySolution() { } /** @@ -67,19 +73,19 @@ public ExternalSecuritySolutionKind kind() { * * @return the properties value. */ + @Override public AadSolutionProperties properties() { return this.properties; } /** - * Set the properties property: The external security solution properties for AAD solutions. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param properties the properties value to set. - * @return the AadExternalSecuritySolution object itself. + * @return the systemData value. */ - public AadExternalSecuritySolution withProperties(AadSolutionProperties properties) { - this.properties = properties; - return this; + @Override + public SystemData systemData() { + return this.systemData; } /** @@ -169,6 +175,8 @@ public static AadExternalSecuritySolution fromJson(JsonReader jsonReader) throws deserializedAadExternalSecuritySolution.type = reader.getString(); } else if ("location".equals(fieldName)) { deserializedAadExternalSecuritySolution.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAadExternalSecuritySolution.systemData = SystemData.fromJson(reader); } else if ("kind".equals(fieldName)) { deserializedAadExternalSecuritySolution.kind = ExternalSecuritySolutionKind.fromString(reader.getString()); 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 5ce006a885a0..295881ce7644 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -15,17 +15,37 @@ /** * The external security solution properties for AAD solutions. */ -@Fluent +@Immutable public final class AadSolutionProperties extends ExternalSecuritySolutionProperties { /* * The connectivity state of the external AAD solution */ private AadConnectivityState connectivityState; + /* + * The solution properties (correspond to the solution kind) + */ + private Map additionalProperties; + + /* + * Represents an OMS workspace to which the solution is connected + */ + private ConnectedWorkspace workspace; + + /* + * The deviceType property. + */ + private String deviceType; + + /* + * The deviceVendor property. + */ + private String deviceVendor; + /** * Creates an instance of AadSolutionProperties class. */ - public AadSolutionProperties() { + private AadSolutionProperties() { } /** @@ -38,41 +58,43 @@ public AadConnectivityState connectivityState() { } /** - * Set the connectivityState property: The connectivity state of the external AAD solution. + * Get the additionalProperties property: The solution properties (correspond to the solution kind). * - * @param connectivityState the connectivityState value to set. - * @return the AadSolutionProperties object itself. + * @return the additionalProperties value. */ - public AadSolutionProperties withConnectivityState(AadConnectivityState connectivityState) { - this.connectivityState = connectivityState; - return this; + @Override + public Map additionalProperties() { + return this.additionalProperties; } /** - * {@inheritDoc} + * Get the workspace property: Represents an OMS workspace to which the solution is connected. + * + * @return the workspace value. */ @Override - public AadSolutionProperties withDeviceVendor(String deviceVendor) { - super.withDeviceVendor(deviceVendor); - return this; + public ConnectedWorkspace workspace() { + return this.workspace; } /** - * {@inheritDoc} + * Get the deviceType property: The deviceType property. + * + * @return the deviceType value. */ @Override - public AadSolutionProperties withDeviceType(String deviceType) { - super.withDeviceType(deviceType); - return this; + public String deviceType() { + return this.deviceType; } /** - * {@inheritDoc} + * Get the deviceVendor property: The deviceVendor property. + * + * @return the deviceVendor value. */ @Override - public AadSolutionProperties withWorkspace(ConnectedWorkspace workspace) { - super.withWorkspace(workspace); - return this; + public String deviceVendor() { + return this.deviceVendor; } /** @@ -123,11 +145,11 @@ public static AadSolutionProperties fromJson(JsonReader jsonReader) throws IOExc reader.nextToken(); if ("deviceVendor".equals(fieldName)) { - deserializedAadSolutionProperties.withDeviceVendor(reader.getString()); + deserializedAadSolutionProperties.deviceVendor = reader.getString(); } else if ("deviceType".equals(fieldName)) { - deserializedAadSolutionProperties.withDeviceType(reader.getString()); + deserializedAadSolutionProperties.deviceType = reader.getString(); } else if ("workspace".equals(fieldName)) { - deserializedAadSolutionProperties.withWorkspace(ConnectedWorkspace.fromJson(reader)); + deserializedAadSolutionProperties.workspace = ConnectedWorkspace.fromJson(reader); } else if ("connectivityState".equals(fieldName)) { deserializedAadSolutionProperties.connectivityState = AadConnectivityState.fromString(reader.getString()); @@ -139,7 +161,7 @@ public static AadSolutionProperties fromJson(JsonReader jsonReader) throws IOExc additionalProperties.put(fieldName, reader.readUntyped()); } } - deserializedAadSolutionProperties.withAdditionalProperties(additionalProperties); + deserializedAadSolutionProperties.additionalProperties = 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..f498b355d274 --- /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) TypeSpec 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.ACCESS_TOKEN; + + /* + * 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 new file mode 100644 index 000000000000..4d67f6904b89 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * LogicApp. + */ + public static final ActionType LOGIC_APP = fromString("LogicApp"); + + /** + * EventHub. + */ + public static final ActionType EVENT_HUB = fromString("EventHub"); + + /** + * Workspace. + */ + public static final ActionType WORKSPACE = fromString("Workspace"); + + /** + * Internal. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(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 new file mode 100644 index 000000000000..724b6b25a5f6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediation.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * Configuration payload for PR Annotations. + */ +@Fluent +public final class ActionableRemediation implements JsonSerializable { + /* + * ActionableRemediation Setting. + * None - the setting was never set. + * Enabled - ActionableRemediation is enabled. + * Disabled - ActionableRemediation is disabled. + */ + private ActionableRemediationState state; + + /* + * Gets or sets list of categories and severity levels. + */ + private List categoryConfigurations; + + /* + * Repository branch configuration for PR Annotations. + */ + private TargetBranchConfiguration branchConfiguration; + + /* + * Update Settings. + * + * Enabled - Resource should inherit configurations from parent. + * Disabled - Resource should not inherit configurations from parent. + */ + private InheritFromParentState inheritFromParentState; + + /** + * Creates an instance of ActionableRemediation class. + */ + public ActionableRemediation() { + } + + /** + * Get the state property: ActionableRemediation Setting. + * None - the setting was never set. + * Enabled - ActionableRemediation is enabled. + * Disabled - ActionableRemediation is disabled. + * + * @return the state value. + */ + public ActionableRemediationState state() { + return this.state; + } + + /** + * Set the state property: ActionableRemediation Setting. + * None - the setting was never set. + * Enabled - ActionableRemediation is enabled. + * Disabled - ActionableRemediation is disabled. + * + * @param state the state value to set. + * @return the ActionableRemediation object itself. + */ + public ActionableRemediation withState(ActionableRemediationState state) { + this.state = state; + return this; + } + + /** + * Get the categoryConfigurations property: Gets or sets list of categories and severity levels. + * + * @return the categoryConfigurations value. + */ + public List categoryConfigurations() { + return this.categoryConfigurations; + } + + /** + * Set the categoryConfigurations property: Gets or sets list of categories and severity levels. + * + * @param categoryConfigurations the categoryConfigurations value to set. + * @return the ActionableRemediation object itself. + */ + public ActionableRemediation withCategoryConfigurations(List categoryConfigurations) { + this.categoryConfigurations = categoryConfigurations; + return this; + } + + /** + * Get the branchConfiguration property: Repository branch configuration for PR Annotations. + * + * @return the branchConfiguration value. + */ + public TargetBranchConfiguration branchConfiguration() { + return this.branchConfiguration; + } + + /** + * Set the branchConfiguration property: Repository branch configuration for PR Annotations. + * + * @param branchConfiguration the branchConfiguration value to set. + * @return the ActionableRemediation object itself. + */ + public ActionableRemediation withBranchConfiguration(TargetBranchConfiguration branchConfiguration) { + this.branchConfiguration = branchConfiguration; + return this; + } + + /** + * Get the inheritFromParentState property: Update Settings. + * + * Enabled - Resource should inherit configurations from parent. + * Disabled - Resource should not inherit configurations from parent. + * + * @return the inheritFromParentState value. + */ + public InheritFromParentState inheritFromParentState() { + return this.inheritFromParentState; + } + + /** + * Set the inheritFromParentState property: Update Settings. + * + * Enabled - Resource should inherit configurations from parent. + * Disabled - Resource should not inherit configurations from parent. + * + * @param inheritFromParentState the inheritFromParentState value to set. + * @return the ActionableRemediation object itself. + */ + public ActionableRemediation withInheritFromParentState(InheritFromParentState inheritFromParentState) { + this.inheritFromParentState = inheritFromParentState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (categoryConfigurations() != null) { + categoryConfigurations().forEach(e -> e.validate()); + } + if (branchConfiguration() != null) { + 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 new file mode 100644 index 000000000000..5cdf3beb56b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediationState.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * ActionableRemediation Setting. + * None - the setting was never set. + * Enabled - ActionableRemediation is enabled. + * Disabled - ActionableRemediation is disabled. + */ +public final class ActionableRemediationState extends ExpandableStringEnum { + /** + * None. + */ + public static final ActionableRemediationState NONE = fromString("None"); + + /** + * Disabled. + */ + public static final ActionableRemediationState DISABLED = fromString("Disabled"); + + /** + * Enabled. + */ + public static final ActionableRemediationState ENABLED = fromString("Enabled"); + + /** + * Creates a new instance of ActionableRemediationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionableRemediationState() { + } + + /** + * Creates or finds a ActionableRemediationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionableRemediationState. + */ + public static ActionableRemediationState fromString(String name) { + return fromString(name, ActionableRemediationState.class); + } + + /** + * Gets known ActionableRemediationState values. + * + * @return known ActionableRemediationState values. + */ + public static Collection values() { + return values(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 deleted file mode 100644 index 265dc5d3c004..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.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.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.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * Number of active connections is not in allowed range. - */ -@Fluent -public final class ActiveConnectionsNotInAllowedRange extends TimeWindowCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "ActiveConnectionsNotInAllowedRange"; - - /** - * Creates an instance of ActiveConnectionsNotInAllowedRange class. - */ - public ActiveConnectionsNotInAllowedRange() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public ActiveConnectionsNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { - super.withTimeWindowSize(timeWindowSize); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActiveConnectionsNotInAllowedRange withMinThreshold(int minThreshold) { - super.withMinThreshold(minThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActiveConnectionsNotInAllowedRange withMaxThreshold(int maxThreshold) { - super.withMaxThreshold(maxThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActiveConnectionsNotInAllowedRange withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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/AdditionalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java new file mode 100644 index 000000000000..c276f3b1bf08 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Details of the sub-assessment. + */ +@Immutable +public class AdditionalData implements JsonSerializable { + /* + * Sub-assessment resource type + */ + private AssessedResourceType assessedResourceType = AssessedResourceType.fromString("AdditionalData"); + + /** + * Creates an instance of AdditionalData class. + */ + protected AdditionalData() { + } + + /** + * Get the assessedResourceType property: Sub-assessment resource type. + * + * @return the assessedResourceType value. + */ + public AssessedResourceType assessedResourceType() { + return this.assessedResourceType; + } + + /** + * 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("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 41cc4fa41f22..5f2e523fe5fd 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,12 +12,12 @@ */ public final class AdditionalWorkspaceDataType extends ExpandableStringEnum { /** - * Static value Alerts for AdditionalWorkspaceDataType. + * Alerts. */ public static final AdditionalWorkspaceDataType ALERTS = fromString("Alerts"); /** - * Static value RawEvents for AdditionalWorkspaceDataType. + * RawEvents. */ public static final AdditionalWorkspaceDataType RAW_EVENTS = fromString("RawEvents"); 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 c5b5efcdfb25..a022f9dddfb4 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,7 +12,7 @@ */ public final class AdditionalWorkspaceType extends ExpandableStringEnum { /** - * Static value Sentinel for AdditionalWorkspaceType. + * Sentinel. */ public static final AdditionalWorkspaceType SENTINEL = fromString("Sentinel"); 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 b8926f47de49..403267d404ca 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtectionSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtectionSetting.java index c88829d32009..1cce0b2655bd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtectionSetting.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtectionSetting.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.AdvancedThreatProtectionSettingInner; @@ -32,6 +33,13 @@ public interface AdvancedThreatProtectionSetting { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the isEnabled property: Indicates whether Advanced Threat Protection is enabled. * @@ -69,7 +77,7 @@ interface WithScope { /** * Specifies resourceId. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @return the next definition stage. */ WithCreate withExistingResourceId(String resourceId); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtections.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtections.java index 866d2c47998e..0129d924ff79 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtections.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdvancedThreatProtections.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -14,7 +14,7 @@ public interface AdvancedThreatProtections { /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. @@ -26,7 +26,7 @@ public interface AdvancedThreatProtections { /** * Gets the Advanced Threat Protection settings for the specified resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier 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. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AgentlessConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AgentlessConfiguration.java new file mode 100644 index 000000000000..886250ccc647 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AgentlessConfiguration.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * Details about Agentless configuration. + */ +@Fluent +public final class AgentlessConfiguration implements JsonSerializable { + /* + * Agentless Enablement states. + */ + private AgentlessEnablement agentlessEnabled; + + /* + * AutoDiscovery states. + */ + private AutoDiscovery agentlessAutoDiscovery; + + /* + * Gets or sets the scanners for the connector. + */ + private List scanners; + + /* + * Types for inventory list. + */ + private InventoryListKind inventoryListType; + + /* + * Gets or sets the inventory list for inclusion or exclusion from Agentless. + * Will be ignored if agentless auto-discovery is enabled. + */ + private List inventoryList; + + /** + * Creates an instance of AgentlessConfiguration class. + */ + public AgentlessConfiguration() { + } + + /** + * Get the agentlessEnabled property: Agentless Enablement states. + * + * @return the agentlessEnabled value. + */ + public AgentlessEnablement agentlessEnabled() { + return this.agentlessEnabled; + } + + /** + * Set the agentlessEnabled property: Agentless Enablement states. + * + * @param agentlessEnabled the agentlessEnabled value to set. + * @return the AgentlessConfiguration object itself. + */ + public AgentlessConfiguration withAgentlessEnabled(AgentlessEnablement agentlessEnabled) { + this.agentlessEnabled = agentlessEnabled; + return this; + } + + /** + * Get the agentlessAutoDiscovery property: AutoDiscovery states. + * + * @return the agentlessAutoDiscovery value. + */ + public AutoDiscovery agentlessAutoDiscovery() { + return this.agentlessAutoDiscovery; + } + + /** + * Set the agentlessAutoDiscovery property: AutoDiscovery states. + * + * @param agentlessAutoDiscovery the agentlessAutoDiscovery value to set. + * @return the AgentlessConfiguration object itself. + */ + public AgentlessConfiguration withAgentlessAutoDiscovery(AutoDiscovery agentlessAutoDiscovery) { + this.agentlessAutoDiscovery = agentlessAutoDiscovery; + return this; + } + + /** + * Get the scanners property: Gets or sets the scanners for the connector. + * + * @return the scanners value. + */ + public List scanners() { + return this.scanners; + } + + /** + * Set the scanners property: Gets or sets the scanners for the connector. + * + * @param scanners the scanners value to set. + * @return the AgentlessConfiguration object itself. + */ + public AgentlessConfiguration withScanners(List scanners) { + this.scanners = scanners; + return this; + } + + /** + * Get the inventoryListType property: Types for inventory list. + * + * @return the inventoryListType value. + */ + public InventoryListKind inventoryListType() { + return this.inventoryListType; + } + + /** + * Set the inventoryListType property: Types for inventory list. + * + * @param inventoryListType the inventoryListType value to set. + * @return the AgentlessConfiguration object itself. + */ + public AgentlessConfiguration withInventoryListType(InventoryListKind inventoryListType) { + this.inventoryListType = inventoryListType; + return this; + } + + /** + * Get the inventoryList property: Gets or sets the inventory list for inclusion or exclusion from Agentless. + * Will be ignored if agentless auto-discovery is enabled. + * + * @return the inventoryList value. + */ + public List inventoryList() { + return this.inventoryList; + } + + /** + * Set the inventoryList property: Gets or sets the inventory list for inclusion or exclusion from Agentless. + * Will be ignored if agentless auto-discovery is enabled. + * + * @param inventoryList the inventoryList value to set. + * @return the AgentlessConfiguration object itself. + */ + public AgentlessConfiguration withInventoryList(List inventoryList) { + this.inventoryList = inventoryList; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (inventoryList() != null) { + inventoryList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("agentlessEnabled", + this.agentlessEnabled == null ? null : this.agentlessEnabled.toString()); + jsonWriter.writeStringField("agentlessAutoDiscovery", + this.agentlessAutoDiscovery == null ? null : this.agentlessAutoDiscovery.toString()); + jsonWriter.writeArrayField("scanners", this.scanners, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("inventoryListType", + this.inventoryListType == null ? null : this.inventoryListType.toString()); + jsonWriter.writeArrayField("inventoryList", this.inventoryList, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentlessConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentlessConfiguration 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 AgentlessConfiguration. + */ + public static AgentlessConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentlessConfiguration deserializedAgentlessConfiguration = new AgentlessConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("agentlessEnabled".equals(fieldName)) { + deserializedAgentlessConfiguration.agentlessEnabled + = AgentlessEnablement.fromString(reader.getString()); + } else if ("agentlessAutoDiscovery".equals(fieldName)) { + deserializedAgentlessConfiguration.agentlessAutoDiscovery + = AutoDiscovery.fromString(reader.getString()); + } else if ("scanners".equals(fieldName)) { + List scanners = reader.readArray(reader1 -> reader1.getString()); + deserializedAgentlessConfiguration.scanners = scanners; + } else if ("inventoryListType".equals(fieldName)) { + deserializedAgentlessConfiguration.inventoryListType + = InventoryListKind.fromString(reader.getString()); + } else if ("inventoryList".equals(fieldName)) { + List inventoryList = reader.readArray(reader1 -> InventoryList.fromJson(reader1)); + deserializedAgentlessConfiguration.inventoryList = inventoryList; + } else { + reader.skipChildren(); + } + } + + return deserializedAgentlessConfiguration; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AgentlessEnablement.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AgentlessEnablement.java new file mode 100644 index 000000000000..ab8d0636cafd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AgentlessEnablement.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Agentless Enablement states. + */ +public final class AgentlessEnablement extends ExpandableStringEnum { + /** + * Disabled. + */ + public static final AgentlessEnablement DISABLED = fromString("Disabled"); + + /** + * Enabled. + */ + public static final AgentlessEnablement ENABLED = fromString("Enabled"); + + /** + * NotApplicable. + */ + public static final AgentlessEnablement NOT_APPLICABLE = fromString("NotApplicable"); + + /** + * Creates a new instance of AgentlessEnablement value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AgentlessEnablement() { + } + + /** + * Creates or finds a AgentlessEnablement from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgentlessEnablement. + */ + public static AgentlessEnablement fromString(String name) { + return fromString(name, AgentlessEnablement.class); + } + + /** + * Gets known AgentlessEnablement values. + * + * @return known AgentlessEnablement values. + */ + public static Collection values() { + return values(AgentlessEnablement.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alert.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alert.java index d38bb494c4d0..0bdaea204ea3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alert.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alert.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.AlertInner; import java.time.OffsetDateTime; import java.util.List; @@ -34,6 +35,13 @@ public interface Alert { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the version property: Schema version. * 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 229db8e7a399..15fb1a936462 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * Changing set of properties depending on the entity type. */ -@Fluent +@Immutable public final class AlertEntity implements JsonSerializable { /* * Type of entity @@ -31,7 +31,7 @@ public final class AlertEntity implements JsonSerializable { /** * Creates an instance of AlertEntity class. */ - public AlertEntity() { + private AlertEntity() { } /** @@ -52,17 +52,6 @@ public Map additionalProperties() { return this.additionalProperties; } - /** - * Set the additionalProperties property: Changing set of properties depending on the entity type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the AlertEntity object itself. - */ - public AlertEntity withAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - /** * Validates the instance. * 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 712934628221..86b63550ba9f 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * Changing set of properties depending on the supportingEvidence type. */ -@Fluent +@Immutable public final class AlertPropertiesSupportingEvidence implements JsonSerializable { /* * Type of the supportingEvidence @@ -31,7 +31,7 @@ public final class AlertPropertiesSupportingEvidence implements JsonSerializable /** * Creates an instance of AlertPropertiesSupportingEvidence class. */ - public AlertPropertiesSupportingEvidence() { + private AlertPropertiesSupportingEvidence() { } /** @@ -52,17 +52,6 @@ public Map additionalProperties() { return this.additionalProperties; } - /** - * Set the additionalProperties property: Changing set of properties depending on the supportingEvidence type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the AlertPropertiesSupportingEvidence object itself. - */ - public AlertPropertiesSupportingEvidence withAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - /** * Validates the instance. * 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 09b8357a5737..eef3de57f784 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,22 +13,22 @@ */ public final class AlertSeverity extends ExpandableStringEnum { /** - * Static value Informational for AlertSeverity. + * Informational. */ public static final AlertSeverity INFORMATIONAL = fromString("Informational"); /** - * Static value Low for AlertSeverity. + * Low. */ public static final AlertSeverity LOW = fromString("Low"); /** - * Static value Medium for AlertSeverity. + * Medium. */ public static final AlertSeverity MEDIUM = fromString("Medium"); /** - * Static value High for AlertSeverity. + * High. */ public static final AlertSeverity HIGH = fromString("High"); 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 633e332e8bf9..51945263cc59 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; 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 8cf26c9f2735..9267f6c529fb 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; 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 77524b693d6c..fb94f65cf46f 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; 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 bc572862ced7..1aca041ab922 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,22 +12,22 @@ */ public final class AlertStatus extends ExpandableStringEnum { /** - * Static value Active for AlertStatus. + * An alert which doesn't specify a value is assigned the status 'Active'. */ public static final AlertStatus ACTIVE = fromString("Active"); /** - * Static value InProgress for AlertStatus. + * An alert which is in handling state. */ public static final AlertStatus IN_PROGRESS = fromString("InProgress"); /** - * Static value Resolved for AlertStatus. + * Alert closed after handling. */ public static final AlertStatus RESOLVED = fromString("Resolved"); /** - * Static value Dismissed for AlertStatus. + * Alert dismissed as false positive. */ public static final AlertStatus DISMISSED = fromString("Dismissed"); 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 f6c775fdc51b..833907821069 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 @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. 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; @@ -27,6 +28,11 @@ public final class AlertSyncSettings extends SettingInner { */ private AlertSyncSettingProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -67,6 +73,16 @@ private AlertSyncSettingProperties 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. * @@ -97,6 +113,15 @@ public String id() { return this.id; } + /** + * {@inheritDoc} + */ + @Override + public AlertSyncSettings withProperties(SettingProperties properties) { + super.withProperties(properties); + return this; + } + /** * Get the enabled property: Is the alert sync setting enabled. * @@ -130,6 +155,9 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } + if (properties() != null) { + properties().validate(); + } } /** @@ -165,6 +193,8 @@ public static AlertSyncSettings fromJson(JsonReader jsonReader) throws IOExcepti deserializedAlertSyncSettings.name = reader.getString(); } else if ("type".equals(fieldName)) { deserializedAlertSyncSettings.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAlertSyncSettings.systemData = SystemData.fromJson(reader); } else if ("kind".equals(fieldName)) { deserializedAlertSyncSettings.kind = SettingKind.fromString(reader.getString()); } else if ("properties".equals(fieldName)) { diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alerts.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alerts.java index 5091d717a7a5..92cc9f92d941 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alerts.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Alerts.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,49 +13,31 @@ */ public interface Alerts { /** - * List all the alerts that are associated with 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 list of security alerts as paginated response with {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * List all the alerts that are associated with the subscription. + * Get an alert that is associated with a subscription. * + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. * @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 security alerts as paginated response with {@link PagedIterable}. - */ - PagedIterable list(Context context); - - /** - * List all the alerts that are associated with the resource group. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @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 security alerts as paginated response with {@link PagedIterable}. + * @return an alert that is associated with a subscription along with {@link Response}. */ - PagedIterable listByResourceGroup(String resourceGroupName); + Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context); /** - * List all the alerts that are associated with the resource group. + * Get an alert that is associated with a subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param context The context to associate with this operation. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param alertName Name of the alert object. * @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 security alerts as paginated response with {@link PagedIterable}. + * @return an alert that is associated with a subscription. */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + Alert getSubscriptionLevel(String ascLocation, String alertName); /** * List all the alerts that are associated with the subscription that are stored in a specific location. @@ -83,36 +65,7 @@ public interface Alerts { PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context); /** - * List all the alerts that are associated with the resource group that are stored in a specific location. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @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 security alerts as paginated response with {@link PagedIterable}. - */ - PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName); - - /** - * List all the alerts that are associated with the resource group that are stored in a specific location. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @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 security alerts as paginated response with {@link PagedIterable}. - */ - PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, Context context); - - /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -121,12 +74,13 @@ public interface Alerts { * @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 alert that is associated with a subscription along with {@link Response}. + * @return the {@link Response}. */ - Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context); + Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, + Context context); /** - * Get an alert that is associated with a subscription. + * Update the alert's state. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. @@ -134,15 +88,12 @@ public interface Alerts { * @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 alert that is associated with a subscription. */ - Alert getSubscriptionLevel(String ascLocation, String alertName); + void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName); /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -150,26 +101,22 @@ public interface Alerts { * @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 alert that is associated a resource group or a resource in a resource group along with - * {@link Response}. + * @return the {@link Response}. */ - Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, String alertName, + Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocation, String alertName, Context context); /** - * Get an alert that is associated a resource group or a resource in a resource group. + * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @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 alert that is associated a resource group or a resource in a resource group. */ - Alert getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName); + void updateSubscriptionLevelStateToResolve(String ascLocation, String alertName); /** * Update the alert's state. @@ -183,7 +130,7 @@ Response getResourceGroupLevelWithResponse(String resourceGroupName, Stri * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response}. */ - Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, + Response updateSubscriptionLevelStateToActivateWithResponse(String ascLocation, String alertName, Context context); /** @@ -196,7 +143,7 @@ Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocat * @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 updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName); + void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName); /** * Update the alert's state. @@ -210,7 +157,7 @@ Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocat * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response}. */ - Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocation, String alertName, + Response updateSubscriptionLevelStateToInProgressWithResponse(String ascLocation, String alertName, Context context); /** @@ -223,11 +170,12 @@ Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocat * @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 updateSubscriptionLevelStateToResolve(String ascLocation, String alertName); + void updateSubscriptionLevelStateToInProgress(String ascLocation, String alertName); /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -235,55 +183,57 @@ Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocat * @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}. + * @return an alert that is associated a resource group or a resource in a resource group along with + * {@link Response}. */ - Response updateSubscriptionLevelStateToActivateWithResponse(String ascLocation, String alertName, + Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context); /** - * Update the alert's state. + * Get an alert that is associated a resource group or a resource in a resource group. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. * @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 alert that is associated a resource group or a resource in a resource group. */ - void updateSubscriptionLevelStateToActivate(String ascLocation, String alertName); + Alert getResourceGroupLevel(String resourceGroupName, String ascLocation, String alertName); /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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}. + * @return list of security alerts as paginated response with {@link PagedIterable}. */ - Response updateSubscriptionLevelStateToInProgressWithResponse(String ascLocation, String alertName, - Context context); + PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName); /** - * Update the alert's state. + * List all the alerts that are associated with the resource group that are stored in a specific location. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertName Name of the alert object. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. */ - void updateSubscriptionLevelStateToInProgress(String ascLocation, String alertName); + PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, Context context); /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -299,8 +249,7 @@ Response updateResourceGroupLevelStateToResolveWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -313,8 +262,7 @@ Response updateResourceGroupLevelStateToResolveWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -330,8 +278,7 @@ Response updateResourceGroupLevelStateToDismissWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -344,8 +291,7 @@ Response updateResourceGroupLevelStateToDismissWithResponse(String resourc /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -361,8 +307,7 @@ Response updateResourceGroupLevelStateToActivateWithResponse(String resour /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -375,8 +320,7 @@ Response updateResourceGroupLevelStateToActivateWithResponse(String resour /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -392,8 +336,7 @@ Response updateResourceGroupLevelStateToInProgressWithResponse(String reso /** * Update the alert's state. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. * @param alertName Name of the alert object. @@ -403,12 +346,55 @@ Response updateResourceGroupLevelStateToInProgressWithResponse(String reso */ void updateResourceGroupLevelStateToInProgress(String resourceGroupName, String ascLocation, String alertName); + /** + * List all the alerts that are associated with 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 list of security alerts as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List all the alerts that are associated with the subscription. + * + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the alerts that are associated with the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security alerts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + /** * Simulate security alerts. * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. @@ -420,7 +406,7 @@ Response updateResourceGroupLevelStateToInProgressWithResponse(String reso * * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get * locations. - * @param alertSimulatorRequestBody Alert Simulator Request Properties. + * @param alertSimulatorRequestBody The request 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. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java new file mode 100644 index 000000000000..92a0eb72de62 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of AlertsSuppressionRule. + */ +public interface AlertsSuppressionRule { + /** + * 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 alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. + * + * @return the alertType value. + */ + String alertType(); + + /** + * Gets the lastModifiedUtc property: The last time this rule was modified. + * + * @return the lastModifiedUtc value. + */ + OffsetDateTime lastModifiedUtc(); + + /** + * Gets the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null + * there will no expiration at all. + * + * @return the expirationDateUtc value. + */ + OffsetDateTime expirationDateUtc(); + + /** + * Gets the reason property: The reason for dismissing the alert. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the state property: Possible states of the rule. + * + * @return the state value. + */ + RuleState state(); + + /** + * Gets the comment property: Any comment regarding the rule. + * + * @return the comment value. + */ + String comment(); + + /** + * Gets the suppressionAlertsScope property: The suppression conditions. + * + * @return the suppressionAlertsScope value. + */ + SuppressionAlertsScope suppressionAlertsScope(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner object. + * + * @return the inner object. + */ + AlertsSuppressionRuleInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRules.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRules.java new file mode 100644 index 000000000000..03c429a8e478 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRules.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; + +/** + * Resource collection API of AlertsSuppressionRules. + */ +public interface AlertsSuppressionRules { + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription along with + * {@link Response}. + */ + Response getWithResponse(String alertsSuppressionRuleName, Context context); + + /** + * Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription. + */ + AlertsSuppressionRule get(String alertsSuppressionRuleName); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @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 suppression rule along with {@link Response}. + */ + Response updateWithResponse(String alertsSuppressionRuleName, + AlertsSuppressionRuleInner alertsSuppressionRule, Context context); + + /** + * Update existing rule or create new rule if it doesn't exist. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @param alertsSuppressionRule Suppression rule object. + * @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 suppression rule. + */ + AlertsSuppressionRule update(String alertsSuppressionRuleName, AlertsSuppressionRuleInner alertsSuppressionRule); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 deleteWithResponse(String alertsSuppressionRuleName, Context context); + + /** + * Delete dismiss alert rule for this subscription. + * + * @param alertsSuppressionRuleName The unique name of the suppression alert rule. + * @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 delete(String alertsSuppressionRuleName); + + /** + * List of all the dismiss rules for the given 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 suppression rules list for subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of all the dismiss rules for the given subscription. + * + * @param alertType Type of the alert to get rules for. + * @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 suppression rules list for subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String alertType, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnections.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnections.java index cd3d58d7360f..73b5a6ba90c4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnections.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnections.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,26 +13,38 @@ */ public interface AllowedConnections { /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). + * @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 list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedIterable}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type along with {@link Response}. */ - PagedIterable list(); + Response getWithResponse(String resourceGroupName, String ascLocation, + ConnectionType connectionType, Context context); /** - * Gets the list of all possible traffic between resources for the subscription. + * Gets the list of all possible traffic between resources for the subscription and location, based on connection + * type. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param connectionType The type of allowed connections (Internal, External). * @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 list of all possible traffic between resources for the subscription as paginated response with - * {@link PagedIterable}. + * @return the list of all possible traffic between resources for the subscription and location, based on connection + * type. */ - PagedIterable list(Context context); + AllowedConnectionsResource get(String resourceGroupName, String ascLocation, ConnectionType connectionType); /** * Gets the list of all possible traffic between resources for the subscription and location. @@ -62,38 +74,24 @@ public interface AllowedConnections { PagedIterable listByHomeRegion(String ascLocation, Context context); /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). - * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type along with {@link Response}. + * @return the list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedIterable}. */ - Response getWithResponse(String resourceGroupName, String ascLocation, - ConnectionType connectionType, Context context); + PagedIterable list(); /** - * Gets the list of all possible traffic between resources for the subscription and location, based on connection - * type. + * Gets the list of all possible traffic between resources for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param connectionType The type of allowed connections (Internal, External). + * @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 list of all possible traffic between resources for the subscription and location, based on connection - * type. + * @return the list of all possible traffic between resources for the subscription as paginated response with + * {@link PagedIterable}. */ - AllowedConnectionsResource get(String resourceGroupName, String ascLocation, ConnectionType connectionType); + PagedIterable list(Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsResource.java index 92477f0db996..81f1fe9406fe 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsResource.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsResource.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; import java.time.OffsetDateTime; import java.util.List; @@ -40,6 +41,13 @@ public interface AllowedConnectionsResource { */ String location(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the calculatedDateTime property: The UTC time on which the allowed connections resource was calculated. * 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 14b5a1554da9..e9cdfaf6c3a6 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -16,9 +16,9 @@ * A custom alert rule that checks if a value (depends on the custom alert type) is allowed. */ @Fluent -public class AllowlistCustomAlertRule extends ListCustomAlertRule { +public final class AllowlistCustomAlertRule extends ListCustomAlertRule { /* - * The type of the custom alert rule. + * The ruleType property. */ private String ruleType = "AllowlistCustomAlertRule"; @@ -34,7 +34,7 @@ public AllowlistCustomAlertRule() { } /** - * Get the ruleType property: The type of the custom alert rule. + * Get the ruleType property: The ruleType property. * * @return the ruleType value. */ @@ -111,37 +111,6 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @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) { 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 deleted file mode 100644 index 2f857312829e..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.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.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.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. - */ -@Fluent -public final class AmqpC2DMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "AmqpC2DMessagesNotInAllowedRange"; - - /** - * Creates an instance of AmqpC2DMessagesNotInAllowedRange class. - */ - public AmqpC2DMessagesNotInAllowedRange() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { - super.withTimeWindowSize(timeWindowSize); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DMessagesNotInAllowedRange withMinThreshold(int minThreshold) { - super.withMinThreshold(minThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { - super.withMaxThreshold(maxThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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 deleted file mode 100644 index 3123462bb3e1..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.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.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.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. - */ -@Fluent -public final class AmqpC2DRejectedMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "AmqpC2DRejectedMessagesNotInAllowedRange"; - - /** - * Creates an instance of AmqpC2DRejectedMessagesNotInAllowedRange class. - */ - public AmqpC2DRejectedMessagesNotInAllowedRange() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DRejectedMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { - super.withTimeWindowSize(timeWindowSize); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DRejectedMessagesNotInAllowedRange withMinThreshold(int minThreshold) { - super.withMinThreshold(minThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DRejectedMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { - super.withMaxThreshold(maxThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpC2DRejectedMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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 deleted file mode 100644 index 0b40d7499bd7..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.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.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.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. - */ -@Fluent -public final class AmqpD2CMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "AmqpD2CMessagesNotInAllowedRange"; - - /** - * Creates an instance of AmqpD2CMessagesNotInAllowedRange class. - */ - public AmqpD2CMessagesNotInAllowedRange() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpD2CMessagesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { - super.withTimeWindowSize(timeWindowSize); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpD2CMessagesNotInAllowedRange withMinThreshold(int minThreshold) { - super.withMinThreshold(minThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpD2CMessagesNotInAllowedRange withMaxThreshold(int maxThreshold) { - super.withMaxThreshold(maxThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AmqpD2CMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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 new file mode 100644 index 000000000000..c6edfd14020c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AnnotateDefaultBranchState.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Configuration of PR Annotations on default branch. + * + * Enabled - PR Annotations are enabled on the resource's default branch. + * Disabled - PR Annotations are disabled on the resource's default branch. + */ +public final class AnnotateDefaultBranchState extends ExpandableStringEnum { + /** + * Disabled. + */ + public static final AnnotateDefaultBranchState DISABLED = fromString("Disabled"); + + /** + * Enabled. + */ + public static final AnnotateDefaultBranchState ENABLED = fromString("Enabled"); + + /** + * Creates a new instance of AnnotateDefaultBranchState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AnnotateDefaultBranchState() { + } + + /** + * Creates or finds a AnnotateDefaultBranchState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AnnotateDefaultBranchState. + */ + public static AnnotateDefaultBranchState fromString(String name) { + return fromString(name, AnnotateDefaultBranchState.class); + } + + /** + * Gets known AnnotateDefaultBranchState values. + * + * @return known AnnotateDefaultBranchState values. + */ + public static Collection values() { + return values(AnnotateDefaultBranchState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollection.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollection.java index e20f45dc9be3..e82ef6fbe9d5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollection.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollection.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.ApiCollectionInner; /** @@ -31,6 +32,13 @@ public interface ApiCollection { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the provisioningState property: Gets the provisioning state of the API collection. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollections.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollections.java index e8883e5365b7..314be3acdd38 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollections.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollections.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,205 +13,221 @@ */ public interface ApiCollections { /** - * Gets a list of API collections within a subscription + * Gets an onboarded Azure API Management API * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. + * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with + * {@link Response}. */ - PagedIterable list(); + Response getByAzureApiManagementServiceWithResponse(String resourceGroupName, String serviceName, + String apiId, Context context); /** - * Gets a list of API collections within a subscription + * Gets an onboarded Azure API Management API * - * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the + * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 API collections within a subscription that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * @return an onboarded Azure API Management API + * + * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. */ - PagedIterable list(Context context); + ApiCollection getByAzureApiManagementService(String resourceGroupName, String serviceName, String apiId); /** - * Gets a list of API collections within a resource group + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * @return an API collection as represented by Microsoft Defender for APIs. */ - PagedIterable listByResourceGroup(String resourceGroupName); + ApiCollection onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId); /** - * Gets a list of API collections within a resource group + * Onboard an Azure API Management API to Microsoft Defender for APIs * - * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. + * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the + * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been + * detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 API collections within a resource group that have been onboarded to Microsoft Defender for APIs - * as paginated response with {@link PagedIterable}. + * @return an API collection as represented by Microsoft Defender for APIs. */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + ApiCollection onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId, + Context context); /** - * Gets a list of onboarded Azure API Management APIs + * Offboard an Azure API Management API from Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the + * operations within the Azure API Management API for intrusive behaviors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. + * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedIterable}. + * @return the {@link Response}. */ - PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName); + Response offboardAzureApiManagementApiWithResponse(String resourceGroupName, String serviceName, String apiId, + Context context); /** - * Gets a list of onboarded Azure API Management APIs + * Offboard an Azure API Management API from Microsoft Defender for APIs * - * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API - * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the - * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. + * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the + * operations within the Azure API Management API for intrusive behaviors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param context The context to associate with this operation. + * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision + * has ;rev=n as a suffix where n is the revision number. * @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 Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedIterable}. */ - PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName, - Context context); + void offboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId); /** - * Gets an onboarded Azure API Management API + * Gets a list of onboarded Azure API Management APIs * - * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. - * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs along with - * {@link Response}. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedIterable}. */ - Response getByAzureApiManagementServiceWithResponse(String resourceGroupName, String serviceName, - String apiId, Context context); + PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName); /** - * Gets an onboarded Azure API Management API + * Gets a list of onboarded Azure API Management APIs * - * Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API * Management API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the * Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. + * @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 Azure API Management API if it has been onboarded to Microsoft Defender for APIs. + * @return a list of onboarded Azure API Management APIs + * + * Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated + * response with {@link PagedIterable}. */ - ApiCollection getByAzureApiManagementService(String resourceGroupName, String serviceName, String apiId); + PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName, + Context context); /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of API collections within a subscription * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. - * @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 API collection as represented by Microsoft Defender for APIs. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. */ - ApiCollection onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId); + PagedIterable list(); /** - * Onboard an Azure API Management API to Microsoft Defender for APIs + * Gets a list of API collections within a subscription * - * Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the - * operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been - * detected. + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. * @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 API collection as represented by Microsoft Defender for APIs. + * @return a list of API collections within a subscription + * + * Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. */ - ApiCollection onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId, - Context context); + PagedIterable list(Context context); /** - * Offboard an Azure API Management API from Microsoft Defender for APIs + * Gets a list of API collections within a resource group * - * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the - * operations within the Azure API Management API for intrusive behaviors. + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. - * @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}. + * @return a list of API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. */ - Response offboardAzureApiManagementApiWithResponse(String resourceGroupName, String serviceName, String apiId, - Context context); + PagedIterable listByResourceGroup(String resourceGroupName); /** - * Offboard an Azure API Management API from Microsoft Defender for APIs + * Gets a list of API collections within a resource group * - * Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the - * operations within the Azure API Management API for intrusive behaviors. + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName The name of the API Management service. - * @param apiId API revision identifier. Must be unique in the API Management service instance. Non-current revision - * has ;rev=n as a suffix where n is the revision number. + * @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 API collections within a resource group + * + * Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs as + * paginated response with {@link PagedIterable}. */ - void offboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId); + PagedIterable listByResourceGroup(String resourceGroupName, Context context); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Application.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Application.java new file mode 100644 index 000000000000..73156c93b4c0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Application.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.ApplicationInner; +import java.util.List; + +/** + * An immutable client-side representation of Application. + */ +public interface Application { + /** + * 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 displayName property: display name of the application. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: description of the application. + * + * @return the description value. + */ + String description(); + + /** + * Gets the sourceResourceType property: The application source, what it affects, e.g. Assessments. + * + * @return the sourceResourceType value. + */ + ApplicationSourceResourceType sourceResourceType(); + + /** + * Gets the conditionSets property: The application conditionSets - see examples. + * + * @return the conditionSets value. + */ + List conditionSets(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ApplicationInner object. + * + * @return the inner object. + */ + ApplicationInner innerModel(); + + /** + * The entirety of the Application definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The Application definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Application definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the Application 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.WithDisplayName, DefinitionStages.WithDescription, + DefinitionStages.WithSourceResourceType, DefinitionStages.WithConditionSets { + /** + * Executes the create request. + * + * @return the created resource. + */ + Application create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Application create(Context context); + } + + /** + * The stage of the Application definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: display name of the application. + * + * @param displayName display name of the application. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the Application definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: description of the application. + * + * @param description description of the application. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the Application definition allowing to specify sourceResourceType. + */ + interface WithSourceResourceType { + /** + * Specifies the sourceResourceType property: The application source, what it affects, e.g. Assessments. + * + * @param sourceResourceType The application source, what it affects, e.g. Assessments. + * @return the next definition stage. + */ + WithCreate withSourceResourceType(ApplicationSourceResourceType sourceResourceType); + } + + /** + * The stage of the Application definition allowing to specify conditionSets. + */ + interface WithConditionSets { + /** + * Specifies the conditionSets property: The application conditionSets - see examples. + * + * @param conditionSets The application conditionSets - see examples. + * @return the next definition stage. + */ + WithCreate withConditionSets(List conditionSets); + } + } + + /** + * Begins update for the Application resource. + * + * @return the stage of resource update. + */ + Application.Update update(); + + /** + * The template for Application update. + */ + interface Update extends UpdateStages.WithDisplayName, UpdateStages.WithDescription, + UpdateStages.WithSourceResourceType, UpdateStages.WithConditionSets { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Application apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Application apply(Context context); + } + + /** + * The Application update stages. + */ + interface UpdateStages { + /** + * The stage of the Application update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: display name of the application. + * + * @param displayName display name of the application. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the Application update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: description of the application. + * + * @param description description of the application. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the Application update allowing to specify sourceResourceType. + */ + interface WithSourceResourceType { + /** + * Specifies the sourceResourceType property: The application source, what it affects, e.g. Assessments. + * + * @param sourceResourceType The application source, what it affects, e.g. Assessments. + * @return the next definition stage. + */ + Update withSourceResourceType(ApplicationSourceResourceType sourceResourceType); + } + + /** + * The stage of the Application update allowing to specify conditionSets. + */ + interface WithConditionSets { + /** + * Specifies the conditionSets property: The application conditionSets - see examples. + * + * @param conditionSets The application conditionSets - see examples. + * @return the next definition stage. + */ + Update withConditionSets(List conditionSets); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Application refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Application refresh(Context context); +} 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 new file mode 100644 index 000000000000..5958915009f4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationSourceResourceType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The application source, what it affects, e.g. Assessments. + */ +public final class ApplicationSourceResourceType extends ExpandableStringEnum { + /** + * The source of the application is assessments. + */ + public static final ApplicationSourceResourceType ASSESSMENTS = fromString("Assessments"); + + /** + * Creates a new instance of ApplicationSourceResourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApplicationSourceResourceType() { + } + + /** + * Creates or finds a ApplicationSourceResourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationSourceResourceType. + */ + public static ApplicationSourceResourceType fromString(String name) { + return fromString(name, ApplicationSourceResourceType.class); + } + + /** + * Gets known ApplicationSourceResourceType values. + * + * @return known ApplicationSourceResourceType values. + */ + public static Collection values() { + return values(ApplicationSourceResourceType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Applications.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Applications.java new file mode 100644 index 000000000000..8237b2cf16b8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Applications.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Applications. + */ +public interface Applications { + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId along with {@link Response}. + */ + Response getWithResponse(String applicationId, Context context); + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 application for the requested scope by applicationId. + */ + Application get(String applicationId); + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 deleteWithResponse(String applicationId, Context context); + + /** + * Delete an Application over a given scope. + * + * @param applicationId The security Application key - unique key for the standard application. + * @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 delete(String applicationId); + + /** + * Get a list of all relevant applications over a subscription level scope. + * + * @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 applications over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get a list of all relevant applications over a subscription level 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 a list of all relevant applications over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a specific application for the requested scope by applicationId. + * + * @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 application for the requested scope by applicationId along with {@link Response}. + */ + Application getById(String id); + + /** + * Get a specific application for the requested scope by applicationId. + * + * @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 application for the requested scope by applicationId along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an Application 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 an Application 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 Application resource. + * + * @param name resource name. + * @return the first stage of the new Application definition. + */ + Application.DefinitionStages.Blank define(String name); +} 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 new file mode 100644 index 000000000000..08095af42a33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioning.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ARC autoprovisioning configuration. + */ +@Fluent +public class ArcAutoProvisioning implements JsonSerializable { + /* + * Is arc auto provisioning enabled + */ + private Boolean enabled; + + /* + * Configuration for servers Arc auto provisioning for a given environment + */ + private ArcAutoProvisioningConfiguration configuration; + + /** + * Creates an instance of ArcAutoProvisioning class. + */ + public ArcAutoProvisioning() { + } + + /** + * Get the enabled property: Is arc auto provisioning enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is arc auto provisioning enabled. + * + * @param enabled the enabled value to set. + * @return the ArcAutoProvisioning object itself. + */ + public ArcAutoProvisioning withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the configuration property: Configuration for servers Arc auto provisioning for a given environment. + * + * @return the configuration value. + */ + public ArcAutoProvisioningConfiguration configuration() { + return this.configuration; + } + + /** + * Set the configuration property: Configuration for servers Arc auto provisioning for a given environment. + * + * @param configuration the configuration value to set. + * @return the ArcAutoProvisioning object itself. + */ + public ArcAutoProvisioning withConfiguration(ArcAutoProvisioningConfiguration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configuration() != null) { + 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 new file mode 100644 index 000000000000..14168b93b783 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningAws.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ARC autoprovisioning configuration for an AWS environment. + */ +@Fluent +public class ArcAutoProvisioningAws extends ArcAutoProvisioning { + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of ArcAutoProvisioningAws class. + */ + public ArcAutoProvisioningAws() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the ArcAutoProvisioningAws object itself. + */ + public ArcAutoProvisioningAws withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ArcAutoProvisioningAws withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ArcAutoProvisioningAws withConfiguration(ArcAutoProvisioningConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..f53feb5b2844 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningConfiguration.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Configuration for servers Arc auto provisioning for a given environment. + */ +@Fluent +public final class ArcAutoProvisioningConfiguration implements JsonSerializable { + /* + * Optional HTTP proxy endpoint to use for the Arc agent + */ + private String proxy; + + /* + * Optional Arc private link scope resource id to link the Arc agent + */ + private String privateLinkScope; + + /** + * Creates an instance of ArcAutoProvisioningConfiguration class. + */ + public ArcAutoProvisioningConfiguration() { + } + + /** + * Get the proxy property: Optional HTTP proxy endpoint to use for the Arc agent. + * + * @return the proxy value. + */ + public String proxy() { + return this.proxy; + } + + /** + * Set the proxy property: Optional HTTP proxy endpoint to use for the Arc agent. + * + * @param proxy the proxy value to set. + * @return the ArcAutoProvisioningConfiguration object itself. + */ + public ArcAutoProvisioningConfiguration withProxy(String proxy) { + this.proxy = proxy; + return this; + } + + /** + * Get the privateLinkScope property: Optional Arc private link scope resource id to link the Arc agent. + * + * @return the privateLinkScope value. + */ + public String privateLinkScope() { + return this.privateLinkScope; + } + + /** + * Set the privateLinkScope property: Optional Arc private link scope resource id to link the Arc agent. + * + * @param privateLinkScope the privateLinkScope value to set. + * @return the ArcAutoProvisioningConfiguration object itself. + */ + public ArcAutoProvisioningConfiguration withPrivateLinkScope(String privateLinkScope) { + this.privateLinkScope = privateLinkScope; + 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("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 new file mode 100644 index 000000000000..7ff7b7e7adad --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningGcp.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ARC autoprovisioning configuration for an GCP environment. + */ +@Fluent +public class ArcAutoProvisioningGcp extends ArcAutoProvisioning { + /** + * Creates an instance of ArcAutoProvisioningGcp class. + */ + public ArcAutoProvisioningGcp() { + } + + /** + * {@inheritDoc} + */ + @Override + public ArcAutoProvisioningGcp withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ArcAutoProvisioningGcp withConfiguration(ArcAutoProvisioningConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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/ArmActionType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArmActionType.java new file mode 100644 index 000000000000..b826812d888e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArmActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ArmActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ArmActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ArmActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArmActionType() { + } + + /** + * Creates or finds a ArmActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArmActionType. + */ + public static ArmActionType fromString(String name) { + return fromString(name, ArmActionType.class); + } + + /** + * Gets known ArmActionType values. + * + * @return known ArmActionType values. + */ + public static Collection values() { + return values(ArmActionType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java new file mode 100644 index 000000000000..8abe87f10510 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; + +/** + * An immutable client-side representation of AscLocation. + */ +public interface AscLocation { + /** + * 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 properties property: An empty set of properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AscLocationInner object. + * + * @return the inner object. + */ + AscLocationInner innerModel(); +} 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 new file mode 100644 index 000000000000..cd33f3592b8d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Sub-assessment resource type. + */ +public final class AssessedResourceType extends ExpandableStringEnum { + /** + * SqlServerVulnerability. + */ + public static final AssessedResourceType SQL_SERVER_VULNERABILITY = fromString("SqlServerVulnerability"); + + /** + * ContainerRegistryVulnerability. + */ + public static final AssessedResourceType CONTAINER_REGISTRY_VULNERABILITY + = fromString("ContainerRegistryVulnerability"); + + /** + * ServerVulnerability. + */ + public static final AssessedResourceType SERVER_VULNERABILITY = fromString("ServerVulnerability"); + + /** + * ServerVulnerabilityAssessment. + */ + public static final AssessedResourceType SERVER_VULNERABILITY_ASSESSMENT + = fromString("ServerVulnerabilityAssessment"); + + /** + * Creates a new instance of AssessedResourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AssessedResourceType() { + } + + /** + * Creates or finds a AssessedResourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssessedResourceType. + */ + public static AssessedResourceType fromString(String name) { + return fromString(name, AssessedResourceType.class); + } + + /** + * Gets known AssessedResourceType values. + * + * @return known AssessedResourceType values. + */ + public static Collection values() { + return values(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 cfea104b4fc4..4b7fa293404e 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -24,7 +24,7 @@ public final class AssessmentLinks implements JsonSerializable /** * Creates an instance of AssessmentLinks class. */ - public AssessmentLinks() { + private AssessmentLinks() { } /** 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 2f7a9cdcbe93..6900f02b344e 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; 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 6d4231261b38..a83a3061e5a9 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,17 +12,17 @@ */ public final class AssessmentStatusCode extends ExpandableStringEnum { /** - * Static value Healthy for AssessmentStatusCode. + * The resource is healthy. */ public static final AssessmentStatusCode HEALTHY = fromString("Healthy"); /** - * Static value Unhealthy for AssessmentStatusCode. + * The resource has a security issue that needs to be addressed. */ public static final AssessmentStatusCode UNHEALTHY = fromString("Unhealthy"); /** - * Static value NotApplicable for AssessmentStatusCode. + * Assessment for this resource did not happen. */ public static final AssessmentStatusCode NOT_APPLICABLE = fromString("NotApplicable"); 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 0c577d0d2b72..c115e6fe4a40 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; @@ -16,7 +16,7 @@ /** * The result of the assessment. */ -@Fluent +@Immutable public final class AssessmentStatusResponse extends AssessmentStatus { /* * The time that the assessment was created and first evaluated. Returned as UTC time in ISO 8601 format @@ -31,7 +31,7 @@ public final class AssessmentStatusResponse extends AssessmentStatus { /** * Creates an instance of AssessmentStatusResponse class. */ - public AssessmentStatusResponse() { + private AssessmentStatusResponse() { } /** @@ -54,33 +54,6 @@ public OffsetDateTime statusChangeDate() { return this.statusChangeDate; } - /** - * {@inheritDoc} - */ - @Override - public AssessmentStatusResponse withCode(AssessmentStatusCode code) { - super.withCode(code); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AssessmentStatusResponse withCause(String cause) { - super.withCause(cause); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public AssessmentStatusResponse withDescription(String description) { - super.withDescription(description); - return this; - } - /** * Validates the instance. * 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 ed8857740de0..793a8e66a965 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,25 +13,60 @@ */ public final class AssessmentType extends ExpandableStringEnum { /** - * Static value BuiltIn for AssessmentType. + * Unknown assessment type. + */ + public static final AssessmentType UNKNOWN = fromString("Unknown"); + + /** + * Microsoft Defender for Cloud managed assessments. */ public static final AssessmentType BUILT_IN = fromString("BuiltIn"); /** - * Static value CustomPolicy for AssessmentType. + * User defined custom assessments. + */ + public static final AssessmentType CUSTOM = fromString("Custom"); + + /** + * User defined policies that are automatically ingested from Azure Policy to Microsoft Defender for Cloud. */ public static final AssessmentType CUSTOM_POLICY = fromString("CustomPolicy"); /** - * Static value CustomerManaged for AssessmentType. + * User assessments pushed directly by the user or other third party to Microsoft Defender for Cloud. */ public static final AssessmentType CUSTOMER_MANAGED = fromString("CustomerManaged"); /** - * Static value VerifiedPartner for AssessmentType. + * Microsoft Defender for Cloud managed policies. + */ + public static final AssessmentType BUILT_IN_POLICY = fromString("BuiltInPolicy"); + + /** + * Third party assessments that are verified by Microsoft Defender for Cloud. */ public static final AssessmentType VERIFIED_PARTNER = fromString("VerifiedPartner"); + /** + * Microsoft Defender for Cloud managed policies that are manually created by the user. + */ + public static final AssessmentType MANUAL_BUILT_IN_POLICY = fromString("ManualBuiltInPolicy"); + + /** + * Microsoft Defender for Cloud managed assessments that are manually created by the user. + */ + public static final AssessmentType MANUAL_BUILT_IN = fromString("ManualBuiltIn"); + + /** + * User defined policies that are manually created by the user. + */ + public static final AssessmentType MANUAL_CUSTOM_POLICY = fromString("ManualCustomPolicy"); + + /** + * Microsoft Defender for Cloud managed assessments that are dynamically created by the system. + */ + public static final AssessmentType DYNAMIC_BUILT_IN = fromString("DynamicBuiltIn"); + /** * Creates a new instance of AssessmentType value. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assessments.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assessments.java index b5a734d81404..98991383b6af 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assessments.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assessments.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,37 +12,10 @@ * Resource collection API of Assessments. */ public interface Assessments { - /** - * Get security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 assessments on all your scanned resources inside a scope as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(String scope); - - /** - * Get security assessments on all your scanned resources inside a scope. - * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @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 assessments on all your scanned resources inside a scope as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(String scope, Context context); - /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param expand OData expand. Optional. * @param context The context to associate with this operation. @@ -57,7 +30,7 @@ Response getWithResponse(String resourceId, String a /** * Get a security assessment on your scanned resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -70,7 +43,7 @@ Response getWithResponse(String resourceId, String a * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -84,7 +57,7 @@ Response getWithResponse(String resourceId, String a * Delete a security assessment on your resource. An assessment metadata that describes this assessment must be * predefined with the same name before inserting the assessment result. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param assessmentName The Assessment Key - Unique key for the assessment type. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -92,6 +65,31 @@ Response getWithResponse(String resourceId, String a */ void deleteByResourceGroup(String resourceId, String assessmentName); + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * Get security assessments on all your scanned resources inside a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 security assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String scope, Context context); + /** * Get a security assessment on your scanned resource. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentsMetadatas.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentsMetadatas.java index 33e7a2d02d99..95355f94463f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentsMetadatas.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentsMetadatas.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,47 +13,52 @@ */ public interface AssessmentsMetadatas { /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedIterable}. + * @return metadata information on an assessment type in a specific subscription along with {@link Response}. */ - PagedIterable list(); + Response getInSubscriptionWithResponse(String assessmentMetadataName, + Context context); /** - * Get metadata information on all assessment types. + * Get metadata information on an assessment type in a specific subscription. * - * @param context The context to associate with this operation. + * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedIterable}. + * @return metadata information on an assessment type in a specific subscription. */ - PagedIterable list(Context context); + SecurityAssessmentMetadataResponse getInSubscription(String assessmentMetadataName); /** - * Get metadata information on an assessment type. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type along with {@link Response}. + * @return the {@link Response}. */ - Response getWithResponse(String assessmentMetadataName, Context context); + Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context); /** - * Get metadata information on an assessment type. + * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the + * assessments of that type in that subscription. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type. */ - SecurityAssessmentMetadataResponse get(String assessmentMetadataName); + void deleteInSubscription(String assessmentMetadataName); /** * Get metadata information on all assessment types in a specific subscription. @@ -78,52 +83,47 @@ public interface AssessmentsMetadatas { PagedIterable listBySubscription(Context context); /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription along with {@link Response}. + * @return metadata information on an assessment type along with {@link Response}. */ - Response getInSubscriptionWithResponse(String assessmentMetadataName, - Context context); + Response getWithResponse(String assessmentMetadataName, Context context); /** - * Get metadata information on an assessment type in a specific subscription. + * Get metadata information on an assessment type. * * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on an assessment type in a specific subscription. + * @return metadata information on an assessment type. */ - SecurityAssessmentMetadataResponse getInSubscription(String assessmentMetadataName); + SecurityAssessmentMetadataResponse get(String assessmentMetadataName); /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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}. + * @return metadata information on all assessment types as paginated response with {@link PagedIterable}. */ - Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context); + PagedIterable list(); /** - * Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the - * assessments of that type in that subscription. + * Get metadata information on all assessment types. * - * @param assessmentMetadataName The Assessment Key - Unique key for the assessment 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 metadata information on all assessment types as paginated response with {@link PagedIterable}. */ - void deleteInSubscription(String assessmentMetadataName); + PagedIterable list(Context context); /** * Get metadata information on an assessment type in a specific subscription. 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 index f2ae0bc34435..0e2621fdd6cd 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedComponentItem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedComponentItem.java new file mode 100644 index 000000000000..e2a88e2e8d77 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedComponentItem.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AssignedComponentItem implements JsonSerializable { + /* + * unique key to a security assessment object + */ + private String key; + + /** + * Creates an instance of AssignedComponentItem class. + */ + public AssignedComponentItem() { + } + + /** + * Get the key property: unique key to a security assessment object. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: unique key to a security assessment object. + * + * @param key the key value to set. + * @return the AssignedComponentItem object itself. + */ + public AssignedComponentItem withKey(String key) { + this.key = key; + 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("key", this.key); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignedComponentItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignedComponentItem 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 AssignedComponentItem. + */ + public static AssignedComponentItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignedComponentItem deserializedAssignedComponentItem = new AssignedComponentItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("key".equals(fieldName)) { + deserializedAssignedComponentItem.key = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignedComponentItem; + }); + } +} 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 index 489c994d7439..511c9d9e9fcd 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assignment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assignment.java new file mode 100644 index 000000000000..68c867dfc267 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assignment.java @@ -0,0 +1,625 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AssignmentInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An immutable client-side representation of Assignment. + */ +public interface Assignment { + /** + * 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 tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: Kind of the resource. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the displayName property: display name of the standardAssignment. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: description of the standardAssignment. + * + * @return the description value. + */ + String description(); + + /** + * Gets the assignedStandard property: Standard item with key as applied to this standard assignment over the given + * scope. + * + * @return the assignedStandard value. + */ + AssignedStandardItem assignedStandard(); + + /** + * Gets the assignedComponent property: Component item with key as applied to this standard assignment over the + * given scope. + * + * @return the assignedComponent value. + */ + AssignedComponentItem assignedComponent(); + + /** + * Gets the scope property: Scope to which the standardAssignment applies - can be a subscription path or a resource + * group under that subscription. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the effect property: expected effect of this assignment (Disable/Exempt/etc). + * + * @return the effect value. + */ + String effect(); + + /** + * Gets the expiresOn property: Expiration date of this assignment as a full ISO date. + * + * @return the expiresOn value. + */ + OffsetDateTime expiresOn(); + + /** + * Gets the additionalData property: Additional data about the assignment. + * + * @return the additionalData value. + */ + AssignmentPropertiesAdditionalData additionalData(); + + /** + * Gets the metadata property: The assignment metadata. Metadata is an open ended object and is typically a + * collection of key value pairs. + * + * @return the metadata value. + */ + Object metadata(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AssignmentInner object. + * + * @return the inner object. + */ + AssignmentInner innerModel(); + + /** + * The entirety of the Assignment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Assignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Assignment definition. + */ + interface Blank extends WithResourceGroup { + } + + /** + * The stage of the Assignment definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Assignment 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.WithLocation, DefinitionStages.WithTags, + DefinitionStages.WithKind, DefinitionStages.WithEtag, DefinitionStages.WithDisplayName, + DefinitionStages.WithDescription, DefinitionStages.WithAssignedStandard, + DefinitionStages.WithAssignedComponent, DefinitionStages.WithScope, DefinitionStages.WithEffect, + DefinitionStages.WithExpiresOn, DefinitionStages.WithAdditionalData, DefinitionStages.WithMetadata { + /** + * Executes the create request. + * + * @return the created resource. + */ + Assignment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Assignment create(Context context); + } + + /** + * The stage of the Assignment definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + + /** + * The stage of the Assignment definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Assignment definition allowing to specify kind. + */ + interface WithKind { + /** + * Specifies the kind property: Kind of the resource. + * + * @param kind Kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + + /** + * The stage of the Assignment definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Entity tag is used for comparing two or more entities from the same + * requested resource.. + * + * @param etag Entity tag is used for comparing two or more entities from the same requested resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the Assignment definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: display name of the standardAssignment. + * + * @param displayName display name of the standardAssignment. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the Assignment definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: description of the standardAssignment. + * + * @param description description of the standardAssignment. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the Assignment definition allowing to specify assignedStandard. + */ + interface WithAssignedStandard { + /** + * Specifies the assignedStandard property: Standard item with key as applied to this standard assignment + * over the given scope. + * + * @param assignedStandard Standard item with key as applied to this standard assignment over the given + * scope. + * @return the next definition stage. + */ + WithCreate withAssignedStandard(AssignedStandardItem assignedStandard); + } + + /** + * The stage of the Assignment definition allowing to specify assignedComponent. + */ + interface WithAssignedComponent { + /** + * Specifies the assignedComponent property: Component item with key as applied to this standard assignment + * over the given scope. + * + * @param assignedComponent Component item with key as applied to this standard assignment over the given + * scope. + * @return the next definition stage. + */ + WithCreate withAssignedComponent(AssignedComponentItem assignedComponent); + } + + /** + * The stage of the Assignment definition allowing to specify scope. + */ + interface WithScope { + /** + * Specifies the scope property: Scope to which the standardAssignment applies - can be a subscription path + * or a resource group under that subscription. + * + * @param scope Scope to which the standardAssignment applies - can be a subscription path or a resource + * group under that subscription. + * @return the next definition stage. + */ + WithCreate withScope(String scope); + } + + /** + * The stage of the Assignment definition allowing to specify effect. + */ + interface WithEffect { + /** + * Specifies the effect property: expected effect of this assignment (Disable/Exempt/etc). + * + * @param effect expected effect of this assignment (Disable/Exempt/etc). + * @return the next definition stage. + */ + WithCreate withEffect(String effect); + } + + /** + * The stage of the Assignment definition allowing to specify expiresOn. + */ + interface WithExpiresOn { + /** + * Specifies the expiresOn property: Expiration date of this assignment as a full ISO date. + * + * @param expiresOn Expiration date of this assignment as a full ISO date. + * @return the next definition stage. + */ + WithCreate withExpiresOn(OffsetDateTime expiresOn); + } + + /** + * The stage of the Assignment definition allowing to specify additionalData. + */ + interface WithAdditionalData { + /** + * Specifies the additionalData property: Additional data about the assignment. + * + * @param additionalData Additional data about the assignment. + * @return the next definition stage. + */ + WithCreate withAdditionalData(AssignmentPropertiesAdditionalData additionalData); + } + + /** + * The stage of the Assignment definition allowing to specify metadata. + */ + interface WithMetadata { + /** + * Specifies the metadata property: The assignment metadata. Metadata is an open ended object and is + * typically a collection of key value pairs.. + * + * @param metadata The assignment metadata. Metadata is an open ended object and is typically a collection + * of key value pairs. + * @return the next definition stage. + */ + WithCreate withMetadata(Object metadata); + } + } + + /** + * Begins update for the Assignment resource. + * + * @return the stage of resource update. + */ + Assignment.Update update(); + + /** + * The template for Assignment update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithKind, UpdateStages.WithEtag, + UpdateStages.WithDisplayName, UpdateStages.WithDescription, UpdateStages.WithAssignedStandard, + UpdateStages.WithAssignedComponent, UpdateStages.WithScope, UpdateStages.WithEffect, UpdateStages.WithExpiresOn, + UpdateStages.WithAdditionalData, UpdateStages.WithMetadata { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Assignment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Assignment apply(Context context); + } + + /** + * The Assignment update stages. + */ + interface UpdateStages { + /** + * The stage of the Assignment update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Assignment update allowing to specify kind. + */ + interface WithKind { + /** + * Specifies the kind property: Kind of the resource. + * + * @param kind Kind of the resource. + * @return the next definition stage. + */ + Update withKind(String kind); + } + + /** + * The stage of the Assignment update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Entity tag is used for comparing two or more entities from the same + * requested resource.. + * + * @param etag Entity tag is used for comparing two or more entities from the same requested resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the Assignment update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: display name of the standardAssignment. + * + * @param displayName display name of the standardAssignment. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the Assignment update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: description of the standardAssignment. + * + * @param description description of the standardAssignment. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the Assignment update allowing to specify assignedStandard. + */ + interface WithAssignedStandard { + /** + * Specifies the assignedStandard property: Standard item with key as applied to this standard assignment + * over the given scope. + * + * @param assignedStandard Standard item with key as applied to this standard assignment over the given + * scope. + * @return the next definition stage. + */ + Update withAssignedStandard(AssignedStandardItem assignedStandard); + } + + /** + * The stage of the Assignment update allowing to specify assignedComponent. + */ + interface WithAssignedComponent { + /** + * Specifies the assignedComponent property: Component item with key as applied to this standard assignment + * over the given scope. + * + * @param assignedComponent Component item with key as applied to this standard assignment over the given + * scope. + * @return the next definition stage. + */ + Update withAssignedComponent(AssignedComponentItem assignedComponent); + } + + /** + * The stage of the Assignment update allowing to specify scope. + */ + interface WithScope { + /** + * Specifies the scope property: Scope to which the standardAssignment applies - can be a subscription path + * or a resource group under that subscription. + * + * @param scope Scope to which the standardAssignment applies - can be a subscription path or a resource + * group under that subscription. + * @return the next definition stage. + */ + Update withScope(String scope); + } + + /** + * The stage of the Assignment update allowing to specify effect. + */ + interface WithEffect { + /** + * Specifies the effect property: expected effect of this assignment (Disable/Exempt/etc). + * + * @param effect expected effect of this assignment (Disable/Exempt/etc). + * @return the next definition stage. + */ + Update withEffect(String effect); + } + + /** + * The stage of the Assignment update allowing to specify expiresOn. + */ + interface WithExpiresOn { + /** + * Specifies the expiresOn property: Expiration date of this assignment as a full ISO date. + * + * @param expiresOn Expiration date of this assignment as a full ISO date. + * @return the next definition stage. + */ + Update withExpiresOn(OffsetDateTime expiresOn); + } + + /** + * The stage of the Assignment update allowing to specify additionalData. + */ + interface WithAdditionalData { + /** + * Specifies the additionalData property: Additional data about the assignment. + * + * @param additionalData Additional data about the assignment. + * @return the next definition stage. + */ + Update withAdditionalData(AssignmentPropertiesAdditionalData additionalData); + } + + /** + * The stage of the Assignment update allowing to specify metadata. + */ + interface WithMetadata { + /** + * Specifies the metadata property: The assignment metadata. Metadata is an open ended object and is + * typically a collection of key value pairs.. + * + * @param metadata The assignment metadata. Metadata is an open ended object and is typically a collection + * of key value pairs. + * @return the next definition stage. + */ + Update withMetadata(Object metadata); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Assignment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Assignment refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignmentPropertiesAdditionalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignmentPropertiesAdditionalData.java new file mode 100644 index 000000000000..d41a8fea8430 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignmentPropertiesAdditionalData.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Additional data about the assignment. + */ +@Fluent +public final class AssignmentPropertiesAdditionalData implements JsonSerializable { + /* + * Exemption category of this assignment + */ + private String exemptionCategory; + + /** + * Creates an instance of AssignmentPropertiesAdditionalData class. + */ + public AssignmentPropertiesAdditionalData() { + } + + /** + * Get the exemptionCategory property: Exemption category of this assignment. + * + * @return the exemptionCategory value. + */ + public String exemptionCategory() { + return this.exemptionCategory; + } + + /** + * Set the exemptionCategory property: Exemption category of this assignment. + * + * @param exemptionCategory the exemptionCategory value to set. + * @return the AssignmentPropertiesAdditionalData object itself. + */ + public AssignmentPropertiesAdditionalData withExemptionCategory(String exemptionCategory) { + this.exemptionCategory = exemptionCategory; + 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("exemptionCategory", this.exemptionCategory); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignmentPropertiesAdditionalData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignmentPropertiesAdditionalData 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 AssignmentPropertiesAdditionalData. + */ + public static AssignmentPropertiesAdditionalData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignmentPropertiesAdditionalData deserializedAssignmentPropertiesAdditionalData + = new AssignmentPropertiesAdditionalData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("exemptionCategory".equals(fieldName)) { + deserializedAssignmentPropertiesAdditionalData.exemptionCategory = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignmentPropertiesAdditionalData; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assignments.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assignments.java new file mode 100644 index 000000000000..40749bdd6955 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Assignments.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Assignments. + */ +public interface Assignments { + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 a specific standard assignment for the requested scope by resourceId along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String assignmentId, Context context); + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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 a specific standard assignment for the requested scope by resourceId. + */ + Assignment getByResourceGroup(String resourceGroupName, String assignmentId); + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String assignmentId, Context context); + + /** + * Delete a standard assignment over a given scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param assignmentId The security 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. + */ + void deleteByResourceGroup(String resourceGroupName, String assignmentId); + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all relevant standardAssignments available for scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 standardAssignments available for scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a list of all relevant standardAssignments over a subscription level scope. + * + * @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 standardAssignments over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get a list of all relevant standardAssignments over a subscription level 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 a list of all relevant standardAssignments over a subscription level scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @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 standard assignment for the requested scope by resourceId along with {@link Response}. + */ + Assignment getById(String id); + + /** + * Get a specific standard assignment for the requested scope by resourceId. + * + * @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 standard assignment for the requested scope by resourceId along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a standard assignment 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 standard assignment 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 Assignment resource. + * + * @param name resource name. + * @return the first stage of the new Assignment definition. + */ + Assignment.DefinitionStages.Blank define(String name); +} 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 f7358217fa11..b2fa25cbdbf9 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 @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -14,7 +15,7 @@ /** * Represents an ATA security solution which sends logs to an OMS workspace. */ -@Fluent +@Immutable public final class AtaExternalSecuritySolution extends ExternalSecuritySolutionInner { /* * The kind of the external solution @@ -26,6 +27,11 @@ public final class AtaExternalSecuritySolution extends ExternalSecuritySolutionI */ private AtaSolutionProperties properties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * Location where the resource is stored */ @@ -49,7 +55,7 @@ public final class AtaExternalSecuritySolution extends ExternalSecuritySolutionI /** * Creates an instance of AtaExternalSecuritySolution class. */ - public AtaExternalSecuritySolution() { + private AtaExternalSecuritySolution() { } /** @@ -67,19 +73,19 @@ public ExternalSecuritySolutionKind kind() { * * @return the properties value. */ + @Override public AtaSolutionProperties properties() { return this.properties; } /** - * Set the properties property: The external security solution properties for ATA solutions. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param properties the properties value to set. - * @return the AtaExternalSecuritySolution object itself. + * @return the systemData value. */ - public AtaExternalSecuritySolution withProperties(AtaSolutionProperties properties) { - this.properties = properties; - return this; + @Override + public SystemData systemData() { + return this.systemData; } /** @@ -169,6 +175,8 @@ public static AtaExternalSecuritySolution fromJson(JsonReader jsonReader) throws deserializedAtaExternalSecuritySolution.type = reader.getString(); } else if ("location".equals(fieldName)) { deserializedAtaExternalSecuritySolution.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAtaExternalSecuritySolution.systemData = SystemData.fromJson(reader); } else if ("kind".equals(fieldName)) { deserializedAtaExternalSecuritySolution.kind = ExternalSecuritySolutionKind.fromString(reader.getString()); 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 3b7f735e8dfc..8a3c4dcd3786 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -15,17 +15,37 @@ /** * The external security solution properties for ATA solutions. */ -@Fluent +@Immutable public final class AtaSolutionProperties extends ExternalSecuritySolutionProperties { /* * The lastEventReceived property. */ private String lastEventReceived; + /* + * The solution properties (correspond to the solution kind) + */ + private Map additionalProperties; + + /* + * Represents an OMS workspace to which the solution is connected + */ + private ConnectedWorkspace workspace; + + /* + * The deviceType property. + */ + private String deviceType; + + /* + * The deviceVendor property. + */ + private String deviceVendor; + /** * Creates an instance of AtaSolutionProperties class. */ - public AtaSolutionProperties() { + private AtaSolutionProperties() { } /** @@ -38,41 +58,43 @@ public String lastEventReceived() { } /** - * Set the lastEventReceived property: The lastEventReceived property. + * Get the additionalProperties property: The solution properties (correspond to the solution kind). * - * @param lastEventReceived the lastEventReceived value to set. - * @return the AtaSolutionProperties object itself. + * @return the additionalProperties value. */ - public AtaSolutionProperties withLastEventReceived(String lastEventReceived) { - this.lastEventReceived = lastEventReceived; - return this; + @Override + public Map additionalProperties() { + return this.additionalProperties; } /** - * {@inheritDoc} + * Get the workspace property: Represents an OMS workspace to which the solution is connected. + * + * @return the workspace value. */ @Override - public AtaSolutionProperties withDeviceVendor(String deviceVendor) { - super.withDeviceVendor(deviceVendor); - return this; + public ConnectedWorkspace workspace() { + return this.workspace; } /** - * {@inheritDoc} + * Get the deviceType property: The deviceType property. + * + * @return the deviceType value. */ @Override - public AtaSolutionProperties withDeviceType(String deviceType) { - super.withDeviceType(deviceType); - return this; + public String deviceType() { + return this.deviceType; } /** - * {@inheritDoc} + * Get the deviceVendor property: The deviceVendor property. + * + * @return the deviceVendor value. */ @Override - public AtaSolutionProperties withWorkspace(ConnectedWorkspace workspace) { - super.withWorkspace(workspace); - return this; + public String deviceVendor() { + return this.deviceVendor; } /** @@ -122,11 +144,11 @@ public static AtaSolutionProperties fromJson(JsonReader jsonReader) throws IOExc reader.nextToken(); if ("deviceVendor".equals(fieldName)) { - deserializedAtaSolutionProperties.withDeviceVendor(reader.getString()); + deserializedAtaSolutionProperties.deviceVendor = reader.getString(); } else if ("deviceType".equals(fieldName)) { - deserializedAtaSolutionProperties.withDeviceType(reader.getString()); + deserializedAtaSolutionProperties.deviceType = reader.getString(); } else if ("workspace".equals(fieldName)) { - deserializedAtaSolutionProperties.withWorkspace(ConnectedWorkspace.fromJson(reader)); + deserializedAtaSolutionProperties.workspace = ConnectedWorkspace.fromJson(reader); } else if ("lastEventReceived".equals(fieldName)) { deserializedAtaSolutionProperties.lastEventReceived = reader.getString(); } else { @@ -137,7 +159,7 @@ public static AtaSolutionProperties fromJson(JsonReader jsonReader) throws IOExc additionalProperties.put(fieldName, reader.readUntyped()); } } - deserializedAtaSolutionProperties.withAdditionalProperties(additionalProperties); + deserializedAtaSolutionProperties.additionalProperties = 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 index dc724ea58140..6c161689a42f 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,17 +12,17 @@ */ public final class AttestationComplianceState extends ExpandableStringEnum { /** - * Static value unknown for AttestationComplianceState. + * unknown. */ public static final AttestationComplianceState UNKNOWN = fromString("unknown"); /** - * Static value compliant for AttestationComplianceState. + * compliant. */ public static final AttestationComplianceState COMPLIANT = fromString("compliant"); /** - * Static value nonCompliant for AttestationComplianceState. + * nonCompliant. */ public static final AttestationComplianceState NON_COMPLIANT = fromString("nonCompliant"); 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 index da9c622d5014..2d22a4ed0ecd 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; 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..bfb6d9c4111e --- /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) TypeSpec 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/AuthenticationType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java new file mode 100644 index 000000000000..4d1fa499ab72 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The authentication type. + */ +public final class AuthenticationType extends ExpandableStringEnum { + /** + * AccessToken. + */ + public static final AuthenticationType ACCESS_TOKEN = fromString("AccessToken"); + + /** + * Creates a new instance of AuthenticationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AuthenticationType() { + } + + /** + * Creates or finds a AuthenticationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationType. + */ + public static AuthenticationType fromString(String name) { + return fromString(name, AuthenticationType.class); + } + + /** + * Gets known AuthenticationType values. + * + * @return known AuthenticationType values. + */ + public static Collection values() { + return values(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 new file mode 100644 index 000000000000..aaac37763d1d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authorization.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Authorization payload. + */ +@Fluent +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. + */ + private String code; + + /** + * Creates an instance of Authorization class. + */ + public Authorization() { + } + + /** + * Get the code property: 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. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: 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. + * + * @param code the code value to set. + * @return the Authorization object itself. + */ + public Authorization withCode(String code) { + this.code = code; + 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("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 new file mode 100644 index 000000000000..d48e90e7c71a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoDiscovery.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * AutoDiscovery states. + */ +public final class AutoDiscovery extends ExpandableStringEnum { + /** + * Disabled. + */ + public static final AutoDiscovery DISABLED = fromString("Disabled"); + + /** + * Enabled. + */ + public static final AutoDiscovery ENABLED = fromString("Enabled"); + + /** + * NotApplicable. + */ + public static final AutoDiscovery NOT_APPLICABLE = fromString("NotApplicable"); + + /** + * Creates a new instance of AutoDiscovery value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutoDiscovery() { + } + + /** + * Creates or finds a AutoDiscovery from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoDiscovery. + */ + public static AutoDiscovery fromString(String name) { + return fromString(name, AutoDiscovery.class); + } + + /** + * Gets known AutoDiscovery values. + * + * @return known AutoDiscovery values. + */ + public static Collection values() { + return values(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 new file mode 100644 index 000000000000..100209726127 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes what kind of security agent provisioning action to take. + */ +public final class AutoProvision extends ExpandableStringEnum { + /** + * Install missing security agent on VMs automatically. + */ + public static final AutoProvision ON = fromString("On"); + + /** + * Do not install security agent on the VMs automatically. + */ + public static final AutoProvision OFF = fromString("Off"); + + /** + * Creates a new instance of AutoProvision value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutoProvision() { + } + + /** + * Creates or finds a AutoProvision from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoProvision. + */ + public static AutoProvision fromString(String name) { + return fromString(name, AutoProvision.class); + } + + /** + * Gets known AutoProvision values. + * + * @return known AutoProvision values. + */ + public static Collection values() { + return values(AutoProvision.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSetting.java new file mode 100644 index 000000000000..8fa3c5f8a283 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSetting.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AutoProvisioningSettingInner; + +/** + * An immutable client-side representation of AutoProvisioningSetting. + */ +public interface AutoProvisioningSetting { + /** + * 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 autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @return the autoProvision value. + */ + AutoProvision autoProvision(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner object. + * + * @return the inner object. + */ + AutoProvisioningSettingInner innerModel(); + + /** + * The entirety of the AutoProvisioningSetting definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The AutoProvisioningSetting definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AutoProvisioningSetting definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the AutoProvisioningSetting 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.WithAutoProvision { + /** + * Executes the create request. + * + * @return the created resource. + */ + AutoProvisioningSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AutoProvisioningSetting create(Context context); + } + + /** + * The stage of the AutoProvisioningSetting definition allowing to specify autoProvision. + */ + interface WithAutoProvision { + /** + * Specifies the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @param autoProvision Describes what kind of security agent provisioning action to take. + * @return the next definition stage. + */ + WithCreate withAutoProvision(AutoProvision autoProvision); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AutoProvisioningSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AutoProvisioningSetting refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettings.java new file mode 100644 index 000000000000..f613da53e326 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettings.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AutoProvisioningSettings. + */ +public interface AutoProvisioningSettings { + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @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 auto provisioning setting along with {@link Response}. + */ + Response getWithResponse(String settingName, Context context); + + /** + * Details of a specific setting. + * + * @param settingName Auto provisioning setting key. + * @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 auto provisioning setting. + */ + AutoProvisioningSetting get(String settingName); + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Exposes the auto provisioning settings of the subscriptions. + * + * @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 all the auto provisioning settings response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Details of a specific setting. + * + * @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 auto provisioning setting along with {@link Response}. + */ + AutoProvisioningSetting getById(String id); + + /** + * Details of a specific setting. + * + * @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 auto provisioning setting along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AutoProvisioningSetting resource. + * + * @param name resource name. + * @return the first stage of the new AutoProvisioningSetting definition. + */ + AutoProvisioningSetting.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomatedResponseType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomatedResponseType.java new file mode 100644 index 000000000000..586d4b2f11c5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomatedResponseType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Optional. Specifies the automated response action to take when malware is detected. + */ +public final class AutomatedResponseType extends ExpandableStringEnum { + /** + * No automated response will be taken when malware is detected. + */ + public static final AutomatedResponseType NONE = fromString("None"); + + /** + * The blob will be soft deleted when malware is detected. + */ + public static final AutomatedResponseType BLOB_SOFT_DELETE = fromString("BlobSoftDelete"); + + /** + * Creates a new instance of AutomatedResponseType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutomatedResponseType() { + } + + /** + * Creates or finds a AutomatedResponseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutomatedResponseType. + */ + public static AutomatedResponseType fromString(String name) { + return fromString(name, AutomatedResponseType.class); + } + + /** + * Gets known AutomatedResponseType values. + * + * @return known AutomatedResponseType values. + */ + public static Collection values() { + return values(AutomatedResponseType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java new file mode 100644 index 000000000000..5841245a7eb4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; +import java.util.List; +import java.util.Map; + +/** + * An immutable client-side representation of Automation. + */ +public interface Automation { + /** + * 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 tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: Kind of the resource. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the etag property: Entity tag is used for comparing two or more entities from the same requested resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: The security automation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isEnabled property: Indicates whether the security automation is enabled. + * + * @return the isEnabled value. + */ + Boolean isEnabled(); + + /** + * Gets the scopes property: 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. + * + * @return the scopes value. + */ + List scopes(); + + /** + * Gets the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @return the sources value. + */ + List sources(); + + /** + * Gets the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @return the actions value. + */ + List actions(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AutomationInner object. + * + * @return the inner object. + */ + AutomationInner innerModel(); + + /** + * The entirety of the Automation definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Automation definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Automation definition. + */ + interface Blank extends WithResourceGroup { + } + + /** + * The stage of the Automation definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Automation 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.WithLocation, DefinitionStages.WithTags, DefinitionStages.WithKind, + DefinitionStages.WithEtag, DefinitionStages.WithDescription, DefinitionStages.WithIsEnabled, + DefinitionStages.WithScopes, DefinitionStages.WithSources, DefinitionStages.WithActions { + /** + * Executes the create request. + * + * @return the created resource. + */ + Automation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Automation create(Context context); + } + + /** + * The stage of the Automation definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + + /** + * The stage of the Automation definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Automation definition allowing to specify kind. + */ + interface WithKind { + /** + * Specifies the kind property: Kind of the resource. + * + * @param kind Kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + + /** + * The stage of the Automation definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Entity tag is used for comparing two or more entities from the same + * requested resource.. + * + * @param etag Entity tag is used for comparing two or more entities from the same requested resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the Automation definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The security automation description.. + * + * @param description The security automation description. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the Automation definition allowing to specify isEnabled. + */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: Indicates whether the security automation is enabled.. + * + * @param isEnabled Indicates whether the security automation is enabled. + * @return the next definition stage. + */ + WithCreate withIsEnabled(Boolean isEnabled); + } + + /** + * The stage of the Automation definition allowing to specify scopes. + */ + interface WithScopes { + /** + * Specifies the scopes property: 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.. + * + * @param 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. + * @return the next definition stage. + */ + WithCreate withScopes(List scopes); + } + + /** + * The stage of the Automation definition allowing to specify sources. + */ + interface WithSources { + /** + * Specifies the sources property: A collection of the source event types which evaluate the security + * automation set of rules.. + * + * @param sources A collection of the source event types which evaluate the security automation set of + * rules. + * @return the next definition stage. + */ + WithCreate withSources(List sources); + } + + /** + * The stage of the Automation definition allowing to specify actions. + */ + interface WithActions { + /** + * Specifies the actions property: A collection of the actions which are triggered if all the configured + * rules evaluations, within at least one rule set, are true.. + * + * @param actions A collection of the actions which are triggered if all the configured rules evaluations, + * within at least one rule set, are true. + * @return the next definition stage. + */ + WithCreate withActions(List actions); + } + } + + /** + * Begins update for the Automation resource. + * + * @return the stage of resource update. + */ + Automation.Update update(); + + /** + * The template for Automation update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithDescription, UpdateStages.WithIsEnabled, + UpdateStages.WithScopes, UpdateStages.WithSources, UpdateStages.WithActions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Automation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Automation apply(Context context); + } + + /** + * The Automation update stages. + */ + interface UpdateStages { + /** + * The stage of the Automation update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: A list of key value pairs that describe the resource.. + * + * @param tags A list of key value pairs that describe the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Automation update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The security automation description.. + * + * @param description The security automation description. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the Automation update allowing to specify isEnabled. + */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: Indicates whether the security automation is enabled.. + * + * @param isEnabled Indicates whether the security automation is enabled. + * @return the next definition stage. + */ + Update withIsEnabled(Boolean isEnabled); + } + + /** + * The stage of the Automation update allowing to specify scopes. + */ + interface WithScopes { + /** + * Specifies the scopes property: 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.. + * + * @param 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. + * @return the next definition stage. + */ + Update withScopes(List scopes); + } + + /** + * The stage of the Automation update allowing to specify sources. + */ + interface WithSources { + /** + * Specifies the sources property: A collection of the source event types which evaluate the security + * automation set of rules.. + * + * @param sources A collection of the source event types which evaluate the security automation set of + * rules. + * @return the next definition stage. + */ + Update withSources(List sources); + } + + /** + * The stage of the Automation update allowing to specify actions. + */ + interface WithActions { + /** + * Specifies the actions property: A collection of the actions which are triggered if all the configured + * rules evaluations, within at least one rule set, are true.. + * + * @param actions A collection of the actions which are triggered if all the configured rules evaluations, + * within at least one rule set, are true. + * @return the next definition stage. + */ + Update withActions(List actions); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Automation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Automation refresh(Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param automation The security automation 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 the security automation model state property bag along with {@link Response}. + */ + Response validateWithResponse(AutomationInner automation, Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param automation The security automation 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 the security automation model state property bag. + */ + AutomationValidationStatus validate(AutomationInner automation); +} 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 new file mode 100644 index 000000000000..e196490c0b2b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 action that should be triggered. + */ +@Immutable +public class AutomationAction implements JsonSerializable { + /* + * The type of the action that will be triggered by the Automation + */ + private ActionType actionType = ActionType.fromString("AutomationAction"); + + /** + * Creates an instance of AutomationAction class. + */ + public AutomationAction() { + } + + /** + * Get the actionType property: The type of the action that will be triggered by the Automation. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * 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("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 new file mode 100644 index 000000000000..505b55b52ac2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 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. + */ +@Fluent +public final class AutomationActionEventHub extends AutomationAction { + /* + * The type of the action that will be triggered by the Automation + */ + private ActionType actionType = ActionType.EVENT_HUB; + + /* + * The target Event Hub Azure Resource ID. + */ + private String eventHubResourceId; + + /* + * The target Event Hub SAS policy name. + */ + private String sasPolicyName; + + /* + * The target Event Hub connection string (it will not be included in any response). + */ + private String connectionString; + + /* + * Indicates whether the trusted service is enabled or not. + */ + private Boolean isTrustedServiceEnabled; + + /** + * Creates an instance of AutomationActionEventHub class. + */ + public AutomationActionEventHub() { + } + + /** + * Get the actionType property: The type of the action that will be triggered by the Automation. + * + * @return the actionType value. + */ + @Override + public ActionType actionType() { + return this.actionType; + } + + /** + * Get the eventHubResourceId property: The target Event Hub Azure Resource ID. + * + * @return the eventHubResourceId value. + */ + public String eventHubResourceId() { + return this.eventHubResourceId; + } + + /** + * Set the eventHubResourceId property: The target Event Hub Azure Resource ID. + * + * @param eventHubResourceId the eventHubResourceId value to set. + * @return the AutomationActionEventHub object itself. + */ + public AutomationActionEventHub withEventHubResourceId(String eventHubResourceId) { + this.eventHubResourceId = eventHubResourceId; + return this; + } + + /** + * Get the sasPolicyName property: The target Event Hub SAS policy name. + * + * @return the sasPolicyName value. + */ + public String sasPolicyName() { + return this.sasPolicyName; + } + + /** + * Get the connectionString property: The target Event Hub connection string (it will not be included in any + * response). + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: The target Event Hub connection string (it will not be included in any + * response). + * + * @param connectionString the connectionString value to set. + * @return the AutomationActionEventHub object itself. + */ + public AutomationActionEventHub withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the isTrustedServiceEnabled property: Indicates whether the trusted service is enabled or not. + * + * @return the isTrustedServiceEnabled value. + */ + public Boolean isTrustedServiceEnabled() { + return this.isTrustedServiceEnabled; + } + + /** + * Set the isTrustedServiceEnabled property: Indicates whether the trusted service is enabled or not. + * + * @param isTrustedServiceEnabled the isTrustedServiceEnabled value to set. + * @return the AutomationActionEventHub object itself. + */ + public AutomationActionEventHub withIsTrustedServiceEnabled(Boolean isTrustedServiceEnabled) { + this.isTrustedServiceEnabled = isTrustedServiceEnabled; + 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("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 new file mode 100644 index 000000000000..c68d59c35b7c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's Workflow Automation + * capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore. + */ +@Fluent +public final class AutomationActionLogicApp extends AutomationAction { + /* + * The type of the action that will be triggered by the Automation + */ + 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 + */ + private String logicAppResourceId; + + /* + * The Logic App trigger URI endpoint (it will not be included in any response). + */ + private String uri; + + /** + * Creates an instance of AutomationActionLogicApp class. + */ + public AutomationActionLogicApp() { + } + + /** + * Get the actionType property: The type of the action that will be triggered by the Automation. + * + * @return the actionType value. + */ + @Override + public ActionType actionType() { + return this.actionType; + } + + /** + * Get the logicAppResourceId property: The triggered Logic App Azure Resource ID. This can also reside on other + * subscriptions, given that you have permissions to trigger the Logic App. + * + * @return the logicAppResourceId value. + */ + public String logicAppResourceId() { + return this.logicAppResourceId; + } + + /** + * Set the logicAppResourceId property: The triggered Logic App Azure Resource ID. This can also reside on other + * subscriptions, given that you have permissions to trigger the Logic App. + * + * @param logicAppResourceId the logicAppResourceId value to set. + * @return the AutomationActionLogicApp object itself. + */ + public AutomationActionLogicApp withLogicAppResourceId(String logicAppResourceId) { + this.logicAppResourceId = logicAppResourceId; + return this; + } + + /** + * Get the uri property: The Logic App trigger URI endpoint (it will not be included in any response). + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The Logic App trigger URI endpoint (it will not be included in any response). + * + * @param uri the uri value to set. + * @return the AutomationActionLogicApp object itself. + */ + public AutomationActionLogicApp withUri(String uri) { + this.uri = uri; + 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("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 new file mode 100644 index 000000000000..ecbb5f2af5c6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Log Analytics Workspace to which event data will be exported. Security alerts data will reside in the + * 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the + * 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center + * 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. + */ +@Fluent +public final class AutomationActionWorkspace extends AutomationAction { + /* + * The type of the action that will be triggered by the Automation + */ + private ActionType actionType = ActionType.WORKSPACE; + + /* + * The fully qualified Log Analytics Workspace Azure Resource ID. + */ + private String workspaceResourceId; + + /** + * Creates an instance of AutomationActionWorkspace class. + */ + public AutomationActionWorkspace() { + } + + /** + * Get the actionType property: The type of the action that will be triggered by the Automation. + * + * @return the actionType value. + */ + @Override + public ActionType actionType() { + return this.actionType; + } + + /** + * Get the workspaceResourceId property: The fully qualified Log Analytics Workspace Azure Resource ID. + * + * @return the workspaceResourceId value. + */ + public String workspaceResourceId() { + return this.workspaceResourceId; + } + + /** + * Set the workspaceResourceId property: The fully qualified Log Analytics Workspace Azure Resource ID. + * + * @param workspaceResourceId the workspaceResourceId value to set. + * @return the AutomationActionWorkspace object itself. + */ + public AutomationActionWorkspace withWorkspaceResourceId(String workspaceResourceId) { + this.workspaceResourceId = workspaceResourceId; + 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("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/AutomationRuleSet.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java new file mode 100644 index 000000000000..311103090bcd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * A rule set which evaluates all its rules upon an event interception. Only when all the included rules in the rule set + * will be evaluated as 'true', will the event trigger the defined actions. + */ +@Fluent +public final class AutomationRuleSet implements JsonSerializable { + /* + * The rules property. + */ + private List rules; + + /** + * Creates an instance of AutomationRuleSet class. + */ + public AutomationRuleSet() { + } + + /** + * Get the rules property: The rules property. + * + * @return the rules value. + */ + public List rules() { + return this.rules; + } + + /** + * Set the rules property: The rules property. + * + * @param rules the rules value to set. + * @return the AutomationRuleSet object itself. + */ + public AutomationRuleSet withRules(List rules) { + this.rules = rules; + 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()); + } + } + + /** + * {@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 new file mode 100644 index 000000000000..13f079587596 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 single automation scope. + */ +@Fluent +public final class AutomationScope implements JsonSerializable { + /* + * The resources scope 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). + */ + private String scopePath; + + /** + * Creates an instance of AutomationScope class. + */ + public AutomationScope() { + } + + /** + * Get the description property: The resources scope description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The resources scope description. + * + * @param description the description value to set. + * @return the AutomationScope object itself. + */ + public AutomationScope withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the scopePath property: 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). + * + * @return the scopePath value. + */ + public String scopePath() { + return this.scopePath; + } + + /** + * Set the scopePath property: 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). + * + * @param scopePath the scopePath value to set. + * @return the AutomationScope object itself. + */ + public AutomationScope withScopePath(String scopePath) { + this.scopePath = scopePath; + 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("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 new file mode 100644 index 000000000000..f5ea0cef63aa --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * The source event types which evaluate the security automation set of rules. For example - security alerts and + * security assessments. To learn more about the supported security events data models schemas - please visit + * https://aka.ms/ASCAutomationSchemas. + */ +@Fluent +public final class AutomationSource implements JsonSerializable { + /* + * A valid event source type. + */ + private EventSource eventSource; + + /* + * A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets + * (logical 'or'). + */ + private List ruleSets; + + /** + * Creates an instance of AutomationSource class. + */ + public AutomationSource() { + } + + /** + * Get the eventSource property: A valid event source type. + * + * @return the eventSource value. + */ + public EventSource eventSource() { + return this.eventSource; + } + + /** + * Set the eventSource property: A valid event source type. + * + * @param eventSource the eventSource value to set. + * @return the AutomationSource object itself. + */ + public AutomationSource withEventSource(EventSource eventSource) { + this.eventSource = eventSource; + return this; + } + + /** + * Get the ruleSets property: A set of rules which evaluate upon event interception. A logical disjunction is + * applied between defined rule sets (logical 'or'). + * + * @return the ruleSets value. + */ + public List ruleSets() { + return this.ruleSets; + } + + /** + * Set the ruleSets property: A set of rules which evaluate upon event interception. A logical disjunction is + * applied between defined rule sets (logical 'or'). + * + * @param ruleSets the ruleSets value to set. + * @return the AutomationSource object itself. + */ + public AutomationSource withRuleSets(List ruleSets) { + this.ruleSets = ruleSets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ruleSets() != null) { + 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 new file mode 100644 index 000000000000..3d7b5359baa0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 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 implements JsonSerializable { + /* + * The JPath of the entity model property that should be checked. + */ + private String propertyJPath; + + /* + * The data type of the compared operands (string, integer, floating point number or a boolean [true/false]] + */ + private PropertyType propertyType; + + /* + * The expected value. + */ + private String expectedValue; + + /* + * A valid comparer operator to use. A case-insensitive comparison will be applied for String PropertyType. + */ + private Operator operator; + + /** + * Creates an instance of AutomationTriggeringRule class. + */ + public AutomationTriggeringRule() { + } + + /** + * Get the propertyJPath property: The JPath of the entity model property that should be checked. + * + * @return the propertyJPath value. + */ + public String propertyJPath() { + return this.propertyJPath; + } + + /** + * Set the propertyJPath property: The JPath of the entity model property that should be checked. + * + * @param propertyJPath the propertyJPath value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withPropertyJPath(String propertyJPath) { + this.propertyJPath = propertyJPath; + return this; + } + + /** + * Get the propertyType property: The data type of the compared operands (string, integer, floating point number or + * a boolean [true/false]]. + * + * @return the propertyType value. + */ + public PropertyType propertyType() { + return this.propertyType; + } + + /** + * Set the propertyType property: The data type of the compared operands (string, integer, floating point number or + * a boolean [true/false]]. + * + * @param propertyType the propertyType value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withPropertyType(PropertyType propertyType) { + this.propertyType = propertyType; + return this; + } + + /** + * Get the expectedValue property: The expected value. + * + * @return the expectedValue value. + */ + public String expectedValue() { + return this.expectedValue; + } + + /** + * Set the expectedValue property: The expected value. + * + * @param expectedValue the expectedValue value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withExpectedValue(String expectedValue) { + this.expectedValue = expectedValue; + return this; + } + + /** + * Get the operator property: A valid comparer operator to use. A case-insensitive comparison will be applied for + * String PropertyType. + * + * @return the operator value. + */ + public Operator operator() { + return this.operator; + } + + /** + * Set the operator property: A valid comparer operator to use. A case-insensitive comparison will be applied for + * String PropertyType. + * + * @param operator the operator value to set. + * @return the AutomationTriggeringRule object itself. + */ + public AutomationTriggeringRule withOperator(Operator operator) { + this.operator = operator; + 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("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 new file mode 100644 index 000000000000..107381f5c567 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationUpdateModel.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 com.azure.resourcemanager.security.fluent.models.AutomationProperties; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The update model of security automation resource. + */ +@Fluent +public final class AutomationUpdateModel extends Tags { + /* + * Security automation data + */ + private AutomationProperties innerProperties; + + /** + * Creates an instance of AutomationUpdateModel class. + */ + public AutomationUpdateModel() { + } + + /** + * Get the innerProperties property: Security automation data. + * + * @return the innerProperties value. + */ + private AutomationProperties innerProperties() { + return this.innerProperties; + } + + /** + * {@inheritDoc} + */ + @Override + public AutomationUpdateModel withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: The security automation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The security automation description. + * + * @param description the description value to set. + * @return the AutomationUpdateModel object itself. + */ + public AutomationUpdateModel withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the isEnabled property: Indicates whether the security automation is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: Indicates whether the security automation is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AutomationUpdateModel object itself. + */ + public AutomationUpdateModel withIsEnabled(Boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the scopes property: 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. + * + * @return the scopes value. + */ + public List scopes() { + return this.innerProperties() == null ? null : this.innerProperties().scopes(); + } + + /** + * Set the scopes property: 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. + * + * @param scopes the scopes value to set. + * @return the AutomationUpdateModel object itself. + */ + public AutomationUpdateModel withScopes(List scopes) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withScopes(scopes); + return this; + } + + /** + * Get the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @return the sources value. + */ + public List sources() { + return this.innerProperties() == null ? null : this.innerProperties().sources(); + } + + /** + * Set the sources property: A collection of the source event types which evaluate the security automation set of + * rules. + * + * @param sources the sources value to set. + * @return the AutomationUpdateModel object itself. + */ + public AutomationUpdateModel withSources(List sources) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withSources(sources); + return this; + } + + /** + * Get the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @return the actions value. + */ + public List actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: A collection of the actions which are triggered if all the configured rules + * evaluations, within at least one rule set, are true. + * + * @param actions the actions value to set. + * @return the AutomationUpdateModel object itself. + */ + public AutomationUpdateModel withActions(List actions) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomationProperties(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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/AutomationValidationStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationValidationStatus.java new file mode 100644 index 000000000000..034c391eac69 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationValidationStatus.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; + +/** + * An immutable client-side representation of AutomationValidationStatus. + */ +public interface AutomationValidationStatus { + /** + * Gets the isValid property: Indicates whether the model is valid or not. + * + * @return the isValid value. + */ + Boolean isValid(); + + /** + * Gets the message property: The validation message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner object. + * + * @return the inner object. + */ + AutomationValidationStatusInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automations.java new file mode 100644 index 000000000000..2eecb20af9e2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automations.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; + +/** + * Resource collection API of Automations. + */ +public interface Automations { + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String automationName, + Context context); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the security automation resource. + */ + Automation getByResourceGroup(String resourceGroupName, String automationName); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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 the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String automationName, Context context); + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation 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. + */ + void deleteByResourceGroup(String resourceGroupName, String automationName); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the security automations in the specified resource group. Use the 'nextLink' property in the response + * to get the next page of security automations for the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified 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 list of security automations response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to + * get the next page of security automations for the specified subscription. + * + * @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 security automations response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag along with {@link Response}. + */ + Response validateWithResponse(String resourceGroupName, String automationName, + AutomationInner automation, Context context); + + /** + * Validates the security automation model before create or update. Any validation errors are returned to the + * client. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param automationName The security automation name. + * @param automation The security automation 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 the security automation model state property bag. + */ + AutomationValidationStatus validate(String resourceGroupName, String automationName, AutomationInner automation); + + /** + * Retrieves information about the model of a security automation. + * + * @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 the security automation resource along with {@link Response}. + */ + Automation getById(String id); + + /** + * Retrieves information about the model of a security automation. + * + * @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 security automation resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a security automation. + * + * @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); + + /** + * Deletes a security automation. + * + * @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 Automation resource. + * + * @param name resource name. + * @return the first stage of the new Automation definition. + */ + Automation.DefinitionStages.Blank define(String name); +} 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 new file mode 100644 index 000000000000..4965bea145a5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsEnvironmentData.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * The AWS connector environment data. + */ +@Fluent +public final class AwsEnvironmentData extends EnvironmentData { + /* + * The type of the environment data. + */ + private EnvironmentType environmentType = EnvironmentType.AWS_ACCOUNT; + + /* + * The AWS account's organizational data + */ + private AwsOrganizationalData organizationalData; + + /* + * list of regions to scan + */ + private List regions; + + /* + * The AWS account name + */ + private String accountName; + + /* + * Scan interval in hours (value should be between 1-hour to 24-hours) + */ + private Long scanInterval; + + /** + * Creates an instance of AwsEnvironmentData class. + */ + public AwsEnvironmentData() { + } + + /** + * Get the environmentType property: The type of the environment data. + * + * @return the environmentType value. + */ + @Override + public EnvironmentType environmentType() { + return this.environmentType; + } + + /** + * Get the organizationalData property: The AWS account's organizational data. + * + * @return the organizationalData value. + */ + public AwsOrganizationalData organizationalData() { + return this.organizationalData; + } + + /** + * Set the organizationalData property: The AWS account's organizational data. + * + * @param organizationalData the organizationalData value to set. + * @return the AwsEnvironmentData object itself. + */ + public AwsEnvironmentData withOrganizationalData(AwsOrganizationalData organizationalData) { + this.organizationalData = organizationalData; + return this; + } + + /** + * Get the regions property: list of regions to scan. + * + * @return the regions value. + */ + public List regions() { + return this.regions; + } + + /** + * Set the regions property: list of regions to scan. + * + * @param regions the regions value to set. + * @return the AwsEnvironmentData object itself. + */ + public AwsEnvironmentData withRegions(List regions) { + this.regions = regions; + return this; + } + + /** + * Get the accountName property: The AWS account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * 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 AwsEnvironmentData object itself. + */ + public AwsEnvironmentData 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 (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 new file mode 100644 index 000000000000..1e170ee7e131 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalData.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AWS organization data. + */ +@Immutable +public class AwsOrganizationalData implements JsonSerializable { + /* + * The multi cloud account's membership type in the organization + */ + private OrganizationMembershipType organizationMembershipType + = OrganizationMembershipType.fromString("AwsOrganizationalData"); + + /** + * Creates an instance of AwsOrganizationalData class. + */ + public AwsOrganizationalData() { + } + + /** + * Get the organizationMembershipType property: The multi cloud account's membership type in the organization. + * + * @return the organizationMembershipType value. + */ + public OrganizationMembershipType organizationMembershipType() { + return this.organizationMembershipType; + } + + /** + * 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("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 new file mode 100644 index 000000000000..a9057e9d1b64 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMaster.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * The AWS organization data for the master account. + */ +@Fluent +public final class AwsOrganizationalDataMaster extends AwsOrganizationalData { + /* + * The multi cloud account's membership type in the organization + */ + private OrganizationMembershipType organizationMembershipType = OrganizationMembershipType.ORGANIZATION; + + /* + * If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset + */ + private String stacksetName; + + /* + * If the multi cloud account is of membership type organization, list of accounts excluded from offering + */ + private List excludedAccountIds; + + /** + * Creates an instance of AwsOrganizationalDataMaster class. + */ + public AwsOrganizationalDataMaster() { + } + + /** + * Get the organizationMembershipType property: The multi cloud account's membership type in the organization. + * + * @return the organizationMembershipType value. + */ + @Override + public OrganizationMembershipType organizationMembershipType() { + return this.organizationMembershipType; + } + + /** + * Get the stacksetName property: If the multi cloud account is of membership type organization, this will be the + * name of the onboarding stackset. + * + * @return the stacksetName value. + */ + public String stacksetName() { + return this.stacksetName; + } + + /** + * Set the stacksetName property: If the multi cloud account is of membership type organization, this will be the + * name of the onboarding stackset. + * + * @param stacksetName the stacksetName value to set. + * @return the AwsOrganizationalDataMaster object itself. + */ + public AwsOrganizationalDataMaster withStacksetName(String stacksetName) { + this.stacksetName = stacksetName; + return this; + } + + /** + * Get the excludedAccountIds property: If the multi cloud account is of membership type organization, list of + * accounts excluded from offering. + * + * @return the excludedAccountIds value. + */ + public List excludedAccountIds() { + return this.excludedAccountIds; + } + + /** + * Set the excludedAccountIds property: If the multi cloud account is of membership type organization, list of + * accounts excluded from offering. + * + * @param excludedAccountIds the excludedAccountIds value to set. + * @return the AwsOrganizationalDataMaster object itself. + */ + public AwsOrganizationalDataMaster withExcludedAccountIds(List excludedAccountIds) { + this.excludedAccountIds = excludedAccountIds; + 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("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 new file mode 100644 index 000000000000..654b6b5f696d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMember.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AWS organization data for the member account. + */ +@Fluent +public final class AwsOrganizationalDataMember extends AwsOrganizationalData { + /* + * The multi cloud account's membership type in the organization + */ + 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 + */ + private String parentHierarchyId; + + /** + * Creates an instance of AwsOrganizationalDataMember class. + */ + public AwsOrganizationalDataMember() { + } + + /** + * Get the organizationMembershipType property: The multi cloud account's membership type in the organization. + * + * @return the organizationMembershipType value. + */ + @Override + public OrganizationMembershipType organizationMembershipType() { + return this.organizationMembershipType; + } + + /** + * Get the parentHierarchyId property: If the multi cloud account is not of membership type organization, this will + * be the ID of the account's parent. + * + * @return the parentHierarchyId value. + */ + public String parentHierarchyId() { + return this.parentHierarchyId; + } + + /** + * Set the parentHierarchyId property: If the multi cloud account is not of membership type organization, this will + * be the ID of the account's parent. + * + * @param parentHierarchyId the parentHierarchyId value to set. + * @return the AwsOrganizationalDataMember object itself. + */ + public AwsOrganizationalDataMember withParentHierarchyId(String parentHierarchyId) { + this.parentHierarchyId = parentHierarchyId; + 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("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/AzureDevOpsOrg.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrg.java new file mode 100644 index 000000000000..993e6662c8d8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrg.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsOrgInner; + +/** + * An immutable client-side representation of AzureDevOpsOrg. + */ +public interface AzureDevOpsOrg { + /** + * 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 properties property: Azure DevOps Organization properties. + * + * @return the properties value. + */ + AzureDevOpsOrgProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.AzureDevOpsOrgInner object. + * + * @return the inner object. + */ + AzureDevOpsOrgInner innerModel(); + + /** + * The entirety of the AzureDevOpsOrg definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The AzureDevOpsOrg definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AzureDevOpsOrg definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the AzureDevOpsOrg 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 AzureDevOpsOrg 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. + */ + AzureDevOpsOrg create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AzureDevOpsOrg create(Context context); + } + + /** + * The stage of the AzureDevOpsOrg definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Azure DevOps Organization properties.. + * + * @param properties Azure DevOps Organization properties. + * @return the next definition stage. + */ + WithCreate withProperties(AzureDevOpsOrgProperties properties); + } + } + + /** + * Begins update for the AzureDevOpsOrg resource. + * + * @return the stage of resource update. + */ + AzureDevOpsOrg.Update update(); + + /** + * The template for AzureDevOpsOrg update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AzureDevOpsOrg apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AzureDevOpsOrg apply(Context context); + } + + /** + * The AzureDevOpsOrg update stages. + */ + interface UpdateStages { + /** + * The stage of the AzureDevOpsOrg update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Azure DevOps Organization properties.. + * + * @param properties Azure DevOps Organization properties. + * @return the next definition stage. + */ + Update withProperties(AzureDevOpsOrgProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AzureDevOpsOrg refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AzureDevOpsOrg refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgListResponse.java new file mode 100644 index 000000000000..013177e089e9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgListResponse.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgListResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of AzureDevOpsOrgListResponse. + */ +public interface AzureDevOpsOrgListResponse { + /** + * Gets the value property: The AzureDevOpsOrg items on this page. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.AzureDevOpsOrgListResponseInner object. + * + * @return the inner object. + */ + AzureDevOpsOrgListResponseInner innerModel(); +} 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 new file mode 100644 index 000000000000..b04d6655513d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgProperties.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Azure DevOps Organization properties. + */ +@Fluent +public final class AzureDevOpsOrgProperties 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; + + /* + * 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. + * 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. + */ + private OnboardingState onboardingState; + + /* + * Configuration payload for PR Annotations. + */ + private ActionableRemediation actionableRemediation; + + /** + * Creates an instance of AzureDevOpsOrgProperties class. + */ + public AzureDevOpsOrgProperties() { + } + + /** + * 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 onboardingState property: 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. + * 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. + * + * @return the onboardingState value. + */ + public OnboardingState onboardingState() { + return this.onboardingState; + } + + /** + * Set the onboardingState property: 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. + * 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. + * + * @param onboardingState the onboardingState value to set. + * @return the AzureDevOpsOrgProperties object itself. + */ + public AzureDevOpsOrgProperties withOnboardingState(OnboardingState onboardingState) { + this.onboardingState = onboardingState; + return this; + } + + /** + * Get the actionableRemediation property: Configuration payload for PR Annotations. + * + * @return the actionableRemediation value. + */ + public ActionableRemediation actionableRemediation() { + return this.actionableRemediation; + } + + /** + * Set the actionableRemediation property: Configuration payload for PR Annotations. + * + * @param actionableRemediation the actionableRemediation value to set. + * @return the AzureDevOpsOrgProperties object itself. + */ + public AzureDevOpsOrgProperties withActionableRemediation(ActionableRemediation actionableRemediation) { + this.actionableRemediation = actionableRemediation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actionableRemediation() != null) { + 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/AzureDevOpsOrgs.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgs.java new file mode 100644 index 000000000000..f1c8a6de3037 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgs.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AzureDevOpsOrgs. + */ +public interface AzureDevOpsOrgs { + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String securityConnectorName, String orgName, + Context context); + + /** + * Returns a monitored Azure DevOps organization resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 azure DevOps Organization resource. + */ + AzureDevOpsOrg get(String resourceGroupName, String securityConnectorName, String orgName); + + /** + * Returns a list of Azure DevOps organizations onboarded to the connector. + * + * @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 Azure DevOps organizations onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName, Context context); + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination along with {@link Response}. + */ + Response listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context); + + /** + * Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. + * + * @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. + */ + AzureDevOpsOrgListResponse listAvailable(String resourceGroupName, String securityConnectorName); + + /** + * Returns a monitored Azure DevOps organization 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 azure DevOps Organization resource along with {@link Response}. + */ + AzureDevOpsOrg getById(String id); + + /** + * Returns a monitored Azure DevOps organization 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 azure DevOps Organization resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AzureDevOpsOrg resource. + * + * @param name resource name. + * @return the first stage of the new AzureDevOpsOrg definition. + */ + AzureDevOpsOrg.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProject.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProject.java new file mode 100644 index 000000000000..ef10fb5e91b3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProject.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsProjectInner; + +/** + * An immutable client-side representation of AzureDevOpsProject. + */ +public interface AzureDevOpsProject { + /** + * 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 properties property: Azure DevOps Project properties. + * + * @return the properties value. + */ + AzureDevOpsProjectProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.AzureDevOpsProjectInner object. + * + * @return the inner object. + */ + AzureDevOpsProjectInner innerModel(); + + /** + * The entirety of the AzureDevOpsProject definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The AzureDevOpsProject definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AzureDevOpsProject definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the AzureDevOpsProject definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, securityConnectorName, orgName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @return the next definition stage. + */ + WithCreate withExistingAzureDevOpsOrg(String resourceGroupName, String securityConnectorName, + String orgName); + } + + /** + * The stage of the AzureDevOpsProject 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. + */ + AzureDevOpsProject create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AzureDevOpsProject create(Context context); + } + + /** + * The stage of the AzureDevOpsProject definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Azure DevOps Project properties.. + * + * @param properties Azure DevOps Project properties. + * @return the next definition stage. + */ + WithCreate withProperties(AzureDevOpsProjectProperties properties); + } + } + + /** + * Begins update for the AzureDevOpsProject resource. + * + * @return the stage of resource update. + */ + AzureDevOpsProject.Update update(); + + /** + * The template for AzureDevOpsProject update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AzureDevOpsProject apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AzureDevOpsProject apply(Context context); + } + + /** + * The AzureDevOpsProject update stages. + */ + interface UpdateStages { + /** + * The stage of the AzureDevOpsProject update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Azure DevOps Project properties.. + * + * @param properties Azure DevOps Project properties. + * @return the next definition stage. + */ + Update withProperties(AzureDevOpsProjectProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AzureDevOpsProject refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AzureDevOpsProject refresh(Context context); +} 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 new file mode 100644 index 000000000000..1af04948fac4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectProperties.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Azure DevOps Project properties. + */ +@Fluent +public final class AzureDevOpsProjectProperties 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 parent Azure DevOps Organization name. + */ + private String parentOrgName; + + /* + * Gets or sets Azure DevOps Project id. + */ + 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. + * 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. + */ + private OnboardingState onboardingState; + + /* + * Configuration payload for PR Annotations. + */ + private ActionableRemediation actionableRemediation; + + /** + * Creates an instance of AzureDevOpsProjectProperties class. + */ + public AzureDevOpsProjectProperties() { + } + + /** + * 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 parentOrgName property: Gets or sets parent Azure DevOps Organization name. + * + * @return the parentOrgName value. + */ + public String parentOrgName() { + return this.parentOrgName; + } + + /** + * Set the parentOrgName property: Gets or sets parent Azure DevOps Organization name. + * + * @param parentOrgName the parentOrgName value to set. + * @return the AzureDevOpsProjectProperties object itself. + */ + public AzureDevOpsProjectProperties withParentOrgName(String parentOrgName) { + this.parentOrgName = parentOrgName; + return this; + } + + /** + * Get the projectId property: Gets or sets Azure DevOps Project id. + * + * @return the projectId value. + */ + public String projectId() { + return this.projectId; + } + + /** + * Get the onboardingState property: 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. + * 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. + * + * @return the onboardingState value. + */ + public OnboardingState onboardingState() { + return this.onboardingState; + } + + /** + * Set the onboardingState property: 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. + * 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. + * + * @param onboardingState the onboardingState value to set. + * @return the AzureDevOpsProjectProperties object itself. + */ + public AzureDevOpsProjectProperties withOnboardingState(OnboardingState onboardingState) { + this.onboardingState = onboardingState; + return this; + } + + /** + * Get the actionableRemediation property: Configuration payload for PR Annotations. + * + * @return the actionableRemediation value. + */ + public ActionableRemediation actionableRemediation() { + return this.actionableRemediation; + } + + /** + * Set the actionableRemediation property: Configuration payload for PR Annotations. + * + * @param actionableRemediation the actionableRemediation value to set. + * @return the AzureDevOpsProjectProperties object itself. + */ + public AzureDevOpsProjectProperties withActionableRemediation(ActionableRemediation actionableRemediation) { + this.actionableRemediation = actionableRemediation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actionableRemediation() != null) { + 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/AzureDevOpsProjects.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjects.java new file mode 100644 index 000000000000..9170a14de895 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjects.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AzureDevOpsProjects. + */ +public interface AzureDevOpsProjects { + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, Context context); + + /** + * Returns a monitored Azure DevOps project resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 azure DevOps Project resource. + */ + AzureDevOpsProject get(String resourceGroupName, String securityConnectorName, String orgName, String projectName); + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName, String orgName); + + /** + * Returns a list of Azure DevOps projects onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName, String orgName, + Context context); + + /** + * Returns a monitored Azure DevOps project 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 azure DevOps Project resource along with {@link Response}. + */ + AzureDevOpsProject getById(String id); + + /** + * Returns a monitored Azure DevOps project 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 azure DevOps Project resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AzureDevOpsProject resource. + * + * @param name resource name. + * @return the first stage of the new AzureDevOpsProject definition. + */ + AzureDevOpsProject.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepos.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepos.java new file mode 100644 index 000000000000..279d05947ab3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepos.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AzureDevOpsRepos. + */ +public interface AzureDevOpsRepos { + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, Context context); + + /** + * Returns a monitored Azure DevOps repository resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @param repoName The repoName 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 azure DevOps Repository resource. + */ + AzureDevOpsRepository get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName); + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName, String orgName, + String projectName); + + /** + * Returns a list of Azure DevOps repositories onboarded to the connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, Context context); + + /** + * Returns a monitored Azure DevOps repository 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 azure DevOps Repository resource along with {@link Response}. + */ + AzureDevOpsRepository getById(String id); + + /** + * Returns a monitored Azure DevOps repository 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 azure DevOps Repository resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AzureDevOpsRepository resource. + * + * @param name resource name. + * @return the first stage of the new AzureDevOpsRepository definition. + */ + AzureDevOpsRepository.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepository.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepository.java new file mode 100644 index 000000000000..3b59c7ab7b85 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepository.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.AzureDevOpsRepositoryInner; + +/** + * An immutable client-side representation of AzureDevOpsRepository. + */ +public interface AzureDevOpsRepository { + /** + * 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 properties property: Azure DevOps Repository properties. + * + * @return the properties value. + */ + AzureDevOpsRepositoryProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.AzureDevOpsRepositoryInner object. + * + * @return the inner object. + */ + AzureDevOpsRepositoryInner innerModel(); + + /** + * The entirety of the AzureDevOpsRepository definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The AzureDevOpsRepository definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AzureDevOpsRepository definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the AzureDevOpsRepository definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, securityConnectorName, orgName, projectName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param orgName The orgName parameter. + * @param projectName The projectName parameter. + * @return the next definition stage. + */ + WithCreate withExistingProject(String resourceGroupName, String securityConnectorName, String orgName, + String projectName); + } + + /** + * The stage of the AzureDevOpsRepository 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. + */ + AzureDevOpsRepository create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AzureDevOpsRepository create(Context context); + } + + /** + * The stage of the AzureDevOpsRepository definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Azure DevOps Repository properties.. + * + * @param properties Azure DevOps Repository properties. + * @return the next definition stage. + */ + WithCreate withProperties(AzureDevOpsRepositoryProperties properties); + } + } + + /** + * Begins update for the AzureDevOpsRepository resource. + * + * @return the stage of resource update. + */ + AzureDevOpsRepository.Update update(); + + /** + * The template for AzureDevOpsRepository update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AzureDevOpsRepository apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AzureDevOpsRepository apply(Context context); + } + + /** + * The AzureDevOpsRepository update stages. + */ + interface UpdateStages { + /** + * The stage of the AzureDevOpsRepository update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Azure DevOps Repository properties.. + * + * @param properties Azure DevOps Repository properties. + * @return the next definition stage. + */ + Update withProperties(AzureDevOpsRepositoryProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AzureDevOpsRepository refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AzureDevOpsRepository refresh(Context context); +} 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 new file mode 100644 index 000000000000..6878dfbd7498 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryProperties.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Azure DevOps Repository properties. + */ +@Fluent +public final class AzureDevOpsRepositoryProperties 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 parent Azure DevOps Organization name. + */ + private String parentOrgName; + + /* + * Gets or sets parent Azure DevOps Project name. + */ + private String parentProjectName; + + /* + * Gets or sets Azure DevOps Repository id. + */ + private String repoId; + + /* + * Gets or sets Azure DevOps Repository url. + */ + private String repoUrl; + + /* + * Gets or sets Azure DevOps repository visibility, whether it is public or private etc. + */ + 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. + * 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. + */ + private OnboardingState onboardingState; + + /* + * Configuration payload for PR Annotations. + */ + private ActionableRemediation actionableRemediation; + + /** + * Creates an instance of AzureDevOpsRepositoryProperties class. + */ + public AzureDevOpsRepositoryProperties() { + } + + /** + * 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 parentOrgName property: Gets or sets parent Azure DevOps Organization name. + * + * @return the parentOrgName value. + */ + public String parentOrgName() { + return this.parentOrgName; + } + + /** + * Set the parentOrgName property: Gets or sets parent Azure DevOps Organization name. + * + * @param parentOrgName the parentOrgName value to set. + * @return the AzureDevOpsRepositoryProperties object itself. + */ + public AzureDevOpsRepositoryProperties withParentOrgName(String parentOrgName) { + this.parentOrgName = parentOrgName; + return this; + } + + /** + * Get the parentProjectName property: Gets or sets parent Azure DevOps Project name. + * + * @return the parentProjectName value. + */ + public String parentProjectName() { + return this.parentProjectName; + } + + /** + * Set the parentProjectName property: Gets or sets parent Azure DevOps Project name. + * + * @param parentProjectName the parentProjectName value to set. + * @return the AzureDevOpsRepositoryProperties object itself. + */ + public AzureDevOpsRepositoryProperties withParentProjectName(String parentProjectName) { + this.parentProjectName = parentProjectName; + return this; + } + + /** + * Get the repoId property: Gets or sets Azure DevOps Repository id. + * + * @return the repoId value. + */ + public String repoId() { + return this.repoId; + } + + /** + * Get the repoUrl property: Gets or sets Azure DevOps Repository url. + * + * @return the repoUrl value. + */ + public String repoUrl() { + return this.repoUrl; + } + + /** + * Get the visibility property: Gets or sets Azure DevOps repository visibility, whether it is public or private + * etc. + * + * @return the visibility value. + */ + public String visibility() { + return this.visibility; + } + + /** + * Get the onboardingState property: 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. + * 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. + * + * @return the onboardingState value. + */ + public OnboardingState onboardingState() { + return this.onboardingState; + } + + /** + * Set the onboardingState property: 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. + * 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. + * + * @param onboardingState the onboardingState value to set. + * @return the AzureDevOpsRepositoryProperties object itself. + */ + public AzureDevOpsRepositoryProperties withOnboardingState(OnboardingState onboardingState) { + this.onboardingState = onboardingState; + return this; + } + + /** + * Get the actionableRemediation property: Configuration payload for PR Annotations. + * + * @return the actionableRemediation value. + */ + public ActionableRemediation actionableRemediation() { + return this.actionableRemediation; + } + + /** + * Set the actionableRemediation property: Configuration payload for PR Annotations. + * + * @param actionableRemediation the actionableRemediation value to set. + * @return the AzureDevOpsRepositoryProperties object itself. + */ + public AzureDevOpsRepositoryProperties withActionableRemediation(ActionableRemediation actionableRemediation) { + this.actionableRemediation = actionableRemediation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actionableRemediation() != null) { + 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 new file mode 100644 index 000000000000..d23429d03a4f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsScopeEnvironmentData.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AzureDevOps scope connector's environment data. + */ +@Immutable +public final class AzureDevOpsScopeEnvironmentData extends EnvironmentData { + /* + * The type of the environment data. + */ + private EnvironmentType environmentType = EnvironmentType.AZURE_DEV_OPS_SCOPE; + + /** + * Creates an instance of AzureDevOpsScopeEnvironmentData class. + */ + public AzureDevOpsScopeEnvironmentData() { + } + + /** + * Get the environmentType property: The type of the environment data. + * + * @return the environmentType value. + */ + @Override + public EnvironmentType environmentType() { + return this.environmentType; + } + + /** + * 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("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 7ba3143dd4bb..105a294f315f 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; 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 8bea00ee3724..8310273a7474 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -28,7 +28,7 @@ public final class AzureResourceIdentifier extends ResourceIdentifier { /** * Creates an instance of AzureResourceIdentifier class. */ - public AzureResourceIdentifier() { + private AzureResourceIdentifier() { } /** 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 976bf5e1201e..b9134215bddf 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -24,7 +24,7 @@ public final class AzureResourceLink implements JsonSerializable { + /* + * Expected results. + */ + private List> expectedResults; + + /* + * Baseline update time (UTC). + */ + private OffsetDateTime updatedTime; + + /** + * Creates an instance of Baseline class. + */ + private Baseline() { + } + + /** + * Get the expectedResults property: Expected results. + * + * @return the expectedResults value. + */ + public List> expectedResults() { + return this.expectedResults; + } + + /** + * Get the updatedTime property: Baseline update time (UTC). + * + * @return the updatedTime value. + */ + public OffsetDateTime updatedTime() { + return this.updatedTime; + } + + /** + * 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.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 new file mode 100644 index 000000000000..00c89d1aa468 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * The rule result adjusted with baseline. + */ +@Immutable +public final class BaselineAdjustedResult implements JsonSerializable { + /* + * Baseline details. + */ + private Baseline baseline; + + /* + * The rule result status. + */ + private RuleStatus status; + + /* + * Results that are not in the baseline. + */ + private List> resultsNotInBaseline; + + /* + * Results that are in the baseline. + */ + private List> resultsOnlyInBaseline; + + /** + * Creates an instance of BaselineAdjustedResult class. + */ + private BaselineAdjustedResult() { + } + + /** + * Get the baseline property: Baseline details. + * + * @return the baseline value. + */ + public Baseline baseline() { + return this.baseline; + } + + /** + * Get the status property: The rule result status. + * + * @return the status value. + */ + public RuleStatus status() { + return this.status; + } + + /** + * Get the resultsNotInBaseline property: Results that are not in the baseline. + * + * @return the resultsNotInBaseline value. + */ + public List> resultsNotInBaseline() { + return this.resultsNotInBaseline; + } + + /** + * Get the resultsOnlyInBaseline property: Results that are in the baseline. + * + * @return the resultsOnlyInBaseline value. + */ + public List> resultsOnlyInBaseline() { + return this.resultsOnlyInBaseline; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (baseline() != null) { + 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 new file mode 100644 index 000000000000..06fe4ef41c5e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 benchmark references. + */ +@Immutable +public final class BenchmarkReference implements JsonSerializable { + /* + * The benchmark name. + */ + private String benchmark; + + /* + * The benchmark reference. + */ + private String reference; + + /** + * Creates an instance of BenchmarkReference class. + */ + private BenchmarkReference() { + } + + /** + * Get the benchmark property: The benchmark name. + * + * @return the benchmark value. + */ + public String benchmark() { + return this.benchmark; + } + + /** + * Get the reference property: The benchmark reference. + * + * @return the reference value. + */ + public String reference() { + return this.reference; + } + + /** + * 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("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/BlobScanResultsOptions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobScanResultsOptions.java new file mode 100644 index 000000000000..0dca5c7252b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobScanResultsOptions.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Optional. Write scan result on BlobIndexTags by default. + */ +public final class BlobScanResultsOptions extends ExpandableStringEnum { + /** + * Write scan results on the blobs index tags. + */ + public static final BlobScanResultsOptions BLOB_INDEX_TAGS = fromString("BlobIndexTags"); + + /** + * Do not write scan results on the blobs index tags. + */ + public static final BlobScanResultsOptions NONE = fromString("None"); + + /** + * Creates a new instance of BlobScanResultsOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BlobScanResultsOptions() { + } + + /** + * Creates or finds a BlobScanResultsOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding BlobScanResultsOptions. + */ + public static BlobScanResultsOptions fromString(String name) { + return fromString(name, BlobScanResultsOptions.class); + } + + /** + * Gets known BlobScanResultsOptions values. + * + * @return known BlobScanResultsOptions values. + */ + public static Collection values() { + return values(BlobScanResultsOptions.class); + } +} 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..b77e064fca83 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * A summary of the scan results of the blobs that were scanned. + */ +@Immutable +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 failed blob scans. + */ + private Long failedBlobsCount; + + /* + * The number of gigabytes of data that were scanned. + */ + private Double scannedBlobsInGB; + + /** + * Creates an instance of BlobsScanSummary class. + */ + private BlobsScanSummary() { + } + + /** + * Get the totalBlobsScanned property: The total number of blobs that were scanned. + * + * @return the totalBlobsScanned value. + */ + public Long totalBlobsScanned() { + return this.totalBlobsScanned; + } + + /** + * 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; + } + + /** + * Get the skippedBlobsCount property: The number of blobs that were skipped. + * + * @return the skippedBlobsCount value. + */ + public Long skippedBlobsCount() { + return this.skippedBlobsCount; + } + + /** + * Get the failedBlobsCount property: The number of failed blob scans. + * + * @return the failedBlobsCount value. + */ + public Long failedBlobsCount() { + return this.failedBlobsCount; + } + + /** + * Get the scannedBlobsInGB property: The number of gigabytes of data that were scanned. + * + * @return the scannedBlobsInGB value. + */ + public Double scannedBlobsInGB() { + return this.scannedBlobsInGB; + } + + /** + * 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("failedBlobsCount", this.failedBlobsCount); + 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 ("failedBlobsCount".equals(fieldName)) { + deserializedBlobsScanSummary.failedBlobsCount = 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 new file mode 100644 index 000000000000..1eb255919123 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BuiltInInfoType.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Pre-configured sensitive information type. + */ +@Immutable +public final class BuiltInInfoType implements JsonSerializable { + /* + * Display name of the info type + */ + private String name; + + /* + * Id of the info type + */ + private String id; + + /* + * Category of the built-in info type + */ + private String type; + + /** + * Creates an instance of BuiltInInfoType class. + */ + private BuiltInInfoType() { + } + + /** + * Get the name property: Display name of the info type. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the id property: Id of the info type. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: Category of the built-in info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * 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("name", this.name); + jsonWriter.writeStringField("id", this.id); + 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.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 d225cf997749..fba936936331 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,47 +12,47 @@ */ public final class BundleType extends ExpandableStringEnum { /** - * Static value AppServices for BundleType. + * AppServices. */ public static final BundleType APP_SERVICES = fromString("AppServices"); /** - * Static value DNS for BundleType. + * DNS. */ public static final BundleType DNS = fromString("DNS"); /** - * Static value KeyVaults for BundleType. + * KeyVaults. */ public static final BundleType KEY_VAULTS = fromString("KeyVaults"); /** - * Static value KubernetesService for BundleType. + * KubernetesService. */ public static final BundleType KUBERNETES_SERVICE = fromString("KubernetesService"); /** - * Static value ResourceManager for BundleType. + * ResourceManager. */ public static final BundleType RESOURCE_MANAGER = fromString("ResourceManager"); /** - * Static value SqlServers for BundleType. + * SqlServers. */ public static final BundleType SQL_SERVERS = fromString("SqlServers"); /** - * Static value StorageAccounts for BundleType. + * StorageAccounts. */ public static final BundleType STORAGE_ACCOUNTS = fromString("StorageAccounts"); /** - * Static value VirtualMachines for BundleType. + * VirtualMachines. */ public static final BundleType VIRTUAL_MACHINES = fromString("VirtualMachines"); /** - * Static value CosmosDbs for BundleType. + * CosmosDbs. */ public static final BundleType COSMOS_DBS = fromString("CosmosDbs"); 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 5bf617e939f4..b77e865e3bf8 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,30 +12,40 @@ */ public final class Categories extends ExpandableStringEnum { /** - * Static value Compute for Categories. + * Compute. */ public static final Categories COMPUTE = fromString("Compute"); /** - * Static value Networking for Categories. + * Networking. */ public static final Categories NETWORKING = fromString("Networking"); /** - * Static value Data for Categories. + * Data. */ public static final Categories DATA = fromString("Data"); /** - * Static value IdentityAndAccess for Categories. + * IdentityAndAccess. */ public static final Categories IDENTITY_AND_ACCESS = fromString("IdentityAndAccess"); /** - * Static value IoT for Categories. + * IoT. */ public static final Categories IOT = fromString("IoT"); + /** + * Container. + */ + public static final Categories CONTAINER = fromString("Container"); + + /** + * AppServices. + */ + public static final Categories APP_SERVICES = fromString("AppServices"); + /** * Creates a new instance of Categories value. * 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 new file mode 100644 index 000000000000..a4bf9266e6d2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CategoryConfiguration.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Severity level per category configuration for PR Annotations. + */ +@Fluent +public final class CategoryConfiguration implements JsonSerializable { + /* + * Gets or sets minimum severity level for a given category. + */ + private String minimumSeverityLevel; + + /* + * Rule categories. + * Code - code scanning results. + * Artifact scanning results. + * Dependencies scanning results. + * IaC results. + * Secrets scanning results. + * Container scanning results. + */ + private RuleCategory category; + + /** + * Creates an instance of CategoryConfiguration class. + */ + public CategoryConfiguration() { + } + + /** + * Get the minimumSeverityLevel property: Gets or sets minimum severity level for a given category. + * + * @return the minimumSeverityLevel value. + */ + public String minimumSeverityLevel() { + return this.minimumSeverityLevel; + } + + /** + * Set the minimumSeverityLevel property: Gets or sets minimum severity level for a given category. + * + * @param minimumSeverityLevel the minimumSeverityLevel value to set. + * @return the CategoryConfiguration object itself. + */ + public CategoryConfiguration withMinimumSeverityLevel(String minimumSeverityLevel) { + this.minimumSeverityLevel = minimumSeverityLevel; + return this; + } + + /** + * Get the category property: Rule categories. + * Code - code scanning results. + * Artifact scanning results. + * Dependencies scanning results. + * IaC results. + * Secrets scanning results. + * Container scanning results. + * + * @return the category value. + */ + public RuleCategory category() { + return this.category; + } + + /** + * Set the category property: Rule categories. + * Code - code scanning results. + * Artifact scanning results. + * Dependencies scanning results. + * IaC results. + * Secrets scanning results. + * Container scanning results. + * + * @param category the category value to set. + * @return the CategoryConfiguration object itself. + */ + public CategoryConfiguration withCategory(RuleCategory category) { + this.category = category; + 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("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 ea7a5aa56537..3e4c87b9b4c2 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 @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -14,7 +15,7 @@ /** * Represents a security solution which sends CEF logs to an OMS workspace. */ -@Fluent +@Immutable public final class CefExternalSecuritySolution extends ExternalSecuritySolutionInner { /* * The kind of the external solution @@ -26,6 +27,11 @@ public final class CefExternalSecuritySolution extends ExternalSecuritySolutionI */ private CefSolutionProperties properties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * Location where the resource is stored */ @@ -49,7 +55,7 @@ public final class CefExternalSecuritySolution extends ExternalSecuritySolutionI /** * Creates an instance of CefExternalSecuritySolution class. */ - public CefExternalSecuritySolution() { + private CefExternalSecuritySolution() { } /** @@ -67,19 +73,19 @@ public ExternalSecuritySolutionKind kind() { * * @return the properties value. */ + @Override public CefSolutionProperties properties() { return this.properties; } /** - * Set the properties property: The external security solution properties for CEF solutions. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param properties the properties value to set. - * @return the CefExternalSecuritySolution object itself. + * @return the systemData value. */ - public CefExternalSecuritySolution withProperties(CefSolutionProperties properties) { - this.properties = properties; - return this; + @Override + public SystemData systemData() { + return this.systemData; } /** @@ -169,6 +175,8 @@ public static CefExternalSecuritySolution fromJson(JsonReader jsonReader) throws deserializedCefExternalSecuritySolution.type = reader.getString(); } else if ("location".equals(fieldName)) { deserializedCefExternalSecuritySolution.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCefExternalSecuritySolution.systemData = SystemData.fromJson(reader); } else if ("kind".equals(fieldName)) { deserializedCefExternalSecuritySolution.kind = ExternalSecuritySolutionKind.fromString(reader.getString()); 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 09272fc5a237..6f13964c237d 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -15,7 +15,7 @@ /** * The external security solution properties for CEF solutions. */ -@Fluent +@Immutable public final class CefSolutionProperties extends ExternalSecuritySolutionProperties { /* * The hostname property. @@ -32,10 +32,30 @@ public final class CefSolutionProperties extends ExternalSecuritySolutionPropert */ private String lastEventReceived; + /* + * The solution properties (correspond to the solution kind) + */ + private Map additionalProperties; + + /* + * Represents an OMS workspace to which the solution is connected + */ + private ConnectedWorkspace workspace; + + /* + * The deviceType property. + */ + private String deviceType; + + /* + * The deviceVendor property. + */ + private String deviceVendor; + /** * Creates an instance of CefSolutionProperties class. */ - public CefSolutionProperties() { + private CefSolutionProperties() { } /** @@ -47,17 +67,6 @@ public String hostname() { return this.hostname; } - /** - * Set the hostname property: The hostname property. - * - * @param hostname the hostname value to set. - * @return the CefSolutionProperties object itself. - */ - public CefSolutionProperties withHostname(String hostname) { - this.hostname = hostname; - return this; - } - /** * Get the agent property: The agent property. * @@ -67,17 +76,6 @@ public String agent() { return this.agent; } - /** - * Set the agent property: The agent property. - * - * @param agent the agent value to set. - * @return the CefSolutionProperties object itself. - */ - public CefSolutionProperties withAgent(String agent) { - this.agent = agent; - return this; - } - /** * Get the lastEventReceived property: The lastEventReceived property. * @@ -88,41 +86,43 @@ public String lastEventReceived() { } /** - * Set the lastEventReceived property: The lastEventReceived property. + * Get the additionalProperties property: The solution properties (correspond to the solution kind). * - * @param lastEventReceived the lastEventReceived value to set. - * @return the CefSolutionProperties object itself. + * @return the additionalProperties value. */ - public CefSolutionProperties withLastEventReceived(String lastEventReceived) { - this.lastEventReceived = lastEventReceived; - return this; + @Override + public Map additionalProperties() { + return this.additionalProperties; } /** - * {@inheritDoc} + * Get the workspace property: Represents an OMS workspace to which the solution is connected. + * + * @return the workspace value. */ @Override - public CefSolutionProperties withDeviceVendor(String deviceVendor) { - super.withDeviceVendor(deviceVendor); - return this; + public ConnectedWorkspace workspace() { + return this.workspace; } /** - * {@inheritDoc} + * Get the deviceType property: The deviceType property. + * + * @return the deviceType value. */ @Override - public CefSolutionProperties withDeviceType(String deviceType) { - super.withDeviceType(deviceType); - return this; + public String deviceType() { + return this.deviceType; } /** - * {@inheritDoc} + * Get the deviceVendor property: The deviceVendor property. + * + * @return the deviceVendor value. */ @Override - public CefSolutionProperties withWorkspace(ConnectedWorkspace workspace) { - super.withWorkspace(workspace); - return this; + public String deviceVendor() { + return this.deviceVendor; } /** @@ -174,11 +174,11 @@ public static CefSolutionProperties fromJson(JsonReader jsonReader) throws IOExc reader.nextToken(); if ("deviceVendor".equals(fieldName)) { - deserializedCefSolutionProperties.withDeviceVendor(reader.getString()); + deserializedCefSolutionProperties.deviceVendor = reader.getString(); } else if ("deviceType".equals(fieldName)) { - deserializedCefSolutionProperties.withDeviceType(reader.getString()); + deserializedCefSolutionProperties.deviceType = reader.getString(); } else if ("workspace".equals(fieldName)) { - deserializedCefSolutionProperties.withWorkspace(ConnectedWorkspace.fromJson(reader)); + deserializedCefSolutionProperties.workspace = ConnectedWorkspace.fromJson(reader); } else if ("hostname".equals(fieldName)) { deserializedCefSolutionProperties.hostname = reader.getString(); } else if ("agent".equals(fieldName)) { @@ -193,7 +193,7 @@ public static CefSolutionProperties fromJson(JsonReader jsonReader) throws IOExc additionalProperties.put(fieldName, reader.readUntyped()); } } - deserializedCefSolutionProperties.withAdditionalProperties(additionalProperties); + deserializedCefSolutionProperties.additionalProperties = 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 new file mode 100644 index 000000000000..c178dfff8d65 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudName.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The multi cloud resource's cloud name. + */ +public final class CloudName extends ExpandableStringEnum { + /** + * Azure. + */ + public static final CloudName AZURE = fromString("Azure"); + + /** + * AWS. + */ + public static final CloudName AWS = fromString("AWS"); + + /** + * GCP. + */ + public static final CloudName GCP = fromString("GCP"); + + /** + * Github. + */ + public static final CloudName GITHUB = fromString("Github"); + + /** + * AzureDevOps. + */ + public static final CloudName AZURE_DEV_OPS = fromString("AzureDevOps"); + + /** + * GitLab. + */ + public static final CloudName GIT_LAB = fromString("GitLab"); + + /** + * DockerHub. + */ + public static final CloudName DOCKER_HUB = fromString("DockerHub"); + + /** + * JFrog. + */ + public static final CloudName JFROG = fromString("JFrog"); + + /** + * Creates a new instance of CloudName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CloudName() { + } + + /** + * Creates or finds a CloudName from its string representation. + * + * @param name a name to look for. + * @return the corresponding CloudName. + */ + public static CloudName fromString(String name) { + return fromString(name, CloudName.class); + } + + /** + * Gets known CloudName values. + * + * @return known CloudName values. + */ + public static Collection values() { + return values(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 new file mode 100644 index 000000000000..e73f3e6c5fe4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudOffering.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 security offering details. + */ +@Immutable +public class CloudOffering implements JsonSerializable { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.fromString("cloudOffering"); + + /* + * The offering description. + */ + private String description; + + /** + * Creates an instance of CloudOffering class. + */ + public CloudOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the description property: The offering description. + * + * @return the description value. + */ + 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. + * + * @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("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 deleted file mode 100644 index 9239bcbeffc2..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Code.java +++ /dev/null @@ -1,51 +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 java.util.Collection; - -/** - * The operation status code. - */ -public final class Code extends ExpandableStringEnum { - /** - * Static value Succeeded for Code. - */ - public static final Code SUCCEEDED = fromString("Succeeded"); - - /** - * Static value Failed for Code. - */ - public static final Code FAILED = fromString("Failed"); - - /** - * Creates a new instance of Code value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public Code() { - } - - /** - * Creates or finds a Code from its string representation. - * - * @param name a name to look for. - * @return the corresponding Code. - */ - public static Code fromString(String name) { - return fromString(name, Code.class); - } - - /** - * Gets known Code values. - * - * @return known Code values. - */ - public static Collection values() { - return values(Code.class); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java new file mode 100644 index 000000000000..1a0155629058 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * An immutable client-side representation of Compliance. + */ +public interface Compliance { + /** + * 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 assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted. + * + * @return the assessmentTimestampUtcDate value. + */ + OffsetDateTime assessmentTimestampUtcDate(); + + /** + * Gets the resourceCount property: The resource count of the given subscription for which the Compliance + * calculation was conducted (needed for Management Group Compliance calculation). + * + * @return the resourceCount value. + */ + Integer resourceCount(); + + /** + * Gets the assessmentResult property: An array of segment, which is the actually the compliance assessment. + * + * @return the assessmentResult value. + */ + List assessmentResult(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ComplianceInner object. + * + * @return the inner object. + */ + ComplianceInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResult.java index bfb4965af144..e01faad609a8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResult.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResult.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; /** @@ -31,6 +32,13 @@ public interface ComplianceResult { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the resourceStatus property: The status of the resource regarding a single assessment. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java index 5b32e6ad8632..2b84a79a988e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResults.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,52 +13,50 @@ */ public interface ComplianceResults { /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. + * @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 compliance results response as paginated response with {@link PagedIterable}. + * @return a compliance result along with {@link Response}. */ - PagedIterable list(String scope); + Response getWithResponse(String resourceId, String complianceResultName, Context context); /** - * Security compliance results in the subscription. + * Security Compliance Result. * - * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or - * management group (/providers/Microsoft.Management/managementGroups/mgName). - * @param context The context to associate with this operation. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param complianceResultName The compliance result key. * @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 compliance results response as paginated response with {@link PagedIterable}. + * @return a compliance result. */ - PagedIterable list(String scope, Context context); + ComplianceResult get(String resourceId, String complianceResultName); /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. - * @param context The context to associate with this operation. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result along with {@link Response}. + * @return list of compliance results response as paginated response with {@link PagedIterable}. */ - Response getWithResponse(String resourceId, String complianceResultName, Context context); + PagedIterable list(String scope); /** - * Security Compliance Result. + * Security compliance results in the subscription. * - * @param resourceId The identifier of the resource. - * @param complianceResultName name of the desired assessment compliance result. + * @param scope The fully qualified Azure Resource manager identifier 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 compliance result. + * @return list of compliance results response as paginated response with {@link PagedIterable}. */ - ComplianceResult get(String resourceId, String complianceResultName); + PagedIterable list(String scope, Context context); } 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 new file mode 100644 index 000000000000..834ac9098401 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * A segment of a compliance assessment. + */ +@Immutable +public final class ComplianceSegment implements JsonSerializable { + /* + * The segment type, e.g. compliant, non-compliance, insufficient coverage, N/A, etc. + */ + private String segmentType; + + /* + * The size (%) of the segment. + */ + private Double percentage; + + /** + * Creates an instance of ComplianceSegment class. + */ + private ComplianceSegment() { + } + + /** + * Get the segmentType property: The segment type, e.g. compliant, non-compliance, insufficient coverage, N/A, etc. + * + * @return the segmentType value. + */ + public String segmentType() { + return this.segmentType; + } + + /** + * Get the percentage property: The size (%) of the segment. + * + * @return the percentage value. + */ + public Double percentage() { + return this.percentage; + } + + /** + * 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(); + 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/Compliances.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliances.java new file mode 100644 index 000000000000..3b685e02a389 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliances.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Compliances. + */ +public interface Compliances { + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @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 compliance of a scope along with {@link Response}. + */ + Response getWithResponse(String scope, String complianceName, Context context); + + /** + * Details of a specific Compliance. + * + * @param scope The fully qualified Azure Resource manager identifier of the resource. + * @param complianceName name of the Compliance. + * @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 compliance of a scope. + */ + Compliance get(String scope, String complianceName); + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * The Compliance scores of the specific management group. + * + * @param scope The fully qualified Azure Resource manager identifier 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 list of Compliance objects response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope, Context context); +} 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 e58dd19f47df..ad3e5c2d9290 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -35,7 +35,7 @@ public final class ConnectableResource implements JsonSerializable { /* * Azure resource ID of the connected OMS workspace @@ -24,7 +24,7 @@ public final class ConnectedWorkspace implements JsonSerializable allowlistValues) { - super.withAllowlistValues(allowlistValues); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ConnectionFromIpNotAllowed withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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 deleted file mode 100644 index 8ff6d4912919..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java +++ /dev/null @@ -1,125 +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.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. - */ -@Fluent -public final class ConnectionToIpNotAllowed extends AllowlistCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "ConnectionToIpNotAllowed"; - - /** - * Creates an instance of ConnectionToIpNotAllowed class. - */ - public ConnectionToIpNotAllowed() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public ConnectionToIpNotAllowed withAllowlistValues(List allowlistValues) { - super.withAllowlistValues(allowlistValues); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ConnectionToIpNotAllowed withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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 fd6ee4b9b3e7..3154ce4e40e5 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,12 +12,12 @@ */ public final class ConnectionType extends ExpandableStringEnum { /** - * Static value Internal for ConnectionType. + * Internal. */ public static final ConnectionType INTERNAL = fromString("Internal"); /** - * Static value External for ConnectionType. + * External. */ public static final ConnectionType EXTERNAL = fromString("External"); 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 new file mode 100644 index 000000000000..ea7c1482728e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +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; + +/** + * Additional context fields for container registry Vulnerability assessment. + */ +@Immutable +public final class ContainerRegistryVulnerabilityProperties extends AdditionalData { + /* + * Sub-assessment resource type + */ + private AssessedResourceType assessedResourceType = AssessedResourceType.CONTAINER_REGISTRY_VULNERABILITY; + + /* + * Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability + */ + private String type; + + /* + * Dictionary from cvss version to cvss details object + */ + private Map cvss; + + /* + * Indicates whether a patch is available or not + */ + private Boolean patchable; + + /* + * List of CVEs + */ + private List cve; + + /* + * Published time + */ + private OffsetDateTime publishedTime; + + /* + * The vendorReferences property. + */ + private List vendorReferences; + + /* + * Name of the repository which the vulnerable image belongs to + */ + private String repositoryName; + + /* + * Digest of the vulnerable image + */ + private String imageDigest; + + /** + * Creates an instance of ContainerRegistryVulnerabilityProperties class. + */ + private ContainerRegistryVulnerabilityProperties() { + } + + /** + * Get the assessedResourceType property: Sub-assessment resource type. + * + * @return the assessedResourceType value. + */ + @Override + public AssessedResourceType assessedResourceType() { + return this.assessedResourceType; + } + + /** + * Get the type property: Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, + * Vulnerability. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the cvss property: Dictionary from cvss version to cvss details object. + * + * @return the cvss value. + */ + public Map cvss() { + return this.cvss; + } + + /** + * Get the patchable property: Indicates whether a patch is available or not. + * + * @return the patchable value. + */ + public Boolean patchable() { + return this.patchable; + } + + /** + * Get the cve property: List of CVEs. + * + * @return the cve value. + */ + public List cve() { + return this.cve; + } + + /** + * Get the publishedTime property: Published time. + * + * @return the publishedTime value. + */ + public OffsetDateTime publishedTime() { + return this.publishedTime; + } + + /** + * Get the vendorReferences property: The vendorReferences property. + * + * @return the vendorReferences value. + */ + public List vendorReferences() { + return this.vendorReferences; + } + + /** + * Get the repositoryName property: Name of the repository which the vulnerable image belongs to. + * + * @return the repositoryName value. + */ + public String repositoryName() { + return this.repositoryName; + } + + /** + * Get the imageDigest property: Digest of the vulnerable image. + * + * @return the imageDigest value. + */ + public String imageDigest() { + return this.imageDigest; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (cvss() != null) { + cvss().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (cve() != null) { + cve().forEach(e -> e.validate()); + } + if (vendorReferences() != null) { + 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 72bba5e02ff6..0086a941a9fa 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,12 +12,12 @@ */ public final class ControlType extends ExpandableStringEnum { /** - * Static value BuiltIn for ControlType. + * Microsoft Defender for Cloud managed assessments. */ public static final ControlType BUILT_IN = fromString("BuiltIn"); /** - * Static value Custom for ControlType. + * Non Microsoft Defender for Cloud managed assessments. */ public static final ControlType CUSTOM = fromString("Custom"); 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 new file mode 100644 index 000000000000..2ecc6d39bab7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOffering.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 monitoring for AWS offering. + */ +@Fluent +public final class CspmMonitorAwsOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_AWS; + + /* + * The native cloud connection configuration + */ + private CspmMonitorAwsOfferingNativeCloudConnection nativeCloudConnection; + + /** + * Creates an instance of CspmMonitorAwsOffering class. + */ + public CspmMonitorAwsOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the nativeCloudConnection property: The native cloud connection configuration. + * + * @return the nativeCloudConnection value. + */ + public CspmMonitorAwsOfferingNativeCloudConnection nativeCloudConnection() { + return this.nativeCloudConnection; + } + + /** + * Set the nativeCloudConnection property: The native cloud connection configuration. + * + * @param nativeCloudConnection the nativeCloudConnection value to set. + * @return the CspmMonitorAwsOffering object itself. + */ + public CspmMonitorAwsOffering + withNativeCloudConnection(CspmMonitorAwsOfferingNativeCloudConnection nativeCloudConnection) { + this.nativeCloudConnection = nativeCloudConnection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..ec5169db73e2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOfferingNativeCloudConnection.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 native cloud connection configuration. + */ +@Fluent +public final class CspmMonitorAwsOfferingNativeCloudConnection + implements JsonSerializable { + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of CspmMonitorAwsOfferingNativeCloudConnection class. + */ + public CspmMonitorAwsOfferingNativeCloudConnection() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the CspmMonitorAwsOfferingNativeCloudConnection object itself. + */ + public CspmMonitorAwsOfferingNativeCloudConnection withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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("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 new file mode 100644 index 000000000000..e891ab1bfacf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAzureDevOpsOffering.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 monitoring for AzureDevOps offering. + */ +@Immutable +public final class CspmMonitorAzureDevOpsOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_AZURE_DEV_OPS; + + /** + * Creates an instance of CspmMonitorAzureDevOpsOffering class. + */ + public CspmMonitorAzureDevOpsOffering() { + } + + /** + * 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 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..5d73f0fa82c7 --- /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) TypeSpec 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 new file mode 100644 index 000000000000..ab89bafa45fa --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOffering.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 monitoring for GCP offering. + */ +@Fluent +public final class CspmMonitorGcpOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_GCP; + + /* + * The native cloud connection configuration + */ + private CspmMonitorGcpOfferingNativeCloudConnection nativeCloudConnection; + + /** + * Creates an instance of CspmMonitorGcpOffering class. + */ + public CspmMonitorGcpOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the nativeCloudConnection property: The native cloud connection configuration. + * + * @return the nativeCloudConnection value. + */ + public CspmMonitorGcpOfferingNativeCloudConnection nativeCloudConnection() { + return this.nativeCloudConnection; + } + + /** + * Set the nativeCloudConnection property: The native cloud connection configuration. + * + * @param nativeCloudConnection the nativeCloudConnection value to set. + * @return the CspmMonitorGcpOffering object itself. + */ + public CspmMonitorGcpOffering + withNativeCloudConnection(CspmMonitorGcpOfferingNativeCloudConnection nativeCloudConnection) { + this.nativeCloudConnection = nativeCloudConnection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..b1b782685ddb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOfferingNativeCloudConnection.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 native cloud connection configuration. + */ +@Fluent +public final class CspmMonitorGcpOfferingNativeCloudConnection + implements JsonSerializable { + /* + * The GCP workload identity provider id for the offering + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for this offering + */ + private String serviceAccountEmailAddress; + + /** + * Creates an instance of CspmMonitorGcpOfferingNativeCloudConnection class. + */ + public CspmMonitorGcpOfferingNativeCloudConnection() { + } + + /** + * Get the workloadIdentityProviderId property: The GCP workload identity provider id for the offering. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The GCP workload identity provider id for the offering. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the CspmMonitorGcpOfferingNativeCloudConnection object itself. + */ + public CspmMonitorGcpOfferingNativeCloudConnection + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this offering. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this offering. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the CspmMonitorGcpOfferingNativeCloudConnection object itself. + */ + public CspmMonitorGcpOfferingNativeCloudConnection + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + 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("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 new file mode 100644 index 000000000000..14c6e9635447 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGitLabOffering.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 gitlab offering. + */ +@Immutable +public final class CspmMonitorGitLabOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_GIT_LAB; + + /** + * Creates an instance of CspmMonitorGitLabOffering class. + */ + public CspmMonitorGitLabOffering() { + } + + /** + * 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 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 new file mode 100644 index 000000000000..380b3c191634 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGithubOffering.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 monitoring for github offering. + */ +@Immutable +public final class CspmMonitorGithubOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_GITHUB; + + /** + * Creates an instance of CspmMonitorGithubOffering class. + */ + public CspmMonitorGithubOffering() { + } + + /** + * 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 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..44c1db199f48 --- /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) TypeSpec 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 67927fca5781..bcf50b692e77 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -155,56 +155,16 @@ public static CustomAlertRule fromJson(JsonReader jsonReader) throws IOException } } // 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)) { + 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 if ("AllowlistCustomAlertRule".equals(discriminatorValue)) { + return AllowlistCustomAlertRule.fromJson(readerToUse.reset()); + } else if ("ThresholdCustomAlertRule".equals(discriminatorValue)) { + return ThresholdCustomAlertRule.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("TimeWindowCustomAlertRule".equals(discriminatorValue)) { + return TimeWindowCustomAlertRule.fromJson(readerToUse.reset()); } else { return fromJsonKnownDiscriminator(readerToUse.reset()); } 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 index 78f38dedef9d..54f985d64b53 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -129,10 +129,7 @@ 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})'. + * @param scope The fully qualified Azure Resource manager identifier of the resource. * @return the next definition stage. */ WithCreate withExistingScope(String scope); 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 index 0510ac33ccaa..35f4996200d4 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,44 +12,10 @@ * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -63,10 +29,7 @@ public interface CustomRecommendations { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -78,10 +41,7 @@ public interface CustomRecommendations { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @param customRecommendationName Name of the Custom Recommendation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -94,10 +54,7 @@ public interface CustomRecommendations { /** * 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 scope The fully qualified Azure Resource manager identifier of the resource. * @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. @@ -105,6 +62,31 @@ public interface CustomRecommendations { */ void deleteByResourceGroup(String scope, String customRecommendationName); + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The fully qualified Azure Resource manager identifier 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 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 fully qualified Azure Resource manager identifier 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 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. * 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 new file mode 100644 index 000000000000..a4ef8a19c817 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * CVE details. + */ +@Immutable +public final class Cve implements JsonSerializable { + /* + * CVE title + */ + private String title; + + /* + * Link url + */ + private String link; + + /** + * Creates an instance of Cve class. + */ + private Cve() { + } + + /** + * Get the title property: CVE title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the link property: Link url. + * + * @return the link value. + */ + public String link() { + return this.link; + } + + /** + * 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(); + 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 new file mode 100644 index 000000000000..ff912d628826 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * CVSS details. + */ +@Immutable +public final class Cvss implements JsonSerializable { + /* + * CVSS base + */ + private Float base; + + /** + * Creates an instance of Cvss class. + */ + private Cvss() { + } + + /** + * Get the base property: CVSS base. + * + * @return the base value. + */ + public Float base() { + return this.base; + } + + /** + * 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(); + 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 0b01a0609343..adab15b29852 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 @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. 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; @@ -27,6 +28,11 @@ public final class DataExportSettings extends SettingInner { */ private DataExportSettingProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -67,6 +73,16 @@ private DataExportSettingProperties 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. * @@ -97,6 +113,15 @@ public String id() { return this.id; } + /** + * {@inheritDoc} + */ + @Override + public DataExportSettings withProperties(SettingProperties properties) { + super.withProperties(properties); + return this; + } + /** * Get the enabled property: Is the data export setting enabled. * @@ -130,6 +155,9 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } + if (properties() != null) { + properties().validate(); + } } /** @@ -165,6 +193,8 @@ public static DataExportSettings fromJson(JsonReader jsonReader) throws IOExcept deserializedDataExportSettings.name = reader.getString(); } else if ("type".equals(fieldName)) { deserializedDataExportSettings.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedDataExportSettings.systemData = SystemData.fromJson(reader); } else if ("kind".equals(fieldName)) { deserializedDataExportSettings.kind = SettingKind.fromString(reader.getString()); } else if ("properties".equals(fieldName)) { 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 152af77daee2..09ac98c9e2c0 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,7 +12,7 @@ */ public final class DataSource extends ExpandableStringEnum { /** - * Static value TwinData for DataSource. + * Devices twin data. */ public static final DataSource TWIN_DATA = fromString("TwinData"); 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 new file mode 100644 index 000000000000..d658ad9f371d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOffering.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 AWS offering. + */ +@Fluent +public final class DefenderCspmAwsOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_CSPM_AWS; + + /* + * The Microsoft Defender for CSPM offering VM scanning configuration + */ + private DefenderCspmAwsOfferingVmScanners vmScanners; + + /* + * The Microsoft Defender Data Sensitivity discovery configuration + */ + private DefenderCspmAwsOfferingDataSensitivityDiscovery dataSensitivityDiscovery; + + /* + * The databases DSPM configuration + */ + private DefenderCspmAwsOfferingDatabasesDspm databasesDspm; + + /* + * Defenders CSPM Permissions Management offering configurations + */ + private DefenderCspmAwsOfferingCiem ciem; + + /* + * The Microsoft Defender container image assessment configuration + */ + private DefenderCspmAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment; + + /* + * The Microsoft Defender container agentless discovery K8s configuration + */ + private DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; + + /** + * Creates an instance of DefenderCspmAwsOffering class. + */ + public DefenderCspmAwsOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the vmScanners property: The Microsoft Defender for CSPM offering VM scanning configuration. + * + * @return the vmScanners value. + */ + public DefenderCspmAwsOfferingVmScanners vmScanners() { + return this.vmScanners; + } + + /** + * Set the vmScanners property: The Microsoft Defender for CSPM offering VM scanning configuration. + * + * @param vmScanners the vmScanners value to set. + * @return the DefenderCspmAwsOffering object itself. + */ + public DefenderCspmAwsOffering withVmScanners(DefenderCspmAwsOfferingVmScanners vmScanners) { + this.vmScanners = vmScanners; + return this; + } + + /** + * Get the dataSensitivityDiscovery property: The Microsoft Defender Data Sensitivity discovery configuration. + * + * @return the dataSensitivityDiscovery value. + */ + public DefenderCspmAwsOfferingDataSensitivityDiscovery dataSensitivityDiscovery() { + return this.dataSensitivityDiscovery; + } + + /** + * Set the dataSensitivityDiscovery property: The Microsoft Defender Data Sensitivity discovery configuration. + * + * @param dataSensitivityDiscovery the dataSensitivityDiscovery value to set. + * @return the DefenderCspmAwsOffering object itself. + */ + public DefenderCspmAwsOffering + withDataSensitivityDiscovery(DefenderCspmAwsOfferingDataSensitivityDiscovery dataSensitivityDiscovery) { + this.dataSensitivityDiscovery = dataSensitivityDiscovery; + return this; + } + + /** + * Get the databasesDspm property: The databases DSPM configuration. + * + * @return the databasesDspm value. + */ + public DefenderCspmAwsOfferingDatabasesDspm databasesDspm() { + return this.databasesDspm; + } + + /** + * Set the databasesDspm property: The databases DSPM configuration. + * + * @param databasesDspm the databasesDspm value to set. + * @return the DefenderCspmAwsOffering object itself. + */ + public DefenderCspmAwsOffering withDatabasesDspm(DefenderCspmAwsOfferingDatabasesDspm databasesDspm) { + this.databasesDspm = databasesDspm; + return this; + } + + /** + * Get the ciem property: Defenders CSPM Permissions Management offering configurations. + * + * @return the ciem value. + */ + public DefenderCspmAwsOfferingCiem ciem() { + return this.ciem; + } + + /** + * Set the ciem property: Defenders CSPM Permissions Management offering configurations. + * + * @param ciem the ciem value to set. + * @return the DefenderCspmAwsOffering object itself. + */ + public DefenderCspmAwsOffering withCiem(DefenderCspmAwsOfferingCiem ciem) { + this.ciem = ciem; + return this; + } + + /** + * Get the mdcContainersImageAssessment property: The Microsoft Defender container image assessment configuration. + * + * @return the mdcContainersImageAssessment value. + */ + public DefenderCspmAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment() { + return this.mdcContainersImageAssessment; + } + + /** + * Set the mdcContainersImageAssessment property: The Microsoft Defender container image assessment configuration. + * + * @param mdcContainersImageAssessment the mdcContainersImageAssessment value to set. + * @return the DefenderCspmAwsOffering object itself. + */ + public DefenderCspmAwsOffering withMdcContainersImageAssessment( + DefenderCspmAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment) { + this.mdcContainersImageAssessment = mdcContainersImageAssessment; + return this; + } + + /** + * Get the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender container agentless discovery K8s + * configuration. + * + * @return the mdcContainersAgentlessDiscoveryK8S value. + */ + public DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S() { + return this.mdcContainersAgentlessDiscoveryK8S; + } + + /** + * Set the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender container agentless discovery K8s + * configuration. + * + * @param mdcContainersAgentlessDiscoveryK8S the mdcContainersAgentlessDiscoveryK8S value to set. + * @return the DefenderCspmAwsOffering object itself. + */ + public DefenderCspmAwsOffering withMdcContainersAgentlessDiscoveryK8S( + DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S) { + this.mdcContainersAgentlessDiscoveryK8S = mdcContainersAgentlessDiscoveryK8S; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (vmScanners() != null) { + vmScanners().validate(); + } + if (dataSensitivityDiscovery() != null) { + dataSensitivityDiscovery().validate(); + } + if (databasesDspm() != null) { + databasesDspm().validate(); + } + if (ciem() != null) { + ciem().validate(); + } + if (mdcContainersImageAssessment() != null) { + mdcContainersImageAssessment().validate(); + } + if (mdcContainersAgentlessDiscoveryK8S() != null) { + 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 new file mode 100644 index 000000000000..5d1eab59b204 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiem.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Defenders CSPM Permissions Management offering configurations. + */ +@Fluent +public final class DefenderCspmAwsOfferingCiem implements JsonSerializable { + /* + * Defender CSPM Permissions Management discovery configuration + */ + private DefenderCspmAwsOfferingCiemDiscovery ciemDiscovery; + + /* + * AWS Defender CSPM Permissions Management OIDC (open id connect) connection configurations + */ + private DefenderCspmAwsOfferingCiemOidc ciemOidc; + + /** + * Creates an instance of DefenderCspmAwsOfferingCiem class. + */ + public DefenderCspmAwsOfferingCiem() { + } + + /** + * Get the ciemDiscovery property: Defender CSPM Permissions Management discovery configuration. + * + * @return the ciemDiscovery value. + */ + public DefenderCspmAwsOfferingCiemDiscovery ciemDiscovery() { + return this.ciemDiscovery; + } + + /** + * Set the ciemDiscovery property: Defender CSPM Permissions Management discovery configuration. + * + * @param ciemDiscovery the ciemDiscovery value to set. + * @return the DefenderCspmAwsOfferingCiem object itself. + */ + public DefenderCspmAwsOfferingCiem withCiemDiscovery(DefenderCspmAwsOfferingCiemDiscovery ciemDiscovery) { + this.ciemDiscovery = ciemDiscovery; + return this; + } + + /** + * Get the ciemOidc property: AWS Defender CSPM Permissions Management OIDC (open id connect) connection + * configurations. + * + * @return the ciemOidc value. + */ + public DefenderCspmAwsOfferingCiemOidc ciemOidc() { + return this.ciemOidc; + } + + /** + * Set the ciemOidc property: AWS Defender CSPM Permissions Management OIDC (open id connect) connection + * configurations. + * + * @param ciemOidc the ciemOidc value to set. + * @return the DefenderCspmAwsOfferingCiem object itself. + */ + public DefenderCspmAwsOfferingCiem withCiemOidc(DefenderCspmAwsOfferingCiemOidc ciemOidc) { + this.ciemOidc = ciemOidc; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ciemDiscovery() != null) { + ciemDiscovery().validate(); + } + if (ciemOidc() != null) { + 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 new file mode 100644 index 000000000000..e280e3725308 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemDiscovery.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 CSPM Permissions Management discovery configuration. + */ +@Fluent +public final class DefenderCspmAwsOfferingCiemDiscovery + implements JsonSerializable { + /* + * The cloud role ARN in AWS for Permissions Management discovery + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderCspmAwsOfferingCiemDiscovery class. + */ + public DefenderCspmAwsOfferingCiemDiscovery() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for Permissions Management discovery. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for Permissions Management discovery. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderCspmAwsOfferingCiemDiscovery object itself. + */ + public DefenderCspmAwsOfferingCiemDiscovery withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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("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 new file mode 100644 index 000000000000..e6537ec83878 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemOidc.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * AWS Defender CSPM Permissions Management OIDC (open id connect) connection configurations. + */ +@Fluent +public final class DefenderCspmAwsOfferingCiemOidc implements JsonSerializable { + /* + * The cloud role ARN in AWS for Permissions Management used for oidc connection + */ + private String cloudRoleArn; + + /* + * the azure active directory app name used of authenticating against AWS + */ + private String azureActiveDirectoryAppName; + + /** + * Creates an instance of DefenderCspmAwsOfferingCiemOidc class. + */ + public DefenderCspmAwsOfferingCiemOidc() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for Permissions Management used for oidc connection. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for Permissions Management used for oidc connection. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderCspmAwsOfferingCiemOidc object itself. + */ + public DefenderCspmAwsOfferingCiemOidc withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + return this; + } + + /** + * Get the azureActiveDirectoryAppName property: the azure active directory app name used of authenticating against + * AWS. + * + * @return the azureActiveDirectoryAppName value. + */ + public String azureActiveDirectoryAppName() { + return this.azureActiveDirectoryAppName; + } + + /** + * Set the azureActiveDirectoryAppName property: the azure active directory app name used of authenticating against + * AWS. + * + * @param azureActiveDirectoryAppName the azureActiveDirectoryAppName value to set. + * @return the DefenderCspmAwsOfferingCiemOidc object itself. + */ + public DefenderCspmAwsOfferingCiemOidc withAzureActiveDirectoryAppName(String azureActiveDirectoryAppName) { + this.azureActiveDirectoryAppName = azureActiveDirectoryAppName; + 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("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 new file mode 100644 index 000000000000..c3eff26e0413 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDataSensitivityDiscovery.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Data Sensitivity discovery configuration. + */ +@Fluent +public final class DefenderCspmAwsOfferingDataSensitivityDiscovery + implements JsonSerializable { + /* + * Is Microsoft Defender Data Sensitivity discovery enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderCspmAwsOfferingDataSensitivityDiscovery class. + */ + public DefenderCspmAwsOfferingDataSensitivityDiscovery() { + } + + /** + * Get the enabled property: Is Microsoft Defender Data Sensitivity discovery enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender Data Sensitivity discovery enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderCspmAwsOfferingDataSensitivityDiscovery object itself. + */ + public DefenderCspmAwsOfferingDataSensitivityDiscovery withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderCspmAwsOfferingDataSensitivityDiscovery object itself. + */ + public DefenderCspmAwsOfferingDataSensitivityDiscovery withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..61806cb04f69 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDatabasesDspm.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 databases DSPM configuration. + */ +@Fluent +public final class DefenderCspmAwsOfferingDatabasesDspm + implements JsonSerializable { + /* + * Is databases DSPM protection enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderCspmAwsOfferingDatabasesDspm class. + */ + public DefenderCspmAwsOfferingDatabasesDspm() { + } + + /** + * Get the enabled property: Is databases DSPM protection enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is databases DSPM protection enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderCspmAwsOfferingDatabasesDspm object itself. + */ + public DefenderCspmAwsOfferingDatabasesDspm withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderCspmAwsOfferingDatabasesDspm object itself. + */ + public DefenderCspmAwsOfferingDatabasesDspm withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..0a106fd804ef --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 agentless discovery K8s configuration. + */ +@Fluent +public final class DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { + /* + * Is Microsoft Defender container agentless discovery K8s enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S class. + */ + public DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S() { + } + + /** + * Get the enabled property: Is Microsoft Defender container agentless discovery K8s enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender container agentless discovery K8s enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..40e7a40d2d5d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersImageAssessment.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 DefenderCspmAwsOfferingMdcContainersImageAssessment + implements JsonSerializable { + /* + * Is Microsoft Defender container image assessment enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderCspmAwsOfferingMdcContainersImageAssessment class. + */ + public DefenderCspmAwsOfferingMdcContainersImageAssessment() { + } + + /** + * 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 DefenderCspmAwsOfferingMdcContainersImageAssessment object itself. + */ + public DefenderCspmAwsOfferingMdcContainersImageAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderCspmAwsOfferingMdcContainersImageAssessment object itself. + */ + public DefenderCspmAwsOfferingMdcContainersImageAssessment withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..ca3d562ef3df --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingVmScanners.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Microsoft Defender for CSPM offering VM scanning configuration. + */ +@Fluent +public final class DefenderCspmAwsOfferingVmScanners extends VmScannersAws { + /** + * Creates an instance of DefenderCspmAwsOfferingVmScanners class. + */ + public DefenderCspmAwsOfferingVmScanners() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderCspmAwsOfferingVmScanners withCloudRoleArn(String cloudRoleArn) { + super.withCloudRoleArn(cloudRoleArn); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderCspmAwsOfferingVmScanners withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderCspmAwsOfferingVmScanners withConfiguration(VmScannersBaseConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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..1af60c3a9b2a --- /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) TypeSpec 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 new file mode 100644 index 000000000000..713dd598ac3b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOffering.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 GCP offering. + */ +@Fluent +public final class DefenderCspmGcpOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_CSPM_GCP; + + /* + * GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection configurations + */ + private DefenderCspmGcpOfferingCiemDiscovery ciemDiscovery; + + /* + * The Microsoft Defender for CSPM VM scanning configuration + */ + private DefenderCspmGcpOfferingVmScanners vmScanners; + + /* + * The Microsoft Defender Data Sensitivity discovery configuration + */ + private DefenderCspmGcpOfferingDataSensitivityDiscovery dataSensitivityDiscovery; + + /* + * The Microsoft Defender Container image assessment configuration + */ + private DefenderCspmGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment; + + /* + * The Microsoft Defender Container agentless discovery configuration + */ + private DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; + + /** + * Creates an instance of DefenderCspmGcpOffering class. + */ + public DefenderCspmGcpOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the ciemDiscovery property: GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection + * configurations. + * + * @return the ciemDiscovery value. + */ + public DefenderCspmGcpOfferingCiemDiscovery ciemDiscovery() { + return this.ciemDiscovery; + } + + /** + * Set the ciemDiscovery property: GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection + * configurations. + * + * @param ciemDiscovery the ciemDiscovery value to set. + * @return the DefenderCspmGcpOffering object itself. + */ + public DefenderCspmGcpOffering withCiemDiscovery(DefenderCspmGcpOfferingCiemDiscovery ciemDiscovery) { + this.ciemDiscovery = ciemDiscovery; + return this; + } + + /** + * Get the vmScanners property: The Microsoft Defender for CSPM VM scanning configuration. + * + * @return the vmScanners value. + */ + public DefenderCspmGcpOfferingVmScanners vmScanners() { + return this.vmScanners; + } + + /** + * Set the vmScanners property: The Microsoft Defender for CSPM VM scanning configuration. + * + * @param vmScanners the vmScanners value to set. + * @return the DefenderCspmGcpOffering object itself. + */ + public DefenderCspmGcpOffering withVmScanners(DefenderCspmGcpOfferingVmScanners vmScanners) { + this.vmScanners = vmScanners; + return this; + } + + /** + * Get the dataSensitivityDiscovery property: The Microsoft Defender Data Sensitivity discovery configuration. + * + * @return the dataSensitivityDiscovery value. + */ + public DefenderCspmGcpOfferingDataSensitivityDiscovery dataSensitivityDiscovery() { + return this.dataSensitivityDiscovery; + } + + /** + * Set the dataSensitivityDiscovery property: The Microsoft Defender Data Sensitivity discovery configuration. + * + * @param dataSensitivityDiscovery the dataSensitivityDiscovery value to set. + * @return the DefenderCspmGcpOffering object itself. + */ + public DefenderCspmGcpOffering + withDataSensitivityDiscovery(DefenderCspmGcpOfferingDataSensitivityDiscovery dataSensitivityDiscovery) { + this.dataSensitivityDiscovery = dataSensitivityDiscovery; + return this; + } + + /** + * Get the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @return the mdcContainersImageAssessment value. + */ + public DefenderCspmGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment() { + return this.mdcContainersImageAssessment; + } + + /** + * Set the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @param mdcContainersImageAssessment the mdcContainersImageAssessment value to set. + * @return the DefenderCspmGcpOffering object itself. + */ + public DefenderCspmGcpOffering withMdcContainersImageAssessment( + DefenderCspmGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment) { + this.mdcContainersImageAssessment = mdcContainersImageAssessment; + return this; + } + + /** + * Get the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender Container agentless discovery + * configuration. + * + * @return the mdcContainersAgentlessDiscoveryK8S value. + */ + public DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S() { + return this.mdcContainersAgentlessDiscoveryK8S; + } + + /** + * Set the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender Container agentless discovery + * configuration. + * + * @param mdcContainersAgentlessDiscoveryK8S the mdcContainersAgentlessDiscoveryK8S value to set. + * @return the DefenderCspmGcpOffering object itself. + */ + public DefenderCspmGcpOffering withMdcContainersAgentlessDiscoveryK8S( + DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S) { + this.mdcContainersAgentlessDiscoveryK8S = mdcContainersAgentlessDiscoveryK8S; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (ciemDiscovery() != null) { + ciemDiscovery().validate(); + } + if (vmScanners() != null) { + vmScanners().validate(); + } + if (dataSensitivityDiscovery() != null) { + dataSensitivityDiscovery().validate(); + } + if (mdcContainersImageAssessment() != null) { + mdcContainersImageAssessment().validate(); + } + if (mdcContainersAgentlessDiscoveryK8S() != null) { + 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 new file mode 100644 index 000000000000..d43a81fed60a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingCiemDiscovery.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection configurations. + */ +@Fluent +public final class DefenderCspmGcpOfferingCiemDiscovery + implements JsonSerializable { + /* + * The GCP workload identity provider id for Permissions Management offering + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for Permissions Management offering + */ + private String serviceAccountEmailAddress; + + /* + * the azure active directory app name used of authenticating against GCP workload identity federation + */ + private String azureActiveDirectoryAppName; + + /** + * Creates an instance of DefenderCspmGcpOfferingCiemDiscovery class. + */ + public DefenderCspmGcpOfferingCiemDiscovery() { + } + + /** + * Get the workloadIdentityProviderId property: The GCP workload identity provider id for Permissions Management + * offering. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The GCP workload identity provider id for Permissions Management + * offering. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderCspmGcpOfferingCiemDiscovery object itself. + */ + public DefenderCspmGcpOfferingCiemDiscovery withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for Permissions Management + * offering. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for Permissions Management + * offering. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderCspmGcpOfferingCiemDiscovery object itself. + */ + public DefenderCspmGcpOfferingCiemDiscovery withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + return this; + } + + /** + * Get the azureActiveDirectoryAppName property: the azure active directory app name used of authenticating against + * GCP workload identity federation. + * + * @return the azureActiveDirectoryAppName value. + */ + public String azureActiveDirectoryAppName() { + return this.azureActiveDirectoryAppName; + } + + /** + * Set the azureActiveDirectoryAppName property: the azure active directory app name used of authenticating against + * GCP workload identity federation. + * + * @param azureActiveDirectoryAppName the azureActiveDirectoryAppName value to set. + * @return the DefenderCspmGcpOfferingCiemDiscovery object itself. + */ + public DefenderCspmGcpOfferingCiemDiscovery withAzureActiveDirectoryAppName(String azureActiveDirectoryAppName) { + this.azureActiveDirectoryAppName = azureActiveDirectoryAppName; + 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("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 new file mode 100644 index 000000000000..0cd4d6535ac9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingDataSensitivityDiscovery.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Data Sensitivity discovery configuration. + */ +@Fluent +public final class DefenderCspmGcpOfferingDataSensitivityDiscovery + implements JsonSerializable { + /* + * Is Microsoft Defender Data Sensitivity discovery enabled + */ + private Boolean enabled; + + /* + * The workload identity provider id in GCP for this feature + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for this feature + */ + private String serviceAccountEmailAddress; + + /** + * Creates an instance of DefenderCspmGcpOfferingDataSensitivityDiscovery class. + */ + public DefenderCspmGcpOfferingDataSensitivityDiscovery() { + } + + /** + * Get the enabled property: Is Microsoft Defender Data Sensitivity discovery enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender Data Sensitivity discovery enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderCspmGcpOfferingDataSensitivityDiscovery object itself. + */ + public DefenderCspmGcpOfferingDataSensitivityDiscovery withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderCspmGcpOfferingDataSensitivityDiscovery object itself. + */ + public DefenderCspmGcpOfferingDataSensitivityDiscovery + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderCspmGcpOfferingDataSensitivityDiscovery object itself. + */ + public DefenderCspmGcpOfferingDataSensitivityDiscovery + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + 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); + 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 new file mode 100644 index 000000000000..99c638d98f87 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 agentless discovery configuration. + */ +@Fluent +public final class DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { + /* + * Is Microsoft Defender container agentless discovery enabled + */ + private Boolean enabled; + + /* + * The workload identity provider id in GCP for this feature + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for this feature + */ + private String serviceAccountEmailAddress; + + /** + * Creates an instance of DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S class. + */ + public DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S() { + } + + /** + * Get the enabled property: Is Microsoft Defender container agentless discovery enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender container agentless discovery enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + 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); + 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 new file mode 100644 index 000000000000..94ca9d93f683 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersImageAssessment.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 DefenderCspmGcpOfferingMdcContainersImageAssessment + implements JsonSerializable { + /* + * Is Microsoft Defender container image assessment enabled + */ + private Boolean enabled; + + /* + * The workload identity provider id in GCP for this feature + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for this feature + */ + private String serviceAccountEmailAddress; + + /** + * Creates an instance of DefenderCspmGcpOfferingMdcContainersImageAssessment class. + */ + public DefenderCspmGcpOfferingMdcContainersImageAssessment() { + } + + /** + * 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 DefenderCspmGcpOfferingMdcContainersImageAssessment object itself. + */ + public DefenderCspmGcpOfferingMdcContainersImageAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderCspmGcpOfferingMdcContainersImageAssessment object itself. + */ + public DefenderCspmGcpOfferingMdcContainersImageAssessment + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderCspmGcpOfferingMdcContainersImageAssessment object itself. + */ + public DefenderCspmGcpOfferingMdcContainersImageAssessment + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + 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); + 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 new file mode 100644 index 000000000000..c5960edd5905 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingVmScanners.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Microsoft Defender for CSPM VM scanning configuration. + */ +@Fluent +public final class DefenderCspmGcpOfferingVmScanners extends VmScannersGcp { + /** + * Creates an instance of DefenderCspmGcpOfferingVmScanners class. + */ + public DefenderCspmGcpOfferingVmScanners() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderCspmGcpOfferingVmScanners withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderCspmGcpOfferingVmScanners withConfiguration(VmScannersBaseConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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..85b6537bb488 --- /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) TypeSpec 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..21e1ea8fe26b --- /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) TypeSpec 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 new file mode 100644 index 000000000000..11f39d3b66ab --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOffering.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Defender for Databases AWS offering. + */ +@Fluent +public final class DefenderFoDatabasesAwsOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_DATABASES_AWS; + + /* + * The ARC autoprovisioning configuration + */ + private DefenderFoDatabasesAwsOfferingArcAutoProvisioning arcAutoProvisioning; + + /* + * The RDS configuration + */ + private DefenderFoDatabasesAwsOfferingRds rds; + + /* + * The databases data security posture management (DSPM) configuration + */ + private DefenderFoDatabasesAwsOfferingDatabasesDspm databasesDspm; + + /** + * Creates an instance of DefenderFoDatabasesAwsOffering class. + */ + public DefenderFoDatabasesAwsOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @return the arcAutoProvisioning value. + */ + public DefenderFoDatabasesAwsOfferingArcAutoProvisioning arcAutoProvisioning() { + return this.arcAutoProvisioning; + } + + /** + * Set the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @param arcAutoProvisioning the arcAutoProvisioning value to set. + * @return the DefenderFoDatabasesAwsOffering object itself. + */ + public DefenderFoDatabasesAwsOffering + withArcAutoProvisioning(DefenderFoDatabasesAwsOfferingArcAutoProvisioning arcAutoProvisioning) { + this.arcAutoProvisioning = arcAutoProvisioning; + return this; + } + + /** + * Get the rds property: The RDS configuration. + * + * @return the rds value. + */ + public DefenderFoDatabasesAwsOfferingRds rds() { + return this.rds; + } + + /** + * Set the rds property: The RDS configuration. + * + * @param rds the rds value to set. + * @return the DefenderFoDatabasesAwsOffering object itself. + */ + public DefenderFoDatabasesAwsOffering withRds(DefenderFoDatabasesAwsOfferingRds rds) { + this.rds = rds; + return this; + } + + /** + * Get the databasesDspm property: The databases data security posture management (DSPM) configuration. + * + * @return the databasesDspm value. + */ + public DefenderFoDatabasesAwsOfferingDatabasesDspm databasesDspm() { + return this.databasesDspm; + } + + /** + * Set the databasesDspm property: The databases data security posture management (DSPM) configuration. + * + * @param databasesDspm the databasesDspm value to set. + * @return the DefenderFoDatabasesAwsOffering object itself. + */ + public DefenderFoDatabasesAwsOffering withDatabasesDspm(DefenderFoDatabasesAwsOfferingDatabasesDspm databasesDspm) { + this.databasesDspm = databasesDspm; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (arcAutoProvisioning() != null) { + arcAutoProvisioning().validate(); + } + if (rds() != null) { + rds().validate(); + } + if (databasesDspm() != null) { + 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 new file mode 100644 index 000000000000..5e6e13bb6643 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ARC autoprovisioning configuration. + */ +@Fluent +public final class DefenderFoDatabasesAwsOfferingArcAutoProvisioning extends ArcAutoProvisioningAws { + /** + * Creates an instance of DefenderFoDatabasesAwsOfferingArcAutoProvisioning class. + */ + public DefenderFoDatabasesAwsOfferingArcAutoProvisioning() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderFoDatabasesAwsOfferingArcAutoProvisioning withCloudRoleArn(String cloudRoleArn) { + super.withCloudRoleArn(cloudRoleArn); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderFoDatabasesAwsOfferingArcAutoProvisioning withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderFoDatabasesAwsOfferingArcAutoProvisioning + withConfiguration(ArcAutoProvisioningConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..063375105c2b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingDatabasesDspm.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 databases data security posture management (DSPM) configuration. + */ +@Fluent +public final class DefenderFoDatabasesAwsOfferingDatabasesDspm + implements JsonSerializable { + /* + * Is databases data security posture management (DSPM) protection enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderFoDatabasesAwsOfferingDatabasesDspm class. + */ + public DefenderFoDatabasesAwsOfferingDatabasesDspm() { + } + + /** + * Get the enabled property: Is databases data security posture management (DSPM) protection enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is databases data security posture management (DSPM) protection enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderFoDatabasesAwsOfferingDatabasesDspm object itself. + */ + public DefenderFoDatabasesAwsOfferingDatabasesDspm withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderFoDatabasesAwsOfferingDatabasesDspm object itself. + */ + public DefenderFoDatabasesAwsOfferingDatabasesDspm withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..51f2add77b99 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingRds.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 RDS configuration. + */ +@Fluent +public final class DefenderFoDatabasesAwsOfferingRds implements JsonSerializable { + /* + * Is RDS protection enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderFoDatabasesAwsOfferingRds class. + */ + public DefenderFoDatabasesAwsOfferingRds() { + } + + /** + * Get the enabled property: Is RDS protection enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is RDS protection enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderFoDatabasesAwsOfferingRds object itself. + */ + public DefenderFoDatabasesAwsOfferingRds withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderFoDatabasesAwsOfferingRds object itself. + */ + public DefenderFoDatabasesAwsOfferingRds withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..0a3dc19cfda1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOffering.java @@ -0,0 +1,471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Defender for Containers AWS offering. + */ +@Fluent +public final class DefenderForContainersAwsOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_AWS; + + /* + * The kubernetes service connection configuration + */ + private DefenderForContainersAwsOfferingKubernetesService kubernetesService; + + /* + * The kubernetes data collection connection configuration + */ + private DefenderForContainersAwsOfferingKubernetesDataCollection kubernetesDataCollection; + + /* + * The cloudwatch to kinesis connection configuration + */ + private DefenderForContainersAwsOfferingCloudWatchToKinesis cloudWatchToKinesis; + + /* + * The kinesis to s3 connection configuration + */ + private DefenderForContainersAwsOfferingKinesisToS3 kinesisToS3; + + /* + * Is audit logs data collection enabled + */ + private Boolean enableAuditLogsAutoProvisioning; + + /* + * Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled + */ + private Boolean enableDefenderAgentAutoProvisioning; + + /* + * Is Policy Kubernetes agent auto provisioning enabled + */ + private Boolean enablePolicyAgentAutoProvisioning; + + /* + * The retention time in days of kube audit logs set on the CloudWatch log group + */ + private Long kubeAuditRetentionTime; + + /* + * The externalId used by the data reader to prevent the confused deputy attack + */ + private String dataCollectionExternalId; + + /* + * The Microsoft Defender container image assessment configuration + */ + private DefenderForContainersAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment; + + /* + * The Microsoft Defender container agentless discovery K8s configuration + */ + private DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; + + /* + * The Microsoft Defender for Container K8s VM host scanning configuration + */ + private DefenderForContainersAwsOfferingVmScanners vmScanners; + + /** + * Creates an instance of DefenderForContainersAwsOffering class. + */ + public DefenderForContainersAwsOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the kubernetesService property: The kubernetes service connection configuration. + * + * @return the kubernetesService value. + */ + public DefenderForContainersAwsOfferingKubernetesService kubernetesService() { + return this.kubernetesService; + } + + /** + * Set the kubernetesService property: The kubernetes service connection configuration. + * + * @param kubernetesService the kubernetesService value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering + withKubernetesService(DefenderForContainersAwsOfferingKubernetesService kubernetesService) { + this.kubernetesService = kubernetesService; + return this; + } + + /** + * Get the kubernetesDataCollection property: The kubernetes data collection connection configuration. + * + * @return the kubernetesDataCollection value. + */ + public DefenderForContainersAwsOfferingKubernetesDataCollection kubernetesDataCollection() { + return this.kubernetesDataCollection; + } + + /** + * Set the kubernetesDataCollection property: The kubernetes data collection connection configuration. + * + * @param kubernetesDataCollection the kubernetesDataCollection value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering withKubernetesDataCollection( + DefenderForContainersAwsOfferingKubernetesDataCollection kubernetesDataCollection) { + this.kubernetesDataCollection = kubernetesDataCollection; + return this; + } + + /** + * Get the cloudWatchToKinesis property: The cloudwatch to kinesis connection configuration. + * + * @return the cloudWatchToKinesis value. + */ + public DefenderForContainersAwsOfferingCloudWatchToKinesis cloudWatchToKinesis() { + return this.cloudWatchToKinesis; + } + + /** + * Set the cloudWatchToKinesis property: The cloudwatch to kinesis connection configuration. + * + * @param cloudWatchToKinesis the cloudWatchToKinesis value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering + withCloudWatchToKinesis(DefenderForContainersAwsOfferingCloudWatchToKinesis cloudWatchToKinesis) { + this.cloudWatchToKinesis = cloudWatchToKinesis; + return this; + } + + /** + * Get the kinesisToS3 property: The kinesis to s3 connection configuration. + * + * @return the kinesisToS3 value. + */ + public DefenderForContainersAwsOfferingKinesisToS3 kinesisToS3() { + return this.kinesisToS3; + } + + /** + * Set the kinesisToS3 property: The kinesis to s3 connection configuration. + * + * @param kinesisToS3 the kinesisToS3 value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering withKinesisToS3(DefenderForContainersAwsOfferingKinesisToS3 kinesisToS3) { + this.kinesisToS3 = kinesisToS3; + return this; + } + + /** + * Get the enableAuditLogsAutoProvisioning property: Is audit logs data collection enabled. + * + * @return the enableAuditLogsAutoProvisioning value. + */ + public Boolean enableAuditLogsAutoProvisioning() { + return this.enableAuditLogsAutoProvisioning; + } + + /** + * Set the enableAuditLogsAutoProvisioning property: Is audit logs data collection enabled. + * + * @param enableAuditLogsAutoProvisioning the enableAuditLogsAutoProvisioning value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering + withEnableAuditLogsAutoProvisioning(Boolean enableAuditLogsAutoProvisioning) { + this.enableAuditLogsAutoProvisioning = enableAuditLogsAutoProvisioning; + return this; + } + + /** + * Get the enableDefenderAgentAutoProvisioning property: Is Microsoft Defender for Cloud Kubernetes agent auto + * provisioning enabled. + * + * @return the enableDefenderAgentAutoProvisioning value. + */ + public Boolean enableDefenderAgentAutoProvisioning() { + return this.enableDefenderAgentAutoProvisioning; + } + + /** + * Set the enableDefenderAgentAutoProvisioning property: Is Microsoft Defender for Cloud Kubernetes agent auto + * provisioning enabled. + * + * @param enableDefenderAgentAutoProvisioning the enableDefenderAgentAutoProvisioning value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering + withEnableDefenderAgentAutoProvisioning(Boolean enableDefenderAgentAutoProvisioning) { + this.enableDefenderAgentAutoProvisioning = enableDefenderAgentAutoProvisioning; + return this; + } + + /** + * Get the enablePolicyAgentAutoProvisioning property: Is Policy Kubernetes agent auto provisioning enabled. + * + * @return the enablePolicyAgentAutoProvisioning value. + */ + public Boolean enablePolicyAgentAutoProvisioning() { + return this.enablePolicyAgentAutoProvisioning; + } + + /** + * Set the enablePolicyAgentAutoProvisioning property: Is Policy Kubernetes agent auto provisioning enabled. + * + * @param enablePolicyAgentAutoProvisioning the enablePolicyAgentAutoProvisioning value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering + withEnablePolicyAgentAutoProvisioning(Boolean enablePolicyAgentAutoProvisioning) { + this.enablePolicyAgentAutoProvisioning = enablePolicyAgentAutoProvisioning; + return this; + } + + /** + * Get the kubeAuditRetentionTime property: The retention time in days of kube audit logs set on the CloudWatch log + * group. + * + * @return the kubeAuditRetentionTime value. + */ + public Long kubeAuditRetentionTime() { + return this.kubeAuditRetentionTime; + } + + /** + * Set the kubeAuditRetentionTime property: The retention time in days of kube audit logs set on the CloudWatch log + * group. + * + * @param kubeAuditRetentionTime the kubeAuditRetentionTime value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering withKubeAuditRetentionTime(Long kubeAuditRetentionTime) { + this.kubeAuditRetentionTime = kubeAuditRetentionTime; + return this; + } + + /** + * Get the dataCollectionExternalId property: The externalId used by the data reader to prevent the confused deputy + * attack. + * + * @return the dataCollectionExternalId value. + */ + public String dataCollectionExternalId() { + return this.dataCollectionExternalId; + } + + /** + * Set the dataCollectionExternalId property: The externalId used by the data reader to prevent the confused deputy + * attack. + * + * @param dataCollectionExternalId the dataCollectionExternalId value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering withDataCollectionExternalId(String dataCollectionExternalId) { + this.dataCollectionExternalId = dataCollectionExternalId; + return this; + } + + /** + * Get the mdcContainersImageAssessment property: The Microsoft Defender container image assessment configuration. + * + * @return the mdcContainersImageAssessment value. + */ + public DefenderForContainersAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment() { + return this.mdcContainersImageAssessment; + } + + /** + * Set the mdcContainersImageAssessment property: The Microsoft Defender container image assessment configuration. + * + * @param mdcContainersImageAssessment the mdcContainersImageAssessment value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering withMdcContainersImageAssessment( + DefenderForContainersAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment) { + this.mdcContainersImageAssessment = mdcContainersImageAssessment; + return this; + } + + /** + * Get the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender container agentless discovery K8s + * configuration. + * + * @return the mdcContainersAgentlessDiscoveryK8S value. + */ + public DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S() { + return this.mdcContainersAgentlessDiscoveryK8S; + } + + /** + * Set the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender container agentless discovery K8s + * configuration. + * + * @param mdcContainersAgentlessDiscoveryK8S the mdcContainersAgentlessDiscoveryK8S value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering withMdcContainersAgentlessDiscoveryK8S( + DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S) { + this.mdcContainersAgentlessDiscoveryK8S = mdcContainersAgentlessDiscoveryK8S; + return this; + } + + /** + * Get the vmScanners property: The Microsoft Defender for Container K8s VM host scanning configuration. + * + * @return the vmScanners value. + */ + public DefenderForContainersAwsOfferingVmScanners vmScanners() { + return this.vmScanners; + } + + /** + * Set the vmScanners property: The Microsoft Defender for Container K8s VM host scanning configuration. + * + * @param vmScanners the vmScanners value to set. + * @return the DefenderForContainersAwsOffering object itself. + */ + public DefenderForContainersAwsOffering withVmScanners(DefenderForContainersAwsOfferingVmScanners vmScanners) { + this.vmScanners = vmScanners; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (kubernetesService() != null) { + kubernetesService().validate(); + } + if (kubernetesDataCollection() != null) { + kubernetesDataCollection().validate(); + } + if (cloudWatchToKinesis() != null) { + cloudWatchToKinesis().validate(); + } + if (kinesisToS3() != null) { + kinesisToS3().validate(); + } + if (mdcContainersImageAssessment() != null) { + mdcContainersImageAssessment().validate(); + } + if (mdcContainersAgentlessDiscoveryK8S() != null) { + mdcContainersAgentlessDiscoveryK8S().validate(); + } + if (vmScanners() != null) { + 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 new file mode 100644 index 000000000000..e4fcc8542c94 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingCloudWatchToKinesis.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 cloudwatch to kinesis connection configuration. + */ +@Fluent +public final class DefenderForContainersAwsOfferingCloudWatchToKinesis + implements JsonSerializable { + /* + * The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderForContainersAwsOfferingCloudWatchToKinesis class. + */ + public DefenderForContainersAwsOfferingCloudWatchToKinesis() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderForContainersAwsOfferingCloudWatchToKinesis object itself. + */ + public DefenderForContainersAwsOfferingCloudWatchToKinesis withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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("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 new file mode 100644 index 000000000000..e7da36168aa2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKinesisToS3.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 kinesis to s3 connection configuration. + */ +@Fluent +public final class DefenderForContainersAwsOfferingKinesisToS3 + implements JsonSerializable { + /* + * The cloud role ARN in AWS used by Kinesis to transfer data into S3 + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderForContainersAwsOfferingKinesisToS3 class. + */ + public DefenderForContainersAwsOfferingKinesisToS3() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS used by Kinesis to transfer data into S3. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS used by Kinesis to transfer data into S3. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderForContainersAwsOfferingKinesisToS3 object itself. + */ + public DefenderForContainersAwsOfferingKinesisToS3 withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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("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 new file mode 100644 index 000000000000..b9ceb6f5ca32 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesDataCollection.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 kubernetes data collection connection configuration. + */ +@Fluent +public final class DefenderForContainersAwsOfferingKubernetesDataCollection + implements JsonSerializable { + /* + * The cloud role ARN in AWS for this feature used for reading data + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderForContainersAwsOfferingKubernetesDataCollection class. + */ + public DefenderForContainersAwsOfferingKubernetesDataCollection() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature used for reading data. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature used for reading data. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderForContainersAwsOfferingKubernetesDataCollection object itself. + */ + public DefenderForContainersAwsOfferingKubernetesDataCollection withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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("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 new file mode 100644 index 000000000000..da5b61e6e47f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesService.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 kubernetes service connection configuration. + */ +@Fluent +public final class DefenderForContainersAwsOfferingKubernetesService + implements JsonSerializable { + /* + * The cloud role ARN in AWS for this feature used for provisioning resources + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderForContainersAwsOfferingKubernetesService class. + */ + public DefenderForContainersAwsOfferingKubernetesService() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature used for provisioning resources. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature used for provisioning resources. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderForContainersAwsOfferingKubernetesService object itself. + */ + public DefenderForContainersAwsOfferingKubernetesService withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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("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 new file mode 100644 index 000000000000..d188ecbb7741 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 agentless discovery K8s configuration. + */ +@Fluent +public final class DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { + /* + * Is Microsoft Defender container agentless discovery K8s enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S class. + */ + public DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S() { + } + + /** + * Get the enabled property: Is Microsoft Defender container agentless discovery K8s enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender container agentless discovery K8s enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..9dba92eadee4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 DefenderForContainersAwsOfferingMdcContainersImageAssessment + implements JsonSerializable { + /* + * Is Microsoft Defender container image assessment enabled + */ + private Boolean enabled; + + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderForContainersAwsOfferingMdcContainersImageAssessment class. + */ + public DefenderForContainersAwsOfferingMdcContainersImageAssessment() { + } + + /** + * 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 DefenderForContainersAwsOfferingMdcContainersImageAssessment object itself. + */ + public DefenderForContainersAwsOfferingMdcContainersImageAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderForContainersAwsOfferingMdcContainersImageAssessment object itself. + */ + public DefenderForContainersAwsOfferingMdcContainersImageAssessment withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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); + 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 new file mode 100644 index 000000000000..fe83044d60bb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingVmScanners.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Microsoft Defender for Container K8s VM host scanning configuration. + */ +@Fluent +public final class DefenderForContainersAwsOfferingVmScanners extends VmScannersAws { + /** + * Creates an instance of DefenderForContainersAwsOfferingVmScanners class. + */ + public DefenderForContainersAwsOfferingVmScanners() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForContainersAwsOfferingVmScanners withCloudRoleArn(String cloudRoleArn) { + super.withCloudRoleArn(cloudRoleArn); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForContainersAwsOfferingVmScanners withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForContainersAwsOfferingVmScanners withConfiguration(VmScannersBaseConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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..9154af14476f --- /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) TypeSpec 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 new file mode 100644 index 000000000000..1195c0a19230 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOffering.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 containers GCP offering. + */ +@Fluent +public final class DefenderForContainersGcpOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_GCP; + + /* + * The native cloud connection configuration + */ + private DefenderForContainersGcpOfferingNativeCloudConnection nativeCloudConnection; + + /* + * The native cloud connection configuration + */ + private DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection dataPipelineNativeCloudConnection; + + /* + * Is audit logs data collection enabled + */ + private Boolean enableAuditLogsAutoProvisioning; + + /* + * Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled + */ + private Boolean enableDefenderAgentAutoProvisioning; + + /* + * Is Policy Kubernetes agent auto provisioning enabled + */ + private Boolean enablePolicyAgentAutoProvisioning; + + /* + * The Microsoft Defender Container image assessment configuration + */ + private DefenderForContainersGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment; + + /* + * The Microsoft Defender Container agentless discovery configuration + */ + private DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; + + /* + * The Microsoft Defender for Container K8s VM host scanning configuration + */ + private DefenderForContainersGcpOfferingVmScanners vmScanners; + + /** + * Creates an instance of DefenderForContainersGcpOffering class. + */ + public DefenderForContainersGcpOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the nativeCloudConnection property: The native cloud connection configuration. + * + * @return the nativeCloudConnection value. + */ + public DefenderForContainersGcpOfferingNativeCloudConnection nativeCloudConnection() { + return this.nativeCloudConnection; + } + + /** + * Set the nativeCloudConnection property: The native cloud connection configuration. + * + * @param nativeCloudConnection the nativeCloudConnection value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering + withNativeCloudConnection(DefenderForContainersGcpOfferingNativeCloudConnection nativeCloudConnection) { + this.nativeCloudConnection = nativeCloudConnection; + return this; + } + + /** + * Get the dataPipelineNativeCloudConnection property: The native cloud connection configuration. + * + * @return the dataPipelineNativeCloudConnection value. + */ + public DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection dataPipelineNativeCloudConnection() { + return this.dataPipelineNativeCloudConnection; + } + + /** + * Set the dataPipelineNativeCloudConnection property: The native cloud connection configuration. + * + * @param dataPipelineNativeCloudConnection the dataPipelineNativeCloudConnection value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering withDataPipelineNativeCloudConnection( + DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection dataPipelineNativeCloudConnection) { + this.dataPipelineNativeCloudConnection = dataPipelineNativeCloudConnection; + return this; + } + + /** + * Get the enableAuditLogsAutoProvisioning property: Is audit logs data collection enabled. + * + * @return the enableAuditLogsAutoProvisioning value. + */ + public Boolean enableAuditLogsAutoProvisioning() { + return this.enableAuditLogsAutoProvisioning; + } + + /** + * Set the enableAuditLogsAutoProvisioning property: Is audit logs data collection enabled. + * + * @param enableAuditLogsAutoProvisioning the enableAuditLogsAutoProvisioning value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering + withEnableAuditLogsAutoProvisioning(Boolean enableAuditLogsAutoProvisioning) { + this.enableAuditLogsAutoProvisioning = enableAuditLogsAutoProvisioning; + return this; + } + + /** + * Get the enableDefenderAgentAutoProvisioning property: Is Microsoft Defender for Cloud Kubernetes agent auto + * provisioning enabled. + * + * @return the enableDefenderAgentAutoProvisioning value. + */ + public Boolean enableDefenderAgentAutoProvisioning() { + return this.enableDefenderAgentAutoProvisioning; + } + + /** + * Set the enableDefenderAgentAutoProvisioning property: Is Microsoft Defender for Cloud Kubernetes agent auto + * provisioning enabled. + * + * @param enableDefenderAgentAutoProvisioning the enableDefenderAgentAutoProvisioning value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering + withEnableDefenderAgentAutoProvisioning(Boolean enableDefenderAgentAutoProvisioning) { + this.enableDefenderAgentAutoProvisioning = enableDefenderAgentAutoProvisioning; + return this; + } + + /** + * Get the enablePolicyAgentAutoProvisioning property: Is Policy Kubernetes agent auto provisioning enabled. + * + * @return the enablePolicyAgentAutoProvisioning value. + */ + public Boolean enablePolicyAgentAutoProvisioning() { + return this.enablePolicyAgentAutoProvisioning; + } + + /** + * Set the enablePolicyAgentAutoProvisioning property: Is Policy Kubernetes agent auto provisioning enabled. + * + * @param enablePolicyAgentAutoProvisioning the enablePolicyAgentAutoProvisioning value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering + withEnablePolicyAgentAutoProvisioning(Boolean enablePolicyAgentAutoProvisioning) { + this.enablePolicyAgentAutoProvisioning = enablePolicyAgentAutoProvisioning; + return this; + } + + /** + * Get the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @return the mdcContainersImageAssessment value. + */ + public DefenderForContainersGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment() { + return this.mdcContainersImageAssessment; + } + + /** + * Set the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @param mdcContainersImageAssessment the mdcContainersImageAssessment value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering withMdcContainersImageAssessment( + DefenderForContainersGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment) { + this.mdcContainersImageAssessment = mdcContainersImageAssessment; + return this; + } + + /** + * Get the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender Container agentless discovery + * configuration. + * + * @return the mdcContainersAgentlessDiscoveryK8S value. + */ + public DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S() { + return this.mdcContainersAgentlessDiscoveryK8S; + } + + /** + * Set the mdcContainersAgentlessDiscoveryK8S property: The Microsoft Defender Container agentless discovery + * configuration. + * + * @param mdcContainersAgentlessDiscoveryK8S the mdcContainersAgentlessDiscoveryK8S value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering withMdcContainersAgentlessDiscoveryK8S( + DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S) { + this.mdcContainersAgentlessDiscoveryK8S = mdcContainersAgentlessDiscoveryK8S; + return this; + } + + /** + * Get the vmScanners property: The Microsoft Defender for Container K8s VM host scanning configuration. + * + * @return the vmScanners value. + */ + public DefenderForContainersGcpOfferingVmScanners vmScanners() { + return this.vmScanners; + } + + /** + * Set the vmScanners property: The Microsoft Defender for Container K8s VM host scanning configuration. + * + * @param vmScanners the vmScanners value to set. + * @return the DefenderForContainersGcpOffering object itself. + */ + public DefenderForContainersGcpOffering withVmScanners(DefenderForContainersGcpOfferingVmScanners vmScanners) { + this.vmScanners = vmScanners; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (nativeCloudConnection() != null) { + nativeCloudConnection().validate(); + } + if (dataPipelineNativeCloudConnection() != null) { + dataPipelineNativeCloudConnection().validate(); + } + if (mdcContainersImageAssessment() != null) { + mdcContainersImageAssessment().validate(); + } + if (mdcContainersAgentlessDiscoveryK8S() != null) { + mdcContainersAgentlessDiscoveryK8S().validate(); + } + if (vmScanners() != null) { + 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 new file mode 100644 index 000000000000..e5d173c1c120 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 native cloud connection configuration. + */ +@Fluent +public final class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + implements JsonSerializable { + /* + * The data collection service account email address in GCP for this offering + */ + private String serviceAccountEmailAddress; + + /* + * The data collection GCP workload identity provider id for this offering + */ + private String workloadIdentityProviderId; + + /** + * Creates an instance of DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection class. + */ + public DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection() { + } + + /** + * Get the serviceAccountEmailAddress property: The data collection service account email address in GCP for this + * offering. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The data collection service account email address in GCP for this + * offering. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection object itself. + */ + public DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The data collection GCP workload identity provider id for this + * offering. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The data collection GCP workload identity provider id for this + * offering. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection object itself. + */ + public DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + 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("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 new file mode 100644 index 000000000000..e61739d37f67 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 agentless discovery configuration. + */ +@Fluent +public final class DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { + /* + * Is Microsoft Defender container agentless discovery enabled + */ + private Boolean enabled; + + /* + * The workload identity provider id in GCP for this feature + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for this feature + */ + private String serviceAccountEmailAddress; + + /** + * Creates an instance of DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S class. + */ + public DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S() { + } + + /** + * Get the enabled property: Is Microsoft Defender container agentless discovery enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender container agentless discovery enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S object itself. + */ + public DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + 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); + 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 new file mode 100644 index 000000000000..81924b7c3b8d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 DefenderForContainersGcpOfferingMdcContainersImageAssessment + implements JsonSerializable { + /* + * Is Microsoft Defender container image assessment enabled + */ + private Boolean enabled; + + /* + * The workload identity provider id in GCP for this feature + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for this feature + */ + private String serviceAccountEmailAddress; + + /** + * Creates an instance of DefenderForContainersGcpOfferingMdcContainersImageAssessment class. + */ + public DefenderForContainersGcpOfferingMdcContainersImageAssessment() { + } + + /** + * 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 DefenderForContainersGcpOfferingMdcContainersImageAssessment object itself. + */ + public DefenderForContainersGcpOfferingMdcContainersImageAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderForContainersGcpOfferingMdcContainersImageAssessment object itself. + */ + public DefenderForContainersGcpOfferingMdcContainersImageAssessment + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderForContainersGcpOfferingMdcContainersImageAssessment object itself. + */ + public DefenderForContainersGcpOfferingMdcContainersImageAssessment + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + 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); + 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 new file mode 100644 index 000000000000..7db5f7b198ec --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingNativeCloudConnection.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 native cloud connection configuration. + */ +@Fluent +public final class DefenderForContainersGcpOfferingNativeCloudConnection + implements JsonSerializable { + /* + * The service account email address in GCP for this offering + */ + private String serviceAccountEmailAddress; + + /* + * The GCP workload identity provider id for this offering + */ + private String workloadIdentityProviderId; + + /** + * Creates an instance of DefenderForContainersGcpOfferingNativeCloudConnection class. + */ + public DefenderForContainersGcpOfferingNativeCloudConnection() { + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this offering. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this offering. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderForContainersGcpOfferingNativeCloudConnection object itself. + */ + public DefenderForContainersGcpOfferingNativeCloudConnection + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The GCP workload identity provider id for this offering. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The GCP workload identity provider id for this offering. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderForContainersGcpOfferingNativeCloudConnection object itself. + */ + public DefenderForContainersGcpOfferingNativeCloudConnection + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + 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("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 new file mode 100644 index 000000000000..f269f23e6c48 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingVmScanners.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Microsoft Defender for Container K8s VM host scanning configuration. + */ +@Fluent +public final class DefenderForContainersGcpOfferingVmScanners extends VmScannersGcp { + /** + * Creates an instance of DefenderForContainersGcpOfferingVmScanners class. + */ + public DefenderForContainersGcpOfferingVmScanners() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForContainersGcpOfferingVmScanners withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForContainersGcpOfferingVmScanners withConfiguration(VmScannersBaseConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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..30d5c4c8fdec --- /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) TypeSpec 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 new file mode 100644 index 000000000000..e0cb25b08574 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOffering.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Defender for Databases GCP offering configurations. + */ +@Fluent +public final class DefenderForDatabasesGcpOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_DATABASES_GCP; + + /* + * The ARC autoprovisioning configuration + */ + private DefenderForDatabasesGcpOfferingArcAutoProvisioning arcAutoProvisioning; + + /* + * The native cloud connection configuration + */ + private DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning defenderForDatabasesArcAutoProvisioning; + + /** + * Creates an instance of DefenderForDatabasesGcpOffering class. + */ + public DefenderForDatabasesGcpOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @return the arcAutoProvisioning value. + */ + public DefenderForDatabasesGcpOfferingArcAutoProvisioning arcAutoProvisioning() { + return this.arcAutoProvisioning; + } + + /** + * Set the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @param arcAutoProvisioning the arcAutoProvisioning value to set. + * @return the DefenderForDatabasesGcpOffering object itself. + */ + public DefenderForDatabasesGcpOffering + withArcAutoProvisioning(DefenderForDatabasesGcpOfferingArcAutoProvisioning arcAutoProvisioning) { + this.arcAutoProvisioning = arcAutoProvisioning; + return this; + } + + /** + * Get the defenderForDatabasesArcAutoProvisioning property: The native cloud connection configuration. + * + * @return the defenderForDatabasesArcAutoProvisioning value. + */ + public DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + defenderForDatabasesArcAutoProvisioning() { + return this.defenderForDatabasesArcAutoProvisioning; + } + + /** + * Set the defenderForDatabasesArcAutoProvisioning property: The native cloud connection configuration. + * + * @param defenderForDatabasesArcAutoProvisioning the defenderForDatabasesArcAutoProvisioning value to set. + * @return the DefenderForDatabasesGcpOffering object itself. + */ + public DefenderForDatabasesGcpOffering withDefenderForDatabasesArcAutoProvisioning( + DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning defenderForDatabasesArcAutoProvisioning) { + this.defenderForDatabasesArcAutoProvisioning = defenderForDatabasesArcAutoProvisioning; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (arcAutoProvisioning() != null) { + arcAutoProvisioning().validate(); + } + if (defenderForDatabasesArcAutoProvisioning() != null) { + 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 new file mode 100644 index 000000000000..254eae105233 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ARC autoprovisioning configuration. + */ +@Fluent +public final class DefenderForDatabasesGcpOfferingArcAutoProvisioning extends ArcAutoProvisioningGcp { + /** + * Creates an instance of DefenderForDatabasesGcpOfferingArcAutoProvisioning class. + */ + public DefenderForDatabasesGcpOfferingArcAutoProvisioning() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForDatabasesGcpOfferingArcAutoProvisioning withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForDatabasesGcpOfferingArcAutoProvisioning + withConfiguration(ArcAutoProvisioningConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..be22f3fad84d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 native cloud connection configuration. + */ +@Fluent +public final class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + implements JsonSerializable { + /* + * The service account email address in GCP for this offering + */ + private String serviceAccountEmailAddress; + + /* + * The GCP workload identity provider id for this offering + */ + private String workloadIdentityProviderId; + + /** + * Creates an instance of DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning class. + */ + public DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning() { + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this offering. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this offering. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning object itself. + */ + public DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The GCP workload identity provider id for this offering. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The GCP workload identity provider id for this offering. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning object itself. + */ + public DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + 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("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 new file mode 100644 index 000000000000..1c615386ecfb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOffering.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Defender for Servers AWS offering. + */ +@Fluent +public final class DefenderForServersAwsOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_SERVERS_AWS; + + /* + * The Defender for servers connection configuration + */ + private DefenderForServersAwsOfferingDefenderForServers defenderForServers; + + /* + * The ARC autoprovisioning configuration + */ + private DefenderForServersAwsOfferingArcAutoProvisioning arcAutoProvisioning; + + /* + * The Vulnerability Assessment autoprovisioning configuration + */ + private DefenderForServersAwsOfferingVaAutoProvisioning vaAutoProvisioning; + + /* + * The Microsoft Defender for Endpoint autoprovisioning configuration + */ + private DefenderForServersAwsOfferingMdeAutoProvisioning mdeAutoProvisioning; + + /* + * configuration for the servers offering subPlan + */ + private DefenderForServersAwsOfferingSubPlan subPlan; + + /* + * The Microsoft Defender for Server VM scanning configuration + */ + private DefenderForServersAwsOfferingVmScanners vmScanners; + + /** + * Creates an instance of DefenderForServersAwsOffering class. + */ + public DefenderForServersAwsOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the defenderForServers property: The Defender for servers connection configuration. + * + * @return the defenderForServers value. + */ + public DefenderForServersAwsOfferingDefenderForServers defenderForServers() { + return this.defenderForServers; + } + + /** + * Set the defenderForServers property: The Defender for servers connection configuration. + * + * @param defenderForServers the defenderForServers value to set. + * @return the DefenderForServersAwsOffering object itself. + */ + public DefenderForServersAwsOffering + withDefenderForServers(DefenderForServersAwsOfferingDefenderForServers defenderForServers) { + this.defenderForServers = defenderForServers; + return this; + } + + /** + * Get the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @return the arcAutoProvisioning value. + */ + public DefenderForServersAwsOfferingArcAutoProvisioning arcAutoProvisioning() { + return this.arcAutoProvisioning; + } + + /** + * Set the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @param arcAutoProvisioning the arcAutoProvisioning value to set. + * @return the DefenderForServersAwsOffering object itself. + */ + public DefenderForServersAwsOffering + withArcAutoProvisioning(DefenderForServersAwsOfferingArcAutoProvisioning arcAutoProvisioning) { + this.arcAutoProvisioning = arcAutoProvisioning; + return this; + } + + /** + * Get the vaAutoProvisioning property: The Vulnerability Assessment autoprovisioning configuration. + * + * @return the vaAutoProvisioning value. + */ + public DefenderForServersAwsOfferingVaAutoProvisioning vaAutoProvisioning() { + return this.vaAutoProvisioning; + } + + /** + * Set the vaAutoProvisioning property: The Vulnerability Assessment autoprovisioning configuration. + * + * @param vaAutoProvisioning the vaAutoProvisioning value to set. + * @return the DefenderForServersAwsOffering object itself. + */ + public DefenderForServersAwsOffering + withVaAutoProvisioning(DefenderForServersAwsOfferingVaAutoProvisioning vaAutoProvisioning) { + this.vaAutoProvisioning = vaAutoProvisioning; + return this; + } + + /** + * Get the mdeAutoProvisioning property: The Microsoft Defender for Endpoint autoprovisioning configuration. + * + * @return the mdeAutoProvisioning value. + */ + public DefenderForServersAwsOfferingMdeAutoProvisioning mdeAutoProvisioning() { + return this.mdeAutoProvisioning; + } + + /** + * Set the mdeAutoProvisioning property: The Microsoft Defender for Endpoint autoprovisioning configuration. + * + * @param mdeAutoProvisioning the mdeAutoProvisioning value to set. + * @return the DefenderForServersAwsOffering object itself. + */ + public DefenderForServersAwsOffering + withMdeAutoProvisioning(DefenderForServersAwsOfferingMdeAutoProvisioning mdeAutoProvisioning) { + this.mdeAutoProvisioning = mdeAutoProvisioning; + return this; + } + + /** + * Get the subPlan property: configuration for the servers offering subPlan. + * + * @return the subPlan value. + */ + public DefenderForServersAwsOfferingSubPlan subPlan() { + return this.subPlan; + } + + /** + * Set the subPlan property: configuration for the servers offering subPlan. + * + * @param subPlan the subPlan value to set. + * @return the DefenderForServersAwsOffering object itself. + */ + public DefenderForServersAwsOffering withSubPlan(DefenderForServersAwsOfferingSubPlan subPlan) { + this.subPlan = subPlan; + return this; + } + + /** + * Get the vmScanners property: The Microsoft Defender for Server VM scanning configuration. + * + * @return the vmScanners value. + */ + public DefenderForServersAwsOfferingVmScanners vmScanners() { + return this.vmScanners; + } + + /** + * Set the vmScanners property: The Microsoft Defender for Server VM scanning configuration. + * + * @param vmScanners the vmScanners value to set. + * @return the DefenderForServersAwsOffering object itself. + */ + public DefenderForServersAwsOffering withVmScanners(DefenderForServersAwsOfferingVmScanners vmScanners) { + this.vmScanners = vmScanners; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (defenderForServers() != null) { + defenderForServers().validate(); + } + if (arcAutoProvisioning() != null) { + arcAutoProvisioning().validate(); + } + if (vaAutoProvisioning() != null) { + vaAutoProvisioning().validate(); + } + if (mdeAutoProvisioning() != null) { + mdeAutoProvisioning().validate(); + } + if (subPlan() != null) { + subPlan().validate(); + } + if (vmScanners() != null) { + 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 new file mode 100644 index 000000000000..b0235c5faf3a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingArcAutoProvisioning.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ARC autoprovisioning configuration. + */ +@Fluent +public final class DefenderForServersAwsOfferingArcAutoProvisioning extends ArcAutoProvisioningAws { + /** + * Creates an instance of DefenderForServersAwsOfferingArcAutoProvisioning class. + */ + public DefenderForServersAwsOfferingArcAutoProvisioning() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersAwsOfferingArcAutoProvisioning withCloudRoleArn(String cloudRoleArn) { + super.withCloudRoleArn(cloudRoleArn); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersAwsOfferingArcAutoProvisioning withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersAwsOfferingArcAutoProvisioning + withConfiguration(ArcAutoProvisioningConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..c4b874afcd07 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingDefenderForServers.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Defender for servers connection configuration. + */ +@Fluent +public final class DefenderForServersAwsOfferingDefenderForServers + implements JsonSerializable { + /* + * The cloud role ARN in AWS for this feature + */ + private String cloudRoleArn; + + /** + * Creates an instance of DefenderForServersAwsOfferingDefenderForServers class. + */ + public DefenderForServersAwsOfferingDefenderForServers() { + } + + /** + * Get the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @return the cloudRoleArn value. + */ + public String cloudRoleArn() { + return this.cloudRoleArn; + } + + /** + * Set the cloudRoleArn property: The cloud role ARN in AWS for this feature. + * + * @param cloudRoleArn the cloudRoleArn value to set. + * @return the DefenderForServersAwsOfferingDefenderForServers object itself. + */ + public DefenderForServersAwsOfferingDefenderForServers withCloudRoleArn(String cloudRoleArn) { + this.cloudRoleArn = cloudRoleArn; + 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("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 new file mode 100644 index 000000000000..ae44fbc78966 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingMdeAutoProvisioning.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 for Endpoint autoprovisioning configuration. + */ +@Fluent +public final class DefenderForServersAwsOfferingMdeAutoProvisioning + implements JsonSerializable { + /* + * Is Microsoft Defender for Endpoint auto provisioning enabled + */ + private Boolean enabled; + + /* + * configuration for Microsoft Defender for Endpoint autoprovisioning + */ + private Object configuration; + + /** + * Creates an instance of DefenderForServersAwsOfferingMdeAutoProvisioning class. + */ + public DefenderForServersAwsOfferingMdeAutoProvisioning() { + } + + /** + * Get the enabled property: Is Microsoft Defender for Endpoint auto provisioning enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender for Endpoint auto provisioning enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderForServersAwsOfferingMdeAutoProvisioning object itself. + */ + public DefenderForServersAwsOfferingMdeAutoProvisioning withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the configuration property: configuration for Microsoft Defender for Endpoint autoprovisioning. + * + * @return the configuration value. + */ + public Object configuration() { + return this.configuration; + } + + /** + * Set the configuration property: configuration for Microsoft Defender for Endpoint autoprovisioning. + * + * @param configuration the configuration value to set. + * @return the DefenderForServersAwsOfferingMdeAutoProvisioning object itself. + */ + public DefenderForServersAwsOfferingMdeAutoProvisioning withConfiguration(Object configuration) { + this.configuration = configuration; + 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); + if (this.configuration != null) { + 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 new file mode 100644 index 000000000000..38d813b0b053 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingSubPlan.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * configuration for the servers offering subPlan. + */ +@Fluent +public final class DefenderForServersAwsOfferingSubPlan + implements JsonSerializable { + /* + * The available sub plans + */ + private SubPlan type; + + /** + * Creates an instance of DefenderForServersAwsOfferingSubPlan class. + */ + public DefenderForServersAwsOfferingSubPlan() { + } + + /** + * Get the type property: The available sub plans. + * + * @return the type value. + */ + public SubPlan type() { + return this.type; + } + + /** + * Set the type property: The available sub plans. + * + * @param type the type value to set. + * @return the DefenderForServersAwsOfferingSubPlan object itself. + */ + public DefenderForServersAwsOfferingSubPlan withType(SubPlan type) { + this.type = type; + 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("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 new file mode 100644 index 000000000000..68adb7597064 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioning.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Vulnerability Assessment autoprovisioning configuration. + */ +@Fluent +public final class DefenderForServersAwsOfferingVaAutoProvisioning + implements JsonSerializable { + /* + * Is Vulnerability Assessment auto provisioning enabled + */ + private Boolean enabled; + + /* + * configuration for Vulnerability Assessment autoprovisioning + */ + private DefenderForServersAwsOfferingVaAutoProvisioningConfiguration configuration; + + /** + * Creates an instance of DefenderForServersAwsOfferingVaAutoProvisioning class. + */ + public DefenderForServersAwsOfferingVaAutoProvisioning() { + } + + /** + * Get the enabled property: Is Vulnerability Assessment auto provisioning enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Vulnerability Assessment auto provisioning enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderForServersAwsOfferingVaAutoProvisioning object itself. + */ + public DefenderForServersAwsOfferingVaAutoProvisioning withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the configuration property: configuration for Vulnerability Assessment autoprovisioning. + * + * @return the configuration value. + */ + public DefenderForServersAwsOfferingVaAutoProvisioningConfiguration configuration() { + return this.configuration; + } + + /** + * Set the configuration property: configuration for Vulnerability Assessment autoprovisioning. + * + * @param configuration the configuration value to set. + * @return the DefenderForServersAwsOfferingVaAutoProvisioning object itself. + */ + public DefenderForServersAwsOfferingVaAutoProvisioning + withConfiguration(DefenderForServersAwsOfferingVaAutoProvisioningConfiguration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configuration() != null) { + 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 new file mode 100644 index 000000000000..37f6842aeda2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * configuration for Vulnerability Assessment autoprovisioning. + */ +@Fluent +public final class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration + implements JsonSerializable { + /* + * The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + */ + private Type type; + + /** + * Creates an instance of DefenderForServersAwsOfferingVaAutoProvisioningConfiguration class. + */ + public DefenderForServersAwsOfferingVaAutoProvisioningConfiguration() { + } + + /** + * Get the type property: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. + * + * @param type the type value to set. + * @return the DefenderForServersAwsOfferingVaAutoProvisioningConfiguration object itself. + */ + public DefenderForServersAwsOfferingVaAutoProvisioningConfiguration withType(Type type) { + this.type = type; + 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("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 new file mode 100644 index 000000000000..519eb19db606 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVmScanners.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Microsoft Defender for Server VM scanning configuration. + */ +@Fluent +public final class DefenderForServersAwsOfferingVmScanners extends VmScannersAws { + /** + * Creates an instance of DefenderForServersAwsOfferingVmScanners class. + */ + public DefenderForServersAwsOfferingVmScanners() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersAwsOfferingVmScanners withCloudRoleArn(String cloudRoleArn) { + super.withCloudRoleArn(cloudRoleArn); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersAwsOfferingVmScanners withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersAwsOfferingVmScanners withConfiguration(VmScannersBaseConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..567ad0cec0fc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOffering.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Defender for Servers GCP offering configurations. + */ +@Fluent +public final class DefenderForServersGcpOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_SERVERS_GCP; + + /* + * The Defender for servers connection configuration + */ + private DefenderForServersGcpOfferingDefenderForServers defenderForServers; + + /* + * The ARC autoprovisioning configuration + */ + private DefenderForServersGcpOfferingArcAutoProvisioning arcAutoProvisioning; + + /* + * The Vulnerability Assessment autoprovisioning configuration + */ + private DefenderForServersGcpOfferingVaAutoProvisioning vaAutoProvisioning; + + /* + * The Microsoft Defender for Endpoint autoprovisioning configuration + */ + private DefenderForServersGcpOfferingMdeAutoProvisioning mdeAutoProvisioning; + + /* + * configuration for the servers offering subPlan + */ + private DefenderForServersGcpOfferingSubPlan subPlan; + + /* + * The Microsoft Defender for Server VM scanning configuration + */ + private DefenderForServersGcpOfferingVmScanners vmScanners; + + /** + * Creates an instance of DefenderForServersGcpOffering class. + */ + public DefenderForServersGcpOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the defenderForServers property: The Defender for servers connection configuration. + * + * @return the defenderForServers value. + */ + public DefenderForServersGcpOfferingDefenderForServers defenderForServers() { + return this.defenderForServers; + } + + /** + * Set the defenderForServers property: The Defender for servers connection configuration. + * + * @param defenderForServers the defenderForServers value to set. + * @return the DefenderForServersGcpOffering object itself. + */ + public DefenderForServersGcpOffering + withDefenderForServers(DefenderForServersGcpOfferingDefenderForServers defenderForServers) { + this.defenderForServers = defenderForServers; + return this; + } + + /** + * Get the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @return the arcAutoProvisioning value. + */ + public DefenderForServersGcpOfferingArcAutoProvisioning arcAutoProvisioning() { + return this.arcAutoProvisioning; + } + + /** + * Set the arcAutoProvisioning property: The ARC autoprovisioning configuration. + * + * @param arcAutoProvisioning the arcAutoProvisioning value to set. + * @return the DefenderForServersGcpOffering object itself. + */ + public DefenderForServersGcpOffering + withArcAutoProvisioning(DefenderForServersGcpOfferingArcAutoProvisioning arcAutoProvisioning) { + this.arcAutoProvisioning = arcAutoProvisioning; + return this; + } + + /** + * Get the vaAutoProvisioning property: The Vulnerability Assessment autoprovisioning configuration. + * + * @return the vaAutoProvisioning value. + */ + public DefenderForServersGcpOfferingVaAutoProvisioning vaAutoProvisioning() { + return this.vaAutoProvisioning; + } + + /** + * Set the vaAutoProvisioning property: The Vulnerability Assessment autoprovisioning configuration. + * + * @param vaAutoProvisioning the vaAutoProvisioning value to set. + * @return the DefenderForServersGcpOffering object itself. + */ + public DefenderForServersGcpOffering + withVaAutoProvisioning(DefenderForServersGcpOfferingVaAutoProvisioning vaAutoProvisioning) { + this.vaAutoProvisioning = vaAutoProvisioning; + return this; + } + + /** + * Get the mdeAutoProvisioning property: The Microsoft Defender for Endpoint autoprovisioning configuration. + * + * @return the mdeAutoProvisioning value. + */ + public DefenderForServersGcpOfferingMdeAutoProvisioning mdeAutoProvisioning() { + return this.mdeAutoProvisioning; + } + + /** + * Set the mdeAutoProvisioning property: The Microsoft Defender for Endpoint autoprovisioning configuration. + * + * @param mdeAutoProvisioning the mdeAutoProvisioning value to set. + * @return the DefenderForServersGcpOffering object itself. + */ + public DefenderForServersGcpOffering + withMdeAutoProvisioning(DefenderForServersGcpOfferingMdeAutoProvisioning mdeAutoProvisioning) { + this.mdeAutoProvisioning = mdeAutoProvisioning; + return this; + } + + /** + * Get the subPlan property: configuration for the servers offering subPlan. + * + * @return the subPlan value. + */ + public DefenderForServersGcpOfferingSubPlan subPlan() { + return this.subPlan; + } + + /** + * Set the subPlan property: configuration for the servers offering subPlan. + * + * @param subPlan the subPlan value to set. + * @return the DefenderForServersGcpOffering object itself. + */ + public DefenderForServersGcpOffering withSubPlan(DefenderForServersGcpOfferingSubPlan subPlan) { + this.subPlan = subPlan; + return this; + } + + /** + * Get the vmScanners property: The Microsoft Defender for Server VM scanning configuration. + * + * @return the vmScanners value. + */ + public DefenderForServersGcpOfferingVmScanners vmScanners() { + return this.vmScanners; + } + + /** + * Set the vmScanners property: The Microsoft Defender for Server VM scanning configuration. + * + * @param vmScanners the vmScanners value to set. + * @return the DefenderForServersGcpOffering object itself. + */ + public DefenderForServersGcpOffering withVmScanners(DefenderForServersGcpOfferingVmScanners vmScanners) { + this.vmScanners = vmScanners; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (defenderForServers() != null) { + defenderForServers().validate(); + } + if (arcAutoProvisioning() != null) { + arcAutoProvisioning().validate(); + } + if (vaAutoProvisioning() != null) { + vaAutoProvisioning().validate(); + } + if (mdeAutoProvisioning() != null) { + mdeAutoProvisioning().validate(); + } + if (subPlan() != null) { + subPlan().validate(); + } + if (vmScanners() != null) { + 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 new file mode 100644 index 000000000000..c810aa343585 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingArcAutoProvisioning.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ARC autoprovisioning configuration. + */ +@Fluent +public final class DefenderForServersGcpOfferingArcAutoProvisioning extends ArcAutoProvisioningGcp { + /** + * Creates an instance of DefenderForServersGcpOfferingArcAutoProvisioning class. + */ + public DefenderForServersGcpOfferingArcAutoProvisioning() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersGcpOfferingArcAutoProvisioning withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersGcpOfferingArcAutoProvisioning + withConfiguration(ArcAutoProvisioningConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..863d28b246e4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingDefenderForServers.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Defender for servers connection configuration. + */ +@Fluent +public final class DefenderForServersGcpOfferingDefenderForServers + implements JsonSerializable { + /* + * The workload identity provider id in GCP for this feature + */ + private String workloadIdentityProviderId; + + /* + * The service account email address in GCP for this feature + */ + private String serviceAccountEmailAddress; + + /** + * Creates an instance of DefenderForServersGcpOfferingDefenderForServers class. + */ + public DefenderForServersGcpOfferingDefenderForServers() { + } + + /** + * Get the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The workload identity provider id in GCP for this feature. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the DefenderForServersGcpOfferingDefenderForServers object itself. + */ + public DefenderForServersGcpOfferingDefenderForServers + withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address in GCP for this feature. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the DefenderForServersGcpOfferingDefenderForServers object itself. + */ + public DefenderForServersGcpOfferingDefenderForServers + withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + 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("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 new file mode 100644 index 000000000000..20f3e63d0d33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingMdeAutoProvisioning.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 for Endpoint autoprovisioning configuration. + */ +@Fluent +public final class DefenderForServersGcpOfferingMdeAutoProvisioning + implements JsonSerializable { + /* + * Is Microsoft Defender for Endpoint auto provisioning enabled + */ + private Boolean enabled; + + /* + * configuration for Microsoft Defender for Endpoint autoprovisioning + */ + private Object configuration; + + /** + * Creates an instance of DefenderForServersGcpOfferingMdeAutoProvisioning class. + */ + public DefenderForServersGcpOfferingMdeAutoProvisioning() { + } + + /** + * Get the enabled property: Is Microsoft Defender for Endpoint auto provisioning enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender for Endpoint auto provisioning enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderForServersGcpOfferingMdeAutoProvisioning object itself. + */ + public DefenderForServersGcpOfferingMdeAutoProvisioning withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the configuration property: configuration for Microsoft Defender for Endpoint autoprovisioning. + * + * @return the configuration value. + */ + public Object configuration() { + return this.configuration; + } + + /** + * Set the configuration property: configuration for Microsoft Defender for Endpoint autoprovisioning. + * + * @param configuration the configuration value to set. + * @return the DefenderForServersGcpOfferingMdeAutoProvisioning object itself. + */ + public DefenderForServersGcpOfferingMdeAutoProvisioning withConfiguration(Object configuration) { + this.configuration = configuration; + 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); + if (this.configuration != null) { + 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 new file mode 100644 index 000000000000..2e1f5db33f5d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingSubPlan.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * configuration for the servers offering subPlan. + */ +@Fluent +public final class DefenderForServersGcpOfferingSubPlan + implements JsonSerializable { + /* + * The available sub plans + */ + private SubPlan type; + + /** + * Creates an instance of DefenderForServersGcpOfferingSubPlan class. + */ + public DefenderForServersGcpOfferingSubPlan() { + } + + /** + * Get the type property: The available sub plans. + * + * @return the type value. + */ + public SubPlan type() { + return this.type; + } + + /** + * Set the type property: The available sub plans. + * + * @param type the type value to set. + * @return the DefenderForServersGcpOfferingSubPlan object itself. + */ + public DefenderForServersGcpOfferingSubPlan withType(SubPlan type) { + this.type = type; + 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("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 new file mode 100644 index 000000000000..b41b6d462aa0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioning.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Vulnerability Assessment autoprovisioning configuration. + */ +@Fluent +public final class DefenderForServersGcpOfferingVaAutoProvisioning + implements JsonSerializable { + /* + * Is Vulnerability Assessment auto provisioning enabled + */ + private Boolean enabled; + + /* + * configuration for Vulnerability Assessment autoprovisioning + */ + private DefenderForServersGcpOfferingVaAutoProvisioningConfiguration configuration; + + /** + * Creates an instance of DefenderForServersGcpOfferingVaAutoProvisioning class. + */ + public DefenderForServersGcpOfferingVaAutoProvisioning() { + } + + /** + * Get the enabled property: Is Vulnerability Assessment auto provisioning enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Vulnerability Assessment auto provisioning enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderForServersGcpOfferingVaAutoProvisioning object itself. + */ + public DefenderForServersGcpOfferingVaAutoProvisioning withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the configuration property: configuration for Vulnerability Assessment autoprovisioning. + * + * @return the configuration value. + */ + public DefenderForServersGcpOfferingVaAutoProvisioningConfiguration configuration() { + return this.configuration; + } + + /** + * Set the configuration property: configuration for Vulnerability Assessment autoprovisioning. + * + * @param configuration the configuration value to set. + * @return the DefenderForServersGcpOfferingVaAutoProvisioning object itself. + */ + public DefenderForServersGcpOfferingVaAutoProvisioning + withConfiguration(DefenderForServersGcpOfferingVaAutoProvisioningConfiguration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configuration() != null) { + 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 new file mode 100644 index 000000000000..6bbf1d0da4ec --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * configuration for Vulnerability Assessment autoprovisioning. + */ +@Fluent +public final class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration + implements JsonSerializable { + /* + * The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + */ + private Type type; + + /** + * Creates an instance of DefenderForServersGcpOfferingVaAutoProvisioningConfiguration class. + */ + public DefenderForServersGcpOfferingVaAutoProvisioningConfiguration() { + } + + /** + * Get the type property: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'. + * + * @param type the type value to set. + * @return the DefenderForServersGcpOfferingVaAutoProvisioningConfiguration object itself. + */ + public DefenderForServersGcpOfferingVaAutoProvisioningConfiguration withType(Type type) { + this.type = type; + 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("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 new file mode 100644 index 000000000000..b2c9457a4d29 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVmScanners.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 Microsoft Defender for Server VM scanning configuration. + */ +@Fluent +public final class DefenderForServersGcpOfferingVmScanners extends VmScannersGcp { + /** + * Creates an instance of DefenderForServersGcpOfferingVmScanners class. + */ + public DefenderForServersGcpOfferingVmScanners() { + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersGcpOfferingVmScanners withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DefenderForServersGcpOfferingVmScanners withConfiguration(VmScannersBaseConfiguration configuration) { + super.withConfiguration(configuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 new file mode 100644 index 000000000000..7aec0681ac90 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSetting.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; + +/** + * An immutable client-side representation of DefenderForStorageSetting. + */ +public interface DefenderForStorageSetting { + /** + * 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 properties property: Defender for Storage resource properties. + * + * @return the properties value. + */ + DefenderForStorageSettingProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner object. + * + * @return the inner object. + */ + DefenderForStorageSettingInner innerModel(); + + /** + * The entirety of the DefenderForStorageSetting definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The DefenderForStorageSetting definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the DefenderForStorageSetting definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the DefenderForStorageSetting definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceId. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceId(String resourceId); + } + + /** + * 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + DefenderForStorageSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DefenderForStorageSetting create(Context context); + } + + /** + * The stage of the DefenderForStorageSetting definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Defender for Storage resource properties.. + * + * @param properties Defender for Storage resource properties. + * @return the next definition stage. + */ + WithCreate withProperties(DefenderForStorageSettingProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DefenderForStorageSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DefenderForStorageSetting refresh(Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. Blobs and Files will be scanned + * for malware. + * + * @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. Blobs and Files will be scanned + * for malware. + * + * @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..5f5b80cf4b02 --- /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) TypeSpec 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 new file mode 100644 index 000000000000..f889055af858 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 DefenderForStorages. + */ +public interface DefenderForStorages { + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account along with {@link Response}. + */ + Response getWithResponse(String resourceId, SettingName settingName, Context context); + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 the Defender for Storage settings for the specified storage account. + */ + DefenderForStorageSetting get(String resourceId, SettingName settingName); + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceId); + + /** + * Lists the Defender for Storage settings for the specified storage account. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of Defender for Storage settings as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceId, Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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. Blobs and Files will be scanned + * for malware. + * + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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 fully qualified Azure Resource manager identifier of the resource. + * @param settingName The 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. + * + * @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 the Defender for Storage settings for the specified storage account along with {@link Response}. + */ + DefenderForStorageSetting getById(String id); + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @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 Defender for Storage settings for the specified storage account along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DefenderForStorageSetting resource. + * + * @param name resource name. + * @return the first stage of the new DefenderForStorageSetting definition. + */ + DefenderForStorageSetting.DefinitionStages.Blank define(SettingName name); +} 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 e2fab6399883..13f261bd17d6 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -18,7 +18,7 @@ @Fluent public final class DenylistCustomAlertRule extends ListCustomAlertRule { /* - * The type of the custom alert rule. + * The ruleType property. */ private String ruleType = "DenylistCustomAlertRule"; @@ -34,7 +34,7 @@ public DenylistCustomAlertRule() { } /** - * Get the ruleType property: The type of the custom alert rule. + * Get the ruleType property: The ruleType property. * * @return the ruleType value. */ 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 new file mode 100644 index 000000000000..58dae0eb795e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsCapability.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Details about DevOps capability. + */ +@Immutable +public final class DevOpsCapability implements JsonSerializable { + /* + * Gets the name of the DevOps capability. + */ + private String name; + + /* + * Gets the value of the DevOps capability. + */ + private String value; + + /** + * Creates an instance of DevOpsCapability class. + */ + private DevOpsCapability() { + } + + /** + * Get the name property: Gets the name of the DevOps capability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: Gets the value of the DevOps capability. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * 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(); + 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/DevOpsConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfiguration.java new file mode 100644 index 000000000000..5a5bdfc596ce --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfiguration.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; + +/** + * An immutable client-side representation of DevOpsConfiguration. + */ +public interface DevOpsConfiguration { + /** + * 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 properties property: DevOps Configuration properties. + * + * @return the properties value. + */ + DevOpsConfigurationProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner object. + * + * @return the inner object. + */ + DevOpsConfigurationInner innerModel(); +} 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 new file mode 100644 index 000000000000..72b5166687d1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationProperties.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.List; + +/** + * DevOps Configuration properties. + */ +@Fluent +public final class DevOpsConfigurationProperties 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; + + /* + * Authorization payload. + */ + private Authorization authorization; + + /* + * AutoDiscovery states. + */ + private AutoDiscovery autoDiscovery; + + /* + * List of top-level inventory to select when AutoDiscovery is disabled. + * This field is ignored when AutoDiscovery is enabled. + */ + private List topLevelInventoryList; + + /* + * List of capabilities assigned to the DevOps configuration during the discovery process. + */ + private List capabilities; + + /* + * Details about Agentless configuration. + */ + private AgentlessConfiguration agentlessConfiguration; + + /** + * Creates an instance of DevOpsConfigurationProperties class. + */ + public DevOpsConfigurationProperties() { + } + + /** + * 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 authorization property: Authorization payload. + * + * @return the authorization value. + */ + public Authorization authorization() { + return this.authorization; + } + + /** + * Set the authorization property: Authorization payload. + * + * @param authorization the authorization value to set. + * @return the DevOpsConfigurationProperties object itself. + */ + public DevOpsConfigurationProperties withAuthorization(Authorization authorization) { + this.authorization = authorization; + return this; + } + + /** + * Get the autoDiscovery property: AutoDiscovery states. + * + * @return the autoDiscovery value. + */ + public AutoDiscovery autoDiscovery() { + return this.autoDiscovery; + } + + /** + * Set the autoDiscovery property: AutoDiscovery states. + * + * @param autoDiscovery the autoDiscovery value to set. + * @return the DevOpsConfigurationProperties object itself. + */ + public DevOpsConfigurationProperties withAutoDiscovery(AutoDiscovery autoDiscovery) { + this.autoDiscovery = autoDiscovery; + return this; + } + + /** + * Get the topLevelInventoryList property: List of top-level inventory to select when AutoDiscovery is disabled. + * This field is ignored when AutoDiscovery is enabled. + * + * @return the topLevelInventoryList value. + */ + public List topLevelInventoryList() { + return this.topLevelInventoryList; + } + + /** + * Set the topLevelInventoryList property: List of top-level inventory to select when AutoDiscovery is disabled. + * This field is ignored when AutoDiscovery is enabled. + * + * @param topLevelInventoryList the topLevelInventoryList value to set. + * @return the DevOpsConfigurationProperties object itself. + */ + public DevOpsConfigurationProperties withTopLevelInventoryList(List topLevelInventoryList) { + this.topLevelInventoryList = topLevelInventoryList; + return this; + } + + /** + * Get the capabilities property: List of capabilities assigned to the DevOps configuration during the discovery + * process. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Get the agentlessConfiguration property: Details about Agentless configuration. + * + * @return the agentlessConfiguration value. + */ + public AgentlessConfiguration agentlessConfiguration() { + return this.agentlessConfiguration; + } + + /** + * Set the agentlessConfiguration property: Details about Agentless configuration. + * + * @param agentlessConfiguration the agentlessConfiguration value to set. + * @return the DevOpsConfigurationProperties object itself. + */ + public DevOpsConfigurationProperties withAgentlessConfiguration(AgentlessConfiguration agentlessConfiguration) { + this.agentlessConfiguration = agentlessConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authorization() != null) { + authorization().validate(); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (agentlessConfiguration() != null) { + agentlessConfiguration().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)); + jsonWriter.writeJsonField("agentlessConfiguration", this.agentlessConfiguration); + 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 if ("agentlessConfiguration".equals(fieldName)) { + deserializedDevOpsConfigurationProperties.agentlessConfiguration + = AgentlessConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsConfigurationProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurations.java new file mode 100644 index 000000000000..ccef00abe50d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurations.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; + +/** + * Resource collection API of DevOpsConfigurations. + */ +public interface DevOpsConfigurations { + /** + * Gets a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 a DevOps Configuration along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String securityConnectorName, + Context context); + + /** + * Gets a DevOps Configuration. + * + * @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 DevOps Configuration. + */ + DevOpsConfiguration get(String resourceGroupName, String securityConnectorName); + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + DevOpsConfiguration createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration); + + /** + * Creates or updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + DevOpsConfiguration createOrUpdate(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context); + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + DevOpsConfiguration update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration); + + /** + * Updates a DevOps Configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsConfiguration The DevOps configuration resource payload. + * @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 Configuration resource. + */ + DevOpsConfiguration update(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context); + + /** + * Deletes a DevOps Connector. + * + * @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. + */ + void deleteByResourceGroup(String resourceGroupName, String securityConnectorName); + + /** + * Deletes a DevOps Connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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. + */ + void delete(String resourceGroupName, String securityConnectorName, Context context); + + /** + * List DevOps Configurations. + * + * @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); + + /** + * List DevOps Configurations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector 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 list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsOperationResults.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsOperationResults.java new file mode 100644 index 000000000000..1bc16b65e4cc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsOperationResults.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of DevOpsOperationResults. + */ +public interface DevOpsOperationResults { + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String operationResultId, Context context); + + /** + * Get devops long running operation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param operationResultId The operationResultId 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 devops long running operation result. + */ + OperationStatusResult get(String resourceGroupName, String securityConnectorName, String operationResultId); +} 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 new file mode 100644 index 000000000000..06124b52fde6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsProvisioningState.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * 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. + */ +public final class DevOpsProvisioningState extends ExpandableStringEnum { + /** + * Succeeded. + */ + public static final DevOpsProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Failed. + */ + public static final DevOpsProvisioningState FAILED = fromString("Failed"); + + /** + * Canceled. + */ + public static final DevOpsProvisioningState CANCELED = fromString("Canceled"); + + /** + * Pending. + */ + public static final DevOpsProvisioningState PENDING = fromString("Pending"); + + /** + * PendingDeletion. + */ + public static final DevOpsProvisioningState PENDING_DELETION = fromString("PendingDeletion"); + + /** + * DeletionSuccess. + */ + public static final DevOpsProvisioningState DELETION_SUCCESS = fromString("DeletionSuccess"); + + /** + * DeletionFailure. + */ + public static final DevOpsProvisioningState DELETION_FAILURE = fromString("DeletionFailure"); + + /** + * Creates a new instance of DevOpsProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DevOpsProvisioningState() { + } + + /** + * Creates or finds a DevOpsProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DevOpsProvisioningState. + */ + public static DevOpsProvisioningState fromString(String name) { + return fromString(name, DevOpsProvisioningState.class); + } + + /** + * Gets known DevOpsProvisioningState values. + * + * @return known DevOpsProvisioningState values. + */ + public static Collection values() { + return values(DevOpsProvisioningState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroup.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroup.java index 246f68a1ad58..779dae450392 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroup.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroup.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.DeviceSecurityGroupInner; import java.util.List; @@ -33,6 +34,13 @@ public interface DeviceSecurityGroup { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the thresholdRules property: The list of custom alert threshold rules. * @@ -91,7 +99,7 @@ interface WithScope { /** * Specifies resourceId. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @return the next definition stage. */ WithCreate withExistingResourceId(String resourceId); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroups.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroups.java index 79f7aa53697d..7bf695d70343 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroups.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroups.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,33 +12,10 @@ * Resource collection API of DeviceSecurityGroups. */ public interface DeviceSecurityGroups { - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedIterable}. - */ - PagedIterable list(String resourceId); - - /** - * Use this method get the list of device security groups for the specified IoT Hub resource. - * - * @param resourceId The identifier 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 list of device security groups as paginated response with {@link PagedIterable}. - */ - PagedIterable list(String resourceId, Context context); - /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -52,7 +29,7 @@ public interface DeviceSecurityGroups { /** * Use this method to get the device security group for the specified IoT Hub resource. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -65,7 +42,7 @@ public interface DeviceSecurityGroups { /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @param context The context to associate with this operation. @@ -80,7 +57,7 @@ Response deleteByResourceGroupWithResponse(String resourceId, String devic /** * User this method to deletes the device security group. * - * @param resourceId The identifier of the resource. + * @param resourceId The fully qualified Azure Resource manager identifier of the resource. * @param deviceSecurityGroupName The name of the device security group. Note that the name of the device security * group is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -89,6 +66,29 @@ Response deleteByResourceGroupWithResponse(String resourceId, String devic */ void deleteByResourceGroup(String resourceId, String deviceSecurityGroupName); + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceId); + + /** + * Use this method get the list of device security groups for the specified IoT Hub resource. + * + * @param resourceId The fully qualified Azure Resource manager identifier 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 list of device security groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceId, Context context); + /** * Use this method to get the device security group for the specified IoT Hub resource. * 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 deleted file mode 100644 index 715969d5d508..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.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.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.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * Number of direct method invokes is not in allowed range. - */ -@Fluent -public final class DirectMethodInvokesNotInAllowedRange extends TimeWindowCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "DirectMethodInvokesNotInAllowedRange"; - - /** - * Creates an instance of DirectMethodInvokesNotInAllowedRange class. - */ - public DirectMethodInvokesNotInAllowedRange() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public DirectMethodInvokesNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { - super.withTimeWindowSize(timeWindowSize); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DirectMethodInvokesNotInAllowedRange withMinThreshold(int minThreshold) { - super.withMinThreshold(minThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DirectMethodInvokesNotInAllowedRange withMaxThreshold(int maxThreshold) { - super.withMaxThreshold(maxThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DirectMethodInvokesNotInAllowedRange withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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/DiscoveredSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolution.java index 88a44bda8f14..9473f49523b8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolution.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolution.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; /** @@ -38,6 +39,13 @@ public interface DiscoveredSecuritySolution { */ String location(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the securityFamily property: The security family of the discovered solution. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutions.java index 7c9c8757b7c1..11b409cf8f92 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutions.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutions.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,26 +13,34 @@ */ public interface DiscoveredSecuritySolutions { /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific discovered Security Solution along with {@link Response}. */ - PagedIterable list(); + Response getWithResponse(String resourceGroupName, String ascLocation, + String discoveredSecuritySolutionName, Context context); /** - * Gets a list of discovered Security Solutions for the subscription. + * Gets a specific discovered Security Solution. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param discoveredSecuritySolutionName Name of a discovered security solution. * @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 discovered Security Solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific discovered Security Solution. */ - PagedIterable list(Context context); + DiscoveredSecuritySolution get(String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName); /** * Gets a list of discovered Security Solutions for the subscription and location. @@ -62,34 +70,24 @@ public interface DiscoveredSecuritySolutions { PagedIterable listByHomeRegion(String ascLocation, Context context); /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. - * @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 discovered Security Solution along with {@link Response}. + * @return a list of discovered Security Solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - Response getWithResponse(String resourceGroupName, String ascLocation, - String discoveredSecuritySolutionName, Context context); + PagedIterable list(); /** - * Gets a specific discovered Security Solution. + * Gets a list of discovered Security Solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param discoveredSecuritySolutionName Name of a discovered security solution. + * @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 discovered Security Solution. + * @return a list of discovered Security Solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - DiscoveredSecuritySolution get(String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName); + PagedIterable list(Context context); } 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..13dc167d0f5c --- /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) TypeSpec 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 index b7ec28941b49..52ede70ad74a 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,17 +12,17 @@ */ public final class Effect extends ExpandableStringEnum { /** - * Static value Audit for Effect. + * Audit. */ public static final Effect AUDIT = fromString("Audit"); /** - * Static value Exempt for Effect. + * Exempt. */ public static final Effect EXEMPT = fromString("Exempt"); /** - * Static value Attest for Effect. + * Attest. */ public static final Effect ATTEST = fromString("Attest"); 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 6c9ba4bdec37..0b001d348438 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -14,12 +14,13 @@ */ public final class Enforce extends ExpandableStringEnum { /** - * Static value False for Enforce. + * Allows the descendants of this scope to override the pricing configuration set on this scope (allows setting + * inherited="False"). */ public static final Enforce FALSE = fromString("False"); /** - * Static value True for Enforce. + * Prevents overrides and forces the current scope's pricing configuration to all descendants. */ public static final Enforce TRUE = fromString("True"); 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 new file mode 100644 index 000000000000..9ebb245e2b6a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentData.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 security connector environment data. + */ +@Immutable +public class EnvironmentData implements JsonSerializable { + /* + * The type of the environment data. + */ + private EnvironmentType environmentType = EnvironmentType.fromString("EnvironmentData"); + + /** + * Creates an instance of EnvironmentData class. + */ + public EnvironmentData() { + } + + /** + * Get the environmentType property: The type of the environment data. + * + * @return the environmentType value. + */ + public EnvironmentType environmentType() { + return this.environmentType; + } + + /** + * 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("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 new file mode 100644 index 000000000000..8e14f7e32356 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentDetails.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 details of the resource. + */ +@Immutable +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) + */ + private String nativeResourceId; + + /* + * The hierarchy id of the connector (in case of Azure - the subscription Id, in case of MC - the hierarchyId id) + */ + 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) + */ + private String organizationalHierarchyId; + + /* + * The subscription Id + */ + private String subscriptionId; + + /* + * The tenant Id + */ + private String tenantId; + + /** + * Creates an instance of EnvironmentDetails class. + */ + private EnvironmentDetails() { + } + + /** + * Get the nativeResourceId property: The native resource id of the resource (in case of Azure - the resource Id, in + * case of MC - the native resource id). + * + * @return the nativeResourceId value. + */ + public String nativeResourceId() { + return this.nativeResourceId; + } + + /** + * Get the environmentHierarchyId property: The hierarchy id of the connector (in case of Azure - the subscription + * Id, in case of MC - the hierarchyId id). + * + * @return the environmentHierarchyId value. + */ + public String environmentHierarchyId() { + return this.environmentHierarchyId; + } + + /** + * Get the organizationalHierarchyId property: The organizational hierarchy id of the connector (in case of Azure - + * the subscription Id, in case of MC - the organizational hierarchyId id). + * + * @return the organizationalHierarchyId value. + */ + public String organizationalHierarchyId() { + return this.organizationalHierarchyId; + } + + /** + * Get the subscriptionId property: The subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the tenantId property: The tenant Id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * 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("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 new file mode 100644 index 000000000000..56787a939591 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentType.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the environment data. + */ +public final class EnvironmentType extends ExpandableStringEnum { + /** + * AwsAccount. + */ + public static final EnvironmentType AWS_ACCOUNT = fromString("AwsAccount"); + + /** + * GcpProject. + */ + public static final EnvironmentType GCP_PROJECT = fromString("GcpProject"); + + /** + * GithubScope. + */ + public static final EnvironmentType GITHUB_SCOPE = fromString("GithubScope"); + + /** + * AzureDevOpsScope. + */ + public static final EnvironmentType AZURE_DEV_OPS_SCOPE = fromString("AzureDevOpsScope"); + + /** + * GitlabScope. + */ + public static final EnvironmentType GITLAB_SCOPE = fromString("GitlabScope"); + + /** + * DockerHubOrganization. + */ + public static final EnvironmentType DOCKER_HUB_ORGANIZATION = fromString("DockerHubOrganization"); + + /** + * JFrogArtifactory. + */ + public static final EnvironmentType JFROG_ARTIFACTORY = fromString("JFrogArtifactory"); + + /** + * Creates a new instance of EnvironmentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnvironmentType() { + } + + /** + * Creates or finds a EnvironmentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnvironmentType. + */ + public static EnvironmentType fromString(String name) { + return fromString(name, EnvironmentType.class); + } + + /** + * Gets known EnvironmentType values. + * + * @return known EnvironmentType values. + */ + public static Collection values() { + return values(EnvironmentType.class); + } +} 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 new file mode 100644 index 000000000000..44a72c12c6d5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A valid event source type. + */ +public final class EventSource extends ExpandableStringEnum { + /** + * Assessments. + */ + public static final EventSource ASSESSMENTS = fromString("Assessments"); + + /** + * AssessmentsSnapshot. + */ + public static final EventSource ASSESSMENTS_SNAPSHOT = fromString("AssessmentsSnapshot"); + + /** + * SubAssessments. + */ + public static final EventSource SUB_ASSESSMENTS = fromString("SubAssessments"); + + /** + * SubAssessmentsSnapshot. + */ + public static final EventSource SUB_ASSESSMENTS_SNAPSHOT = fromString("SubAssessmentsSnapshot"); + + /** + * Alerts. + */ + public static final EventSource ALERTS = fromString("Alerts"); + + /** + * SecureScores. + */ + public static final EventSource SECURE_SCORES = fromString("SecureScores"); + + /** + * SecureScoresSnapshot. + */ + public static final EventSource SECURE_SCORES_SNAPSHOT = fromString("SecureScoresSnapshot"); + + /** + * SecureScoreControls. + */ + public static final EventSource SECURE_SCORE_CONTROLS = fromString("SecureScoreControls"); + + /** + * SecureScoreControlsSnapshot. + */ + public static final EventSource SECURE_SCORE_CONTROLS_SNAPSHOT = fromString("SecureScoreControlsSnapshot"); + + /** + * RegulatoryComplianceAssessment. + */ + public static final EventSource REGULATORY_COMPLIANCE_ASSESSMENT = fromString("RegulatoryComplianceAssessment"); + + /** + * RegulatoryComplianceAssessmentSnapshot. + */ + public static final EventSource REGULATORY_COMPLIANCE_ASSESSMENT_SNAPSHOT + = fromString("RegulatoryComplianceAssessmentSnapshot"); + + /** + * AttackPaths. + */ + public static final EventSource ATTACK_PATHS = fromString("AttackPaths"); + + /** + * AttackPathsSnapshot. + */ + public static final EventSource ATTACK_PATHS_SNAPSHOT = fromString("AttackPathsSnapshot"); + + /** + * Creates a new instance of EventSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventSource() { + } + + /** + * Creates or finds a EventSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventSource. + */ + public static EventSource fromString(String name) { + return fromString(name, EventSource.class); + } + + /** + * Gets known EventSource values. + * + * @return known EventSource values. + */ + public static Collection values() { + return values(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 new file mode 100644 index 000000000000..da8a43f887fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExecuteGovernanceRuleParams.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * Governance rule execution parameters. + */ +@Fluent +public final class ExecuteGovernanceRuleParams implements JsonSerializable { + /* + * Describe if governance rule should be override + */ + private Boolean override; + + /** + * Creates an instance of ExecuteGovernanceRuleParams class. + */ + public ExecuteGovernanceRuleParams() { + } + + /** + * Get the override property: Describe if governance rule should be override. + * + * @return the override value. + */ + public Boolean override() { + return this.override; + } + + /** + * Set the override property: Describe if governance rule should be override. + * + * @param override the override value to set. + * @return the ExecuteGovernanceRuleParams object itself. + */ + public ExecuteGovernanceRuleParams withOverride(Boolean override) { + this.override = override; + 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("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 index 0eb21400df06..5feaac6b49ca 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,12 +12,12 @@ */ public final class ExemptionCategory extends ExpandableStringEnum { /** - * Static value waiver for ExemptionCategory. + * waiver. */ public static final ExemptionCategory WAIVER = fromString("waiver"); /** - * Static value mitigated for ExemptionCategory. + * mitigated. */ public static final ExemptionCategory MITIGATED = fromString("mitigated"); 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 60f003888de5..64187f1416fd 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,7 +12,7 @@ */ public final class ExpandControlsEnum extends ExpandableStringEnum { /** - * Static value definition for ExpandControlsEnum. + * Add definition object for each control. */ public static final ExpandControlsEnum DEFINITION = fromString("definition"); 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 3665c59728a7..710a8126dc6c 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,12 +12,12 @@ */ public final class ExpandEnum extends ExpandableStringEnum { /** - * Static value links for ExpandEnum. + * All links associated with an assessment. */ public static final ExpandEnum LINKS = fromString("links"); /** - * Static value metadata for ExpandEnum. + * Assessment metadata. */ public static final ExpandEnum METADATA = fromString("metadata"); 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 b2f2bb22ba6e..f816af18af57 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,7 +12,7 @@ */ public final class ExportData extends ExpandableStringEnum { /** - * Static value RawEvents for ExportData. + * Agent raw events. */ public static final ExportData RAW_EVENTS = fromString("RawEvents"); 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 e61f7346edf3..102f752a7e39 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -32,7 +32,7 @@ public final class Extension implements JsonSerializable { * 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 + * 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 @@ -93,7 +93,7 @@ public Extension() { * 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 + * 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 @@ -138,7 +138,7 @@ public String name() { * 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 + * 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 diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolution.java index 7190b38d1c60..ea5fa2c77611 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolution.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolution.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; /** @@ -38,6 +39,13 @@ public interface ExternalSecuritySolution { */ ExternalSecuritySolutionKind kind(); + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + Object properties(); + /** * Gets the location property: Location where the resource is stored. * @@ -45,6 +53,13 @@ public interface ExternalSecuritySolution { */ String location(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the inner com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner object. * 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 fa8311eb8b57..46eaf4f97a12 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -12,17 +12,17 @@ */ public final class ExternalSecuritySolutionKind extends ExpandableStringEnum { /** - * Static value CEF for ExternalSecuritySolutionKind. + * CEF. */ public static final ExternalSecuritySolutionKind CEF = fromString("CEF"); /** - * Static value ATA for ExternalSecuritySolutionKind. + * ATA. */ public static final ExternalSecuritySolutionKind ATA = fromString("ATA"); /** - * Static value AAD for ExternalSecuritySolutionKind. + * AAD. */ public static final ExternalSecuritySolutionKind AAD = fromString("AAD"); 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 9de1c6b32a39..911eb0f382c3 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 @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,7 +16,7 @@ /** * The solution properties (correspond to the solution kind). */ -@Fluent +@Immutable public class ExternalSecuritySolutionProperties implements JsonSerializable { /* * The deviceVendor property. @@ -41,7 +41,7 @@ public class ExternalSecuritySolutionProperties implements JsonSerializable additionalProperties() { * @param additionalProperties the additionalProperties value to set. * @return the ExternalSecuritySolutionProperties object itself. */ - public ExternalSecuritySolutionProperties withAdditionalProperties(Map additionalProperties) { + ExternalSecuritySolutionProperties withAdditionalProperties(Map additionalProperties) { this.additionalProperties = additionalProperties; return this; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutions.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutions.java index 5eb50a8611f4..5566ba633fee 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutions.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutions.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.security.models; @@ -13,26 +13,34 @@ */ public interface ExternalSecuritySolutions { /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. + * @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 external security solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific external Security Solution along with {@link Response}. */ - PagedIterable list(); + Response getWithResponse(String resourceGroupName, String ascLocation, + String externalSecuritySolutionsName, Context context); /** - * Gets a list of external security solutions for the subscription. + * Gets a specific external Security Solution. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get + * locations. + * @param externalSecuritySolutionsName Name of an external security solution. * @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 external security solutions for the subscription as paginated response with - * {@link PagedIterable}. + * @return a specific external Security Solution. */ - PagedIterable list(Context context); + ExternalSecuritySolution get(String resourceGroupName, String ascLocation, String externalSecuritySolutionsName); /** * Gets a list of external Security Solutions for the subscription and location. @@ -62,34 +70,24 @@ public interface ExternalSecuritySolutions { PagedIterable listByHomeRegion(String ascLocation, Context context); /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. - * @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 external Security Solution along with {@link Response}. + * @return a list of external security solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - Response getWithResponse(String resourceGroupName, String ascLocation, - String externalSecuritySolutionsName, Context context); + PagedIterable list(); /** - * Gets a specific external Security Solution. + * Gets a list of external security solutions for the subscription. * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param externalSecuritySolutionsName Name of an external security solution. + * @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 external Security Solution. + * @return a list of external security solutions for the subscription as paginated response with + * {@link PagedIterable}. */ - ExternalSecuritySolution get(String resourceGroupName, String ascLocation, String externalSecuritySolutionsName); + PagedIterable list(Context context); } 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 deleted file mode 100644 index 8c34bf3f682c..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.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.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.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * Number of failed local logins is not in allowed range. - */ -@Fluent -public final class FailedLocalLoginsNotInAllowedRange extends TimeWindowCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "FailedLocalLoginsNotInAllowedRange"; - - /** - * Creates an instance of FailedLocalLoginsNotInAllowedRange class. - */ - public FailedLocalLoginsNotInAllowedRange() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public FailedLocalLoginsNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { - super.withTimeWindowSize(timeWindowSize); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FailedLocalLoginsNotInAllowedRange withMinThreshold(int minThreshold) { - super.withMinThreshold(minThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FailedLocalLoginsNotInAllowedRange withMaxThreshold(int maxThreshold) { - super.withMaxThreshold(maxThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FailedLocalLoginsNotInAllowedRange withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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/FileUploadsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java deleted file mode 100644 index e1dfabcc7e32..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java +++ /dev/null @@ -1,147 +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.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. - */ -@Fluent -public final class FileUploadsNotInAllowedRange extends TimeWindowCustomAlertRule { - /* - * The type of the custom alert rule. - */ - private String ruleType = "FileUploadsNotInAllowedRange"; - - /** - * Creates an instance of FileUploadsNotInAllowedRange class. - */ - public FileUploadsNotInAllowedRange() { - } - - /** - * Get the ruleType property: The type of the custom alert rule. - * - * @return the ruleType value. - */ - @Override - public String ruleType() { - return this.ruleType; - } - - /** - * {@inheritDoc} - */ - @Override - public FileUploadsNotInAllowedRange withTimeWindowSize(Duration timeWindowSize) { - super.withTimeWindowSize(timeWindowSize); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FileUploadsNotInAllowedRange withMinThreshold(int minThreshold) { - super.withMinThreshold(minThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FileUploadsNotInAllowedRange withMaxThreshold(int maxThreshold) { - super.withMaxThreshold(maxThreshold); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FileUploadsNotInAllowedRange withIsEnabled(boolean isEnabled) { - super.withIsEnabled(isEnabled); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void 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/FilesScanSummary.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FilesScanSummary.java new file mode 100644 index 000000000000..6a6477d92cbf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FilesScanSummary.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; + +/** + * A summary of the scan results of the files that were scanned. + */ +@Immutable +public final class FilesScanSummary implements JsonSerializable { + /* + * The total number of files that were scanned. + */ + private Long totalFilesScanned; + + /* + * The number of malicious files that were detected during the scan. + */ + private Long maliciousFilesCount; + + /* + * The number of files that were skipped. + */ + private Long skippedFilesCount; + + /* + * The number of failed file scans. + */ + private Long failedFilesCount; + + /* + * The number of gigabytes of data that were scanned. + */ + private Double scannedFilesInGB; + + /** + * Creates an instance of FilesScanSummary class. + */ + private FilesScanSummary() { + } + + /** + * Get the totalFilesScanned property: The total number of files that were scanned. + * + * @return the totalFilesScanned value. + */ + public Long totalFilesScanned() { + return this.totalFilesScanned; + } + + /** + * Get the maliciousFilesCount property: The number of malicious files that were detected during the scan. + * + * @return the maliciousFilesCount value. + */ + public Long maliciousFilesCount() { + return this.maliciousFilesCount; + } + + /** + * Get the skippedFilesCount property: The number of files that were skipped. + * + * @return the skippedFilesCount value. + */ + public Long skippedFilesCount() { + return this.skippedFilesCount; + } + + /** + * Get the failedFilesCount property: The number of failed file scans. + * + * @return the failedFilesCount value. + */ + public Long failedFilesCount() { + return this.failedFilesCount; + } + + /** + * Get the scannedFilesInGB property: The number of gigabytes of data that were scanned. + * + * @return the scannedFilesInGB value. + */ + public Double scannedFilesInGB() { + return this.scannedFilesInGB; + } + + /** + * 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("totalFilesScanned", this.totalFilesScanned); + jsonWriter.writeNumberField("maliciousFilesCount", this.maliciousFilesCount); + jsonWriter.writeNumberField("skippedFilesCount", this.skippedFilesCount); + jsonWriter.writeNumberField("failedFilesCount", this.failedFilesCount); + jsonWriter.writeNumberField("scannedFilesInGB", this.scannedFilesInGB); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FilesScanSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FilesScanSummary 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 FilesScanSummary. + */ + public static FilesScanSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FilesScanSummary deserializedFilesScanSummary = new FilesScanSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalFilesScanned".equals(fieldName)) { + deserializedFilesScanSummary.totalFilesScanned = reader.getNullable(JsonReader::getLong); + } else if ("maliciousFilesCount".equals(fieldName)) { + deserializedFilesScanSummary.maliciousFilesCount = reader.getNullable(JsonReader::getLong); + } else if ("skippedFilesCount".equals(fieldName)) { + deserializedFilesScanSummary.skippedFilesCount = reader.getNullable(JsonReader::getLong); + } else if ("failedFilesCount".equals(fieldName)) { + deserializedFilesScanSummary.failedFilesCount = reader.getNullable(JsonReader::getLong); + } else if ("scannedFilesInGB".equals(fieldName)) { + deserializedFilesScanSummary.scannedFilesInGB = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedFilesScanSummary; + }); + } +} 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 new file mode 100644 index 000000000000..7da0eb3e509e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalData.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 gcpOrganization data. + */ +@Immutable +public class GcpOrganizationalData implements JsonSerializable { + /* + * The multi cloud account's membership type in the organization + */ + private OrganizationMembershipType organizationMembershipType + = OrganizationMembershipType.fromString("GcpOrganizationalData"); + + /** + * Creates an instance of GcpOrganizationalData class. + */ + public GcpOrganizationalData() { + } + + /** + * Get the organizationMembershipType property: The multi cloud account's membership type in the organization. + * + * @return the organizationMembershipType value. + */ + public OrganizationMembershipType organizationMembershipType() { + return this.organizationMembershipType; + } + + /** + * 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("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 new file mode 100644 index 000000000000..888ccb7b723c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataMember.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 gcpOrganization data for the member account. + */ +@Fluent +public final class GcpOrganizationalDataMember extends GcpOrganizationalData { + /* + * The multi cloud account's membership type in the organization + */ + 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 + */ + private String parentHierarchyId; + + /* + * The GCP management project number from organizational onboarding + */ + private String managementProjectNumber; + + /** + * Creates an instance of GcpOrganizationalDataMember class. + */ + public GcpOrganizationalDataMember() { + } + + /** + * Get the organizationMembershipType property: The multi cloud account's membership type in the organization. + * + * @return the organizationMembershipType value. + */ + @Override + public OrganizationMembershipType organizationMembershipType() { + return this.organizationMembershipType; + } + + /** + * Get the parentHierarchyId property: If the multi cloud account is not of membership type organization, this will + * be the ID of the project's parent. + * + * @return the parentHierarchyId value. + */ + public String parentHierarchyId() { + return this.parentHierarchyId; + } + + /** + * Set the parentHierarchyId property: If the multi cloud account is not of membership type organization, this will + * be the ID of the project's parent. + * + * @param parentHierarchyId the parentHierarchyId value to set. + * @return the GcpOrganizationalDataMember object itself. + */ + public GcpOrganizationalDataMember withParentHierarchyId(String parentHierarchyId) { + this.parentHierarchyId = parentHierarchyId; + return this; + } + + /** + * Get the managementProjectNumber property: The GCP management project number from organizational onboarding. + * + * @return the managementProjectNumber value. + */ + public String managementProjectNumber() { + return this.managementProjectNumber; + } + + /** + * Set the managementProjectNumber property: The GCP management project number from organizational onboarding. + * + * @param managementProjectNumber the managementProjectNumber value to set. + * @return the GcpOrganizationalDataMember object itself. + */ + public GcpOrganizationalDataMember withManagementProjectNumber(String managementProjectNumber) { + this.managementProjectNumber = managementProjectNumber; + 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("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 new file mode 100644 index 000000000000..67344fe134ed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataOrganization.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * The gcpOrganization data for the parent account. + */ +@Fluent +public final class GcpOrganizationalDataOrganization extends GcpOrganizationalData { + /* + * The multi cloud account's membership type in the organization + */ + private OrganizationMembershipType organizationMembershipType = OrganizationMembershipType.ORGANIZATION; + + /* + * If the multi cloud account is of membership type organization, list of accounts excluded from offering + */ + private List excludedProjectNumbers; + + /* + * The service account email address which represents the organization level permissions container. + */ + private String serviceAccountEmailAddress; + + /* + * The GCP workload identity provider id which represents the permissions required to auto provision security + * connectors + */ + private String workloadIdentityProviderId; + + /* + * GCP organization name + */ + private String organizationName; + + /** + * Creates an instance of GcpOrganizationalDataOrganization class. + */ + public GcpOrganizationalDataOrganization() { + } + + /** + * Get the organizationMembershipType property: The multi cloud account's membership type in the organization. + * + * @return the organizationMembershipType value. + */ + @Override + public OrganizationMembershipType organizationMembershipType() { + return this.organizationMembershipType; + } + + /** + * Get the excludedProjectNumbers property: If the multi cloud account is of membership type organization, list of + * accounts excluded from offering. + * + * @return the excludedProjectNumbers value. + */ + public List excludedProjectNumbers() { + return this.excludedProjectNumbers; + } + + /** + * Set the excludedProjectNumbers property: If the multi cloud account is of membership type organization, list of + * accounts excluded from offering. + * + * @param excludedProjectNumbers the excludedProjectNumbers value to set. + * @return the GcpOrganizationalDataOrganization object itself. + */ + public GcpOrganizationalDataOrganization withExcludedProjectNumbers(List excludedProjectNumbers) { + this.excludedProjectNumbers = excludedProjectNumbers; + return this; + } + + /** + * Get the serviceAccountEmailAddress property: The service account email address which represents the organization + * level permissions container. + * + * @return the serviceAccountEmailAddress value. + */ + public String serviceAccountEmailAddress() { + return this.serviceAccountEmailAddress; + } + + /** + * Set the serviceAccountEmailAddress property: The service account email address which represents the organization + * level permissions container. + * + * @param serviceAccountEmailAddress the serviceAccountEmailAddress value to set. + * @return the GcpOrganizationalDataOrganization object itself. + */ + public GcpOrganizationalDataOrganization withServiceAccountEmailAddress(String serviceAccountEmailAddress) { + this.serviceAccountEmailAddress = serviceAccountEmailAddress; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The GCP workload identity provider id which represents the + * permissions required to auto provision security connectors. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The GCP workload identity provider id which represents the + * permissions required to auto provision security connectors. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the GcpOrganizationalDataOrganization object itself. + */ + public GcpOrganizationalDataOrganization withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Get the organizationName property: GCP organization name. + * + * @return the organizationName value. + */ + public String organizationName() { + return this.organizationName; + } + + /** + * 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("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 new file mode 100644 index 000000000000..be8ed647524b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectDetails.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 details about the project represented by the security connector. + */ +@Fluent +public final class GcpProjectDetails implements JsonSerializable { + /* + * The unique GCP Project number + */ + private String projectNumber; + + /* + * The GCP Project id + */ + private String projectId; + + /* + * The GCP workload identity federation pool id + */ + private String workloadIdentityPoolId; + + /* + * GCP project name + */ + private String projectName; + + /** + * Creates an instance of GcpProjectDetails class. + */ + public GcpProjectDetails() { + } + + /** + * Get the projectNumber property: The unique GCP Project number. + * + * @return the projectNumber value. + */ + public String projectNumber() { + return this.projectNumber; + } + + /** + * Set the projectNumber property: The unique GCP Project number. + * + * @param projectNumber the projectNumber value to set. + * @return the GcpProjectDetails object itself. + */ + public GcpProjectDetails withProjectNumber(String projectNumber) { + this.projectNumber = projectNumber; + return this; + } + + /** + * Get the projectId property: The GCP Project id. + * + * @return the projectId value. + */ + public String projectId() { + return this.projectId; + } + + /** + * Set the projectId property: The GCP Project id. + * + * @param projectId the projectId value to set. + * @return the GcpProjectDetails object itself. + */ + public GcpProjectDetails withProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Get the workloadIdentityPoolId property: The GCP workload identity federation pool id. + * + * @return the workloadIdentityPoolId value. + */ + public String workloadIdentityPoolId() { + return this.workloadIdentityPoolId; + } + + /** + * Get the projectName property: GCP project name. + * + * @return the projectName value. + */ + public String projectName() { + return this.projectName; + } + + /** + * 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("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 new file mode 100644 index 000000000000..465058bf2701 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectEnvironmentData.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 GCP project connector environment data. + */ +@Fluent +public final class GcpProjectEnvironmentData extends EnvironmentData { + /* + * The type of the environment data. + */ + private EnvironmentType environmentType = EnvironmentType.GCP_PROJECT; + + /* + * The Gcp project's organizational data + */ + private GcpOrganizationalData organizationalData; + + /* + * The Gcp project's details + */ + private GcpProjectDetails projectDetails; + + /* + * Scan interval in hours (value should be between 1-hour to 24-hours) + */ + private Long scanInterval; + + /** + * Creates an instance of GcpProjectEnvironmentData class. + */ + public GcpProjectEnvironmentData() { + } + + /** + * Get the environmentType property: The type of the environment data. + * + * @return the environmentType value. + */ + @Override + public EnvironmentType environmentType() { + return this.environmentType; + } + + /** + * Get the organizationalData property: The Gcp project's organizational data. + * + * @return the organizationalData value. + */ + public GcpOrganizationalData organizationalData() { + return this.organizationalData; + } + + /** + * Set the organizationalData property: The Gcp project's organizational data. + * + * @param organizationalData the organizationalData value to set. + * @return the GcpProjectEnvironmentData object itself. + */ + public GcpProjectEnvironmentData withOrganizationalData(GcpOrganizationalData organizationalData) { + this.organizationalData = organizationalData; + return this; + } + + /** + * Get the projectDetails property: The Gcp project's details. + * + * @return the projectDetails value. + */ + public GcpProjectDetails projectDetails() { + return this.projectDetails; + } + + /** + * Set the projectDetails property: The Gcp project's details. + * + * @param projectDetails the projectDetails value to set. + * @return the GcpProjectEnvironmentData object itself. + */ + public GcpProjectEnvironmentData withProjectDetails(GcpProjectDetails projectDetails) { + this.projectDetails = projectDetails; + 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 GcpProjectEnvironmentData object itself. + */ + public GcpProjectEnvironmentData 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 (organizationalData() != null) { + organizationalData().validate(); + } + if (projectDetails() != null) { + 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/GetSensitivitySettingsListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsListResponse.java new file mode 100644 index 000000000000..d11feedc6af2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsListResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsListResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of GetSensitivitySettingsListResponse. + */ +public interface GetSensitivitySettingsListResponse { + /** + * Gets the value property: The value property. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsListResponseInner object. + * + * @return the inner object. + */ + GetSensitivitySettingsListResponseInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponse.java new file mode 100644 index 000000000000..24ad7f4a9720 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponse.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner; + +/** + * An immutable client-side representation of GetSensitivitySettingsResponse. + */ +public interface GetSensitivitySettingsResponse { + /** + * 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 properties property: The sensitivity settings properties. + * + * @return the properties value. + */ + GetSensitivitySettingsResponseProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.GetSensitivitySettingsResponseInner object. + * + * @return the inner object. + */ + GetSensitivitySettingsResponseInner innerModel(); +} 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 new file mode 100644 index 000000000000..8cfbe9d234dd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponseProperties.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * The sensitivity settings properties. + */ +@Immutable +public final class GetSensitivitySettingsResponseProperties + implements JsonSerializable { + /* + * List of selected sensitive info types' IDs. + */ + 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 + */ + private Float sensitivityThresholdLabelOrder; + + /* + * The id of the sensitivity threshold label. Any label at or above this rank will be considered sensitive. + */ + private String sensitivityThresholdLabelId; + + /* + * Microsoft information protection built-in and custom information types, labels, and integration status. + */ + private GetSensitivitySettingsResponsePropertiesMipInformation mipInformation; + + /** + * Creates an instance of GetSensitivitySettingsResponseProperties class. + */ + private GetSensitivitySettingsResponseProperties() { + } + + /** + * Get the sensitiveInfoTypesIds property: List of selected sensitive info types' IDs. + * + * @return the sensitiveInfoTypesIds value. + */ + public List sensitiveInfoTypesIds() { + return this.sensitiveInfoTypesIds; + } + + /** + * Get the sensitivityThresholdLabelOrder property: 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. + * + * @return the sensitivityThresholdLabelOrder value. + */ + public Float sensitivityThresholdLabelOrder() { + return this.sensitivityThresholdLabelOrder; + } + + /** + * Get the sensitivityThresholdLabelId property: The id of the sensitivity threshold label. Any label at or above + * this rank will be considered sensitive. + * + * @return the sensitivityThresholdLabelId value. + */ + public String sensitivityThresholdLabelId() { + return this.sensitivityThresholdLabelId; + } + + /** + * Get the mipInformation property: Microsoft information protection built-in and custom information types, labels, + * and integration status. + * + * @return the mipInformation value. + */ + public GetSensitivitySettingsResponsePropertiesMipInformation mipInformation() { + return this.mipInformation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mipInformation() != null) { + mipInformation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("sensitiveInfoTypesIds", this.sensitiveInfoTypesIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("sensitivityThresholdLabelOrder", this.sensitivityThresholdLabelOrder); + jsonWriter.writeStringField("sensitivityThresholdLabelId", this.sensitivityThresholdLabelId); + 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.getString()); + deserializedGetSensitivitySettingsResponseProperties.sensitiveInfoTypesIds = sensitiveInfoTypesIds; + } else if ("sensitivityThresholdLabelOrder".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.sensitivityThresholdLabelOrder + = reader.getNullable(JsonReader::getFloat); + } else if ("sensitivityThresholdLabelId".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.sensitivityThresholdLabelId + = reader.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 new file mode 100644 index 000000000000..2c6d69e1d4af --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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; +import java.util.List; + +/** + * Microsoft information protection built-in and custom information types, labels, and integration status. + */ +@Immutable +public final class GetSensitivitySettingsResponsePropertiesMipInformation + implements JsonSerializable { + /* + * Microsoft information protection integration status + */ + private MipIntegrationStatus mipIntegrationStatus; + + /* + * List of Microsoft information protection sensitivity labels + */ + private List