diff --git a/sdk/security/azure-resourcemanager-security/CHANGELOG.md b/sdk/security/azure-resourcemanager-security/CHANGELOG.md index 356ec381b7c0..6c80d7dd722b 100644 --- a/sdk/security/azure-resourcemanager-security/CHANGELOG.md +++ b/sdk/security/azure-resourcemanager-security/CHANGELOG.md @@ -1,14 +1,911 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2025-05-12) + +- 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). ### Features Added -### Breaking Changes +* `models.AdditionalData` was added + +* `models.GovernanceAssignment$Definition` was added -### Bugs Fixed +* `models.AgentlessEnablement` was added -### Other Changes +* `models.AutomationList` 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.SecurityConnector$Update` was added + +* `models.SensitivityLabel` was added + +* `models.ConnectorSetting` was added + +* `models.Automation` was added + +* `models.CustomAssessmentAutomationsListResult` was added + +* `models.RegulatoryComplianceControl` was added + +* `models.SecurityConnectorsList` was added + +* `models.AutomationTriggeringRule` was added + +* `models.RuleResultsProperties` was added + +* `models.ExecuteGovernanceRuleParams` was added + +* `models.CustomAssessmentAutomation$Definition` was added + +* `models.DevOpsProvisioningState` was added + +* `models.ArcAutoProvisioning` was added + +* `models.AzureDevOpsRepository$UpdateStages` was added + +* `models.AuthenticationDetailsProperties` was added + +* `models.SecurityConnectors` was added + +* `models.Baseline` was added + +* `models.RulesResults` was added + +* `models.CustomEntityStoreAssignmentRequest` was added + +* `models.AzureDevOpsProject$UpdateStages` was added + +* `models.DefenderForStorageSetting$Definition` was added + +* `models.AutoProvisioningSettingList` 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.ResourceIdentityType` was added + +* `models.ActionableRemediationState` was added + +* `models.AwsOrganizationalDataMaster` was added + +* `models.GcpOrganizationalDataMember` was added + +* `models.GitHubRepositoryProperties` was added + +* `models.PermissionProperty` was added + +* `models.HybridComputeSettingsProperties` was added + +* `models.AuthenticationProvisioningState` was added + +* `models.WorkspaceSetting$UpdateStages` was added + +* `models.DefenderForServersAwsOfferingSubPlan` was added + +* `models.GovernanceRulesOperationResultsHeaders` was added + +* `models.SubAssessments` was added + +* `models.ScanSummary` was added + +* `models.ConnectorSetting$DefinitionStages` was added + +* `models.Scan` was added + +* `models.SecurityTaskList` was added + +* `models.SupportedCloudEnum` was added + +* `models.SensitivitySettings` was added + +* `models.DefenderFoDatabasesAwsOfferingDatabasesDspm` was added + +* `models.GovernanceAssignments` was added + +* `models.DockerHubEnvironmentData` was added + +* `models.CspmMonitorDockerHubOffering` was added + +* `models.InformationProtectionPolicy$UpdateStages` was added + +* `models.Automations` was added + +* `models.GovernanceRuleSourceResourceType` was added + +* `models.OperationResultAutoGenerated` 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.CustomAssessmentAutomationRequest` was added + +* `models.GitlabScopeEnvironmentData` was added + +* `models.DefenderCspmGcpOfferingMdcContainersImageAssessment` was added + +* `models.SubAssessmentStatus` was added + +* `models.ArcAutoProvisioningAws` was added + +* `models.AwsOrganizationalDataMember` was added + +* `models.SecurityContactList` 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.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.CustomAssessmentAutomations` was added + +* `models.GovernanceRule$Update` was added + +* `models.ConnectorSetting$UpdateStages` was added + +* `models.OperationResult` was added + +* `models.GovernanceAssignment$Update` was added + +* `models.Type` was added + +* `models.SecurityConnectorApplications` was added + +* `models.GitLabProjects` 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.MdeOnboardingData` was added + +* `models.DefenderForStorageSetting$DefinitionStages` was added + +* `models.VaRule` was added + +* `models.AlertsSuppressionRulesList` was added + +* `models.MalwareScanProperties` was added + +* `models.DefenderCspmGcpOfferingVmScanners` was added + +* `models.Application$UpdateStages` was added + +* `models.SecuritySubAssessmentList` was added + +* `models.GovernanceRuleType` was added + +* `models.AutomationActionWorkspace` was added + +* `models.StatusName` was added + +* `models.OnUploadProperties` was added + +* `models.CspmMonitorJFrogOffering` was added + +* `models.InformationType` was added + +* `models.InventoryKind` was added + +* `models.AzureDevOpsRepository$DefinitionStages` was added + +* `models.AutoProvision` was added + +* `models.ConnectorSetting$Update` was added + +* `models.ScenarioResponse` was added + +* `models.PropertyType` was added + +* `models.Authentication` 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.ActionableRemediation` was added + +* `models.WorkspaceSetting$DefinitionStages` 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.ProxyServerProperties` was added + +* `models.AzureDevOpsRepository$Update` was added + +* `models.CspmMonitorAwsOfferingNativeCloudConnection` was added + +* `models.OperationListResult` was added + +* `models.AzureDevOpsRepos` was added + +* `models.GitLabGroup` was added + +* `models.GovernanceRule$UpdateStages` was added + +* `models.ContainerRegistryVulnerabilityProperties` was added + +* `models.AwAssumeRoleAuthenticationDetailsProperties` was added + +* `models.AzureDevOpsRepositoryListResponse` was added + +* `models.Tags` was added + +* `models.Locations` was added + +* `models.Scans` was added + +* `models.AutomationSource` was added + +* `models.Rank` was added + +* `models.EnvironmentType` was added + +* `models.GovernanceAssignment` was added + +* `models.AutomationAction` was added + +* `models.GitHubRepository` was added + +* `models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning` was added + +* `models.RuleResults$Update` was added + +* `models.SecurityOperatorList` 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.OfferingType` was added + +* `models.AutomationActionEventHub` was added + +* `models.SecurityContactName` 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.SourceType` was added + +* `models.DevOpsOperationResults` was added + +* `models.AzureTrackedResourceLocation` 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.DevOpsConfigurationListResponse` was added + +* `models.AuthenticationType` was added + +* `models.AlertsSuppressionRules` was added + +* `models.Automation$UpdateStages` was added + +* `models.AwsOrganizationalData` was added + +* `models.AwsEnvironmentData` was added + +* `models.MalwareScanningProperties` was added + +* `models.GovernanceAssignmentsList` was added + +* `models.GetSensitivitySettingsResponseProperties` was added + +* `models.GitLabProjectListResponse` was added + +* `models.ServicePrincipalProperties` was added + +* `models.GitLabGroupProperties` was added + +* `models.ComplianceList` was added + +* `models.ResourceDetailsAutoGenerated` 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.ResourceProviders` was added + +* `models.RegulatoryComplianceAssessment` was added + +* `models.GcpOrganizationalData` was added + +* `models.ConnectorSettingList` was added + +* `models.MinimalSeverity` was added + +* `models.SqlVulnerabilityAssessmentBaselineRules` was added + +* `models.CustomAssessmentAutomation$DefinitionStages` was added + +* `models.AzureDevOpsProject$Definition` was added + +* `models.ParametersSchema` 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.CloudOffering` was added + +* `models.CustomEntityStoreAssignment$DefinitionStages` was added + +* `models.DefenderCspmAwsOfferingVmScanners` was added + +* `models.VmScannersBase` was added + +* `models.InformationProtectionPolicies` was added + +* `models.SubPlan` was added + +* `models.ComplianceSegment` was added + +* `models.DefenderCspmAwsOfferingCiemOidc` was added + +* `models.SensitiveDataDiscoveryProperties` was added + +* `models.UpdateSensitivitySettingsRequest` was added + +* `models.InformationProtectionPolicyList` was added + +* `models.ConnectorSetting$Definition` 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.RegulatoryComplianceControlList` was added + +* `models.Tasks` was added + +* `models.Application$Update` was added + +* `models.CspmMonitorGcpOfferingNativeCloudConnection` was added + +* `models.DefenderForContainersAwsOfferingCloudWatchToKinesis` was added + +* `models.GithubScopeEnvironmentData` was added + +* `models.DefenderForServersAwsOfferingVmScanners` was added + +* `models.AzureDevOpsOrg` was added + +* `models.DefenderCspmGcpOfferingDataSensitivityDiscovery` was added + +* `models.WorkspaceSettingList` was added + +* `models.WorkspaceSettings` was added + +* `models.RulesResultsInput` was added + +* `models.AzureDevOpsRepositoryProperties` was added + +* `models.Authorization` was added + +* `models.DefenderFoDatabasesAwsOffering` was added + +* `models.AzureDevOpsProjectListResponse` was added + +* `models.AutomationActionLogicApp` was added + +* `models.ScanResults` was added + +* `models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration` was added + +* `models.GitHubRepositoryListResponse` 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.CategoryConfiguration` was added + +* `models.CustomEntityStoreAssignment$Definition` was added + +* `models.DefenderCspmAwsOfferingCiemDiscovery` was added + +* `models.Identity` was added + +* `models.SettingNameAutoGenerated` was added + +* `models.CspmMonitorAwsOffering` was added + +* `models.GovernanceRuleMetadata` was added + +* `models.TrackedResource` 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.Software` was added + +* `models.DefenderForDatabasesGcpOffering` was added + +* `models.RuleCategory` was added + +* `models.RegulatoryComplianceStandard` was added + +* `models.Remediation` was added + +* `models.BuiltInInfoType` was added + +* `models.GovernanceRuleList` was added + +* `models.GovernanceAssignment$DefinitionStages` was added + +* `models.StatusAutoGenerated` was added + +* `models.Automation$Update` was added + +* `models.GitLabProjectProperties` was added + +* `models.HealthReportsList` was added + +* `models.CustomEntityStoreAssignments` was added + +* `models.Application$DefinitionStages` was added + +* `models.DefenderForContainersAwsOfferingKubernetesDataCollection` was added + +* `models.DefenderForStorageSetting` was added + +* `models.SecurityTaskParameters` was added + +* `models.ApplicationsList` was added + +* `models.OrganizationMembershipType` was added + +* `models.SecurityContact$Definition` was added + +* `models.RuleType` was added + +* `models.GitLabGroups` was added + +* `models.OperationStatusAutoGenerated` was added + +* `models.DefenderCspmGcpOfferingCiemDiscovery` was added + +* `models.GovernanceRule$DefinitionStages` was added + +* `models.CustomEntityStoreAssignmentsListResult` was added + +* `models.ScanProperties` was added + +* `models.DefenderForContainersAwsOffering` was added + +* `models.Application` was added + +* `models.SqlVulnerabilityAssessmentScanResults` was added + +* `models.CustomAssessmentAutomation` was added + +* `models.AscLocationList` was added + +* `models.GovernanceRuleOwnerSourceType` was added + +* `models.DefenderForServersGcpOfferingDefenderForServers` was added + +* `models.RemediationEta` was added + +* `models.ApplicationOperations` 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.SoftwareInventories` 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.EndOfSupportStatus` was added + +* `models.GitHubOwnerListResponse` was added + +* `models.Connectors` 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.SecurityConnectorApplicationOperations` was added + +* `models.AzureDevOpsOrg$Update` was added + +* `models.RegulatoryComplianceStandardList` was added + +* `models.SecurityTask` was added + +* `models.ApplicationSourceResourceType` was added + +* `models.AutoProvisioningSetting` was added + +* `models.GetSensitivitySettingsResponsePropertiesMipInformation` was added + +* `models.TargetBranchConfiguration` was added + +* `models.DefenderForContainersGcpOffering` was added + +* `models.Operator` was added + +* `models.AwsCredsAuthenticationDetailsProperties` was added + +* `models.AzureDevOpsProjectProperties` was added + +* `models.DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S` was added + +* `models.DefenderCspmAwsOffering` was added + +* `models.InformationProtectionPolicy$Definition` was added + +* `models.GcpCredentialsDetailsProperties` 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.RegulatoryComplianceAssessmentList` was added + +* `models.SqlVulnerabilityAssessmentScans` was added + +* `models.ServerVulnerabilityProperties` was added + +* `models.HybridComputeProvisioningState` was added + +* `models.GovernanceEmailNotification` was added + +* `models.DevOpsConfiguration` was added + +* `models.CspmMonitorGitLabOffering` was added + +* `models.GovernanceRuleEmailNotification` was added + +* `models.DefenderForContainersDockerHubOffering` was added + +* `models.CustomEntityStoreAssignment` was added + +* `models.DefenderCspmGcpOffering` 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.Etag` was added + +* `models.SoftwaresList` was added + +* `models.DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S` was added + +* `models.NotificationsSource` was added + +* `models.EnvironmentDetails` was added + +* `models.DefenderCspmJFrogOffering` was added + +* `models.State` was added + +* `models.AscLocation` was added + +#### `SecurityManager` was modified + +* `alertsSuppressionRules()` was added +* `resourceProviders()` was added +* `gitLabSubgroups()` was added +* `gitLabGroups()` was added +* `regulatoryComplianceControls()` was added +* `sensitivitySettings()` was added +* `regulatoryComplianceStandards()` was added +* `applications()` was added +* `securityContacts()` was added +* `operations()` was added +* `applicationOperations()` was added +* `automations()` was added +* `gitHubOwners()` was added +* `gitHubRepos()` was added +* `governanceRules()` was added +* `sqlVulnerabilityAssessmentScanResults()` was added +* `sqlVulnerabilityAssessmentScans()` was added +* `tasks()` was added +* `customEntityStoreAssignments()` was added +* `securityOperators()` was added +* `workspaceSettings()` was added +* `azureDevOpsRepos()` was added +* `informationProtectionPolicies()` was added +* `securityConnectorApplicationOperations()` was added +* `devOpsOperationResults()` was added +* `softwareInventories()` was added +* `autoProvisioningSettings()` was added +* `healthReports()` was added +* `securityConnectors()` was added +* `subAssessments()` was added +* `azureDevOpsOrgs()` was added +* `compliances()` was added +* `gitLabProjects()` was added +* `governanceAssignments()` was added +* `regulatoryComplianceAssessments()` was added +* `connectors()` was added +* `sqlVulnerabilityAssessmentBaselineRules()` was added +* `customAssessmentAutomations()` was added +* `devOpsConfigurations()` was added +* `mdeOnboardings()` was added +* `securityConnectorApplications()` was added +* `defenderForStorages()` was added +* `locations()` was added +* `azureDevOpsProjects()` 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..99a557bacb18 100644 --- a/sdk/security/azure-resourcemanager-security/README.md +++ b/sdk/security/azure-resourcemanager-security/README.md @@ -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..2156cfe3f985 100644 --- a/sdk/security/azure-resourcemanager-security/SAMPLE.md +++ b/sdk/security/azure-resourcemanager-security/SAMPLE.md @@ -24,6 +24,13 @@ - [UpdateSubscriptionLevelStateToInProgress](#alerts_updatesubscriptionlevelstatetoinprogress) - [UpdateSubscriptionLevelStateToResolve](#alerts_updatesubscriptionlevelstatetoresolve) +## AlertsSuppressionRules + +- [Delete](#alertssuppressionrules_delete) +- [Get](#alertssuppressionrules_get) +- [List](#alertssuppressionrules_list) +- [Update](#alertssuppressionrules_update) + ## AllowedConnections - [Get](#allowedconnections_get) @@ -39,6 +46,16 @@ - [OffboardAzureApiManagementApi](#apicollections_offboardazureapimanagementapi) - [OnboardAzureApiManagementApi](#apicollections_onboardazureapimanagementapi) +## ApplicationOperation + +- [CreateOrUpdate](#applicationoperation_createorupdate) +- [Delete](#applicationoperation_delete) +- [Get](#applicationoperation_get) + +## Applications + +- [List](#applications_list) + ## Assessments - [CreateOrUpdate](#assessments_createorupdate) @@ -55,11 +72,77 @@ - [List](#assessmentsmetadata_list) - [ListBySubscription](#assessmentsmetadata_listbysubscription) +## AutoProvisioningSettings + +- [Create](#autoprovisioningsettings_create) +- [Get](#autoprovisioningsettings_get) +- [List](#autoprovisioningsettings_list) + +## Automations + +- [CreateOrUpdate](#automations_createorupdate) +- [Delete](#automations_delete) +- [GetByResourceGroup](#automations_getbyresourcegroup) +- [List](#automations_list) +- [ListByResourceGroup](#automations_listbyresourcegroup) +- [Update](#automations_update) +- [Validate](#automations_validate) + +## AzureDevOpsOrgs + +- [CreateOrUpdate](#azuredevopsorgs_createorupdate) +- [Get](#azuredevopsorgs_get) +- [List](#azuredevopsorgs_list) +- [ListAvailable](#azuredevopsorgs_listavailable) +- [Update](#azuredevopsorgs_update) + +## AzureDevOpsProjects + +- [CreateOrUpdate](#azuredevopsprojects_createorupdate) +- [Get](#azuredevopsprojects_get) +- [List](#azuredevopsprojects_list) +- [Update](#azuredevopsprojects_update) + +## AzureDevOpsRepos + +- [CreateOrUpdate](#azuredevopsrepos_createorupdate) +- [Get](#azuredevopsrepos_get) +- [List](#azuredevopsrepos_list) +- [Update](#azuredevopsrepos_update) + ## ComplianceResults - [Get](#complianceresults_get) - [List](#complianceresults_list) +## Compliances + +- [Get](#compliances_get) +- [List](#compliances_list) + +## Connectors + +- [CreateOrUpdate](#connectors_createorupdate) +- [Delete](#connectors_delete) +- [Get](#connectors_get) +- [List](#connectors_list) + +## CustomAssessmentAutomations + +- [Create](#customassessmentautomations_create) +- [Delete](#customassessmentautomations_delete) +- [GetByResourceGroup](#customassessmentautomations_getbyresourcegroup) +- [List](#customassessmentautomations_list) +- [ListByResourceGroup](#customassessmentautomations_listbyresourcegroup) + +## CustomEntityStoreAssignments + +- [Create](#customentitystoreassignments_create) +- [Delete](#customentitystoreassignments_delete) +- [GetByResourceGroup](#customentitystoreassignments_getbyresourcegroup) +- [List](#customentitystoreassignments_list) +- [ListByResourceGroup](#customentitystoreassignments_listbyresourcegroup) + ## CustomRecommendations - [CreateOrUpdate](#customrecommendations_createorupdate) @@ -67,6 +150,26 @@ - [Get](#customrecommendations_get) - [List](#customrecommendations_list) +## DefenderForStorage + +- [CancelMalwareScan](#defenderforstorage_cancelmalwarescan) +- [Create](#defenderforstorage_create) +- [Get](#defenderforstorage_get) +- [GetMalwareScan](#defenderforstorage_getmalwarescan) +- [StartMalwareScan](#defenderforstorage_startmalwarescan) + +## DevOpsConfigurations + +- [CreateOrUpdate](#devopsconfigurations_createorupdate) +- [Delete](#devopsconfigurations_delete) +- [Get](#devopsconfigurations_get) +- [List](#devopsconfigurations_list) +- [Update](#devopsconfigurations_update) + +## DevOpsOperationResults + +- [Get](#devopsoperationresults_get) + ## DeviceSecurityGroups - [CreateOrUpdate](#devicesecuritygroups_createorupdate) @@ -86,6 +189,59 @@ - [List](#externalsecuritysolutions_list) - [ListByHomeRegion](#externalsecuritysolutions_listbyhomeregion) +## GitHubOwners + +- [Get](#githubowners_get) +- [List](#githubowners_list) +- [ListAvailable](#githubowners_listavailable) + +## GitHubRepos + +- [Get](#githubrepos_get) +- [List](#githubrepos_list) + +## GitLabGroups + +- [Get](#gitlabgroups_get) +- [List](#gitlabgroups_list) +- [ListAvailable](#gitlabgroups_listavailable) + +## GitLabProjects + +- [Get](#gitlabprojects_get) +- [List](#gitlabprojects_list) + +## GitLabSubgroups + +- [List](#gitlabsubgroups_list) + +## GovernanceAssignments + +- [CreateOrUpdate](#governanceassignments_createorupdate) +- [Delete](#governanceassignments_delete) +- [Get](#governanceassignments_get) +- [List](#governanceassignments_list) + +## GovernanceRules + +- [CreateOrUpdate](#governancerules_createorupdate) +- [Delete](#governancerules_delete) +- [Execute](#governancerules_execute) +- [Get](#governancerules_get) +- [List](#governancerules_list) +- [OperationResults](#governancerules_operationresults) + +## HealthReports + +- [Get](#healthreports_get) +- [List](#healthreports_list) + +## InformationProtectionPolicies + +- [CreateOrUpdate](#informationprotectionpolicies_createorupdate) +- [Get](#informationprotectionpolicies_get) +- [List](#informationprotectionpolicies_list) + ## IotSecuritySolution - [CreateOrUpdate](#iotsecuritysolution_createorupdate) @@ -122,6 +278,20 @@ - [ListByResourceGroup](#jitnetworkaccesspolicies_listbyresourcegroup) - [ListByResourceGroupAndRegion](#jitnetworkaccesspolicies_listbyresourcegroupandregion) +## Locations + +- [Get](#locations_get) +- [List](#locations_list) + +## MdeOnboardings + +- [Get](#mdeonboardings_get) +- [List](#mdeonboardings_list) + +## Operations + +- [List](#operations_list) + ## Pricings - [Delete](#pricings_delete) @@ -129,6 +299,25 @@ - [List](#pricings_list) - [Update](#pricings_update) +## RegulatoryComplianceAssessments + +- [Get](#regulatorycomplianceassessments_get) +- [List](#regulatorycomplianceassessments_list) + +## RegulatoryComplianceControls + +- [Get](#regulatorycompliancecontrols_get) +- [List](#regulatorycompliancecontrols_list) + +## RegulatoryComplianceStandards + +- [Get](#regulatorycompliancestandards_get) +- [List](#regulatorycompliancestandards_list) + +## ResourceProvider + +- [View](#resourceprovider_view) + ## SecureScoreControlDefinitions - [List](#securescorecontroldefinitions_list) @@ -144,6 +333,39 @@ - [Get](#securescores_get) - [List](#securescores_list) +## SecurityConnectorApplicationOperation + +- [CreateOrUpdate](#securityconnectorapplicationoperation_createorupdate) +- [Delete](#securityconnectorapplicationoperation_delete) +- [Get](#securityconnectorapplicationoperation_get) + +## SecurityConnectorApplications + +- [List](#securityconnectorapplications_list) + +## SecurityConnectors + +- [CreateOrUpdate](#securityconnectors_createorupdate) +- [Delete](#securityconnectors_delete) +- [GetByResourceGroup](#securityconnectors_getbyresourcegroup) +- [List](#securityconnectors_list) +- [ListByResourceGroup](#securityconnectors_listbyresourcegroup) +- [Update](#securityconnectors_update) + +## SecurityContacts + +- [Create](#securitycontacts_create) +- [Delete](#securitycontacts_delete) +- [Get](#securitycontacts_get) +- [List](#securitycontacts_list) + +## SecurityOperators + +- [CreateOrUpdate](#securityoperators_createorupdate) +- [Delete](#securityoperators_delete) +- [Get](#securityoperators_get) +- [List](#securityoperators_list) + ## SecuritySolutions - [Get](#securitysolutions_get) @@ -161,6 +383,12 @@ - [Get](#securitystandards_get) - [List](#securitystandards_list) +## SensitivitySettings + +- [CreateOrUpdate](#sensitivitysettings_createorupdate) +- [Get](#sensitivitysettings_get) +- [List](#sensitivitysettings_list) + ## ServerVulnerabilityAssessment - [CreateOrUpdate](#servervulnerabilityassessment_createorupdate) @@ -181,6 +409,30 @@ - [List](#settings_list) - [Update](#settings_update) +## SoftwareInventories + +- [Get](#softwareinventories_get) +- [List](#softwareinventories_list) +- [ListByExtendedResource](#softwareinventories_listbyextendedresource) + +## SqlVulnerabilityAssessmentBaselineRules + +- [Add](#sqlvulnerabilityassessmentbaselinerules_add) +- [CreateOrUpdate](#sqlvulnerabilityassessmentbaselinerules_createorupdate) +- [Delete](#sqlvulnerabilityassessmentbaselinerules_delete) +- [Get](#sqlvulnerabilityassessmentbaselinerules_get) +- [List](#sqlvulnerabilityassessmentbaselinerules_list) + +## SqlVulnerabilityAssessmentScanResults + +- [Get](#sqlvulnerabilityassessmentscanresults_get) +- [List](#sqlvulnerabilityassessmentscanresults_list) + +## SqlVulnerabilityAssessmentScans + +- [Get](#sqlvulnerabilityassessmentscans_get) +- [List](#sqlvulnerabilityassessmentscans_list) + ## StandardAssignments - [Create](#standardassignments_create) @@ -188,36 +440,56 @@ - [Get](#standardassignments_get) - [List](#standardassignments_list) +## SubAssessments + +- [Get](#subassessments_get) +- [List](#subassessments_list) +- [ListAll](#subassessments_listall) + +## Tasks + +- [GetResourceGroupLevelTask](#tasks_getresourcegroupleveltask) +- [GetSubscriptionLevelTask](#tasks_getsubscriptionleveltask) +- [List](#tasks_list) +- [ListByHomeRegion](#tasks_listbyhomeregion) +- [ListByResourceGroup](#tasks_listbyresourcegroup) +- [UpdateResourceGroupLevelTaskState](#tasks_updateresourcegroupleveltaskstate) +- [UpdateSubscriptionLevelTaskState](#tasks_updatesubscriptionleveltaskstate) + ## Topology - [Get](#topology_get) - [List](#topology_list) - [ListByHomeRegion](#topology_listbyhomeregion) + +## WorkspaceSettings + +- [Create](#workspacesettings_create) +- [Delete](#workspacesettings_delete) +- [Get](#workspacesettings_get) +- [List](#workspacesettings_list) +- [Update](#workspacesettings_update) ### AdvancedThreatProtection_Create ```java /** - * Samples for AdvancedThreatProtection Create. + * Samples for Alerts UpdateResourceGroupLevelStateToInProgress. */ -public final class AdvancedThreatProtectionCreateSamples { +public final class AlertsUpdateResourceGroupLevelStateToInProgressSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/ - * PutAdvancedThreatProtectionSettings_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertResourceGroupLocation_inProgress_example.json */ /** - * Sample code: Creates or updates the Advanced Threat Protection settings on a specified resource. + * Sample code: Update security alert state on a resource group from a security data location. * * @param manager Entry point to SecurityManager. */ - public static void createsOrUpdatesTheAdvancedThreatProtectionSettingsOnASpecifiedResource( + public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( 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(); + manager.alerts() + .updateResourceGroupLevelStateToInProgressWithResponse("myRg2", "westeurope", + "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", com.azure.core.util.Context.NONE); } } ``` @@ -226,25 +498,22 @@ public final class AdvancedThreatProtectionCreateSamples { ```java /** - * Samples for AdvancedThreatProtection Get. + * Samples for Connectors List. */ -public final class AdvancedThreatProtectionGetSamples { +public final class ConnectorsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/ - * GetAdvancedThreatProtectionSettings_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * GetListConnectorSubscription_example.json */ /** - * Sample code: Gets the Advanced Threat Protection settings for the specified resource. + * Sample code: Get all cloud accounts connectors of a subscription. * * @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); + public static void + getAllCloudAccountsConnectorsOfASubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.connectors().list(com.azure.core.util.Context.NONE); } } ``` @@ -253,23 +522,22 @@ public final class AdvancedThreatProtectionGetSamples { ```java /** - * Samples for Alerts GetResourceGroupLevel. + * Samples for SecurityConnectors List. */ -public final class AlertsGetResourceGroupLevelSamples { +public final class SecurityConnectorsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * GetAlertResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /GetSecurityConnectorsSubscription_example.json */ /** - * Sample code: Get security alert on a resource group from a security data location. + * Sample code: List all security connectors of a specified subscription. * * @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); + public static void + listAllSecurityConnectorsOfASpecifiedSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectors().list(com.azure.core.util.Context.NONE); } } ``` @@ -278,23 +546,23 @@ public final class AlertsGetResourceGroupLevelSamples { ```java /** - * Samples for Alerts GetSubscriptionLevel. + * Samples for Alerts UpdateSubscriptionLevelStateToInProgress. */ -public final class AlertsGetSubscriptionLevelSamples { +public final class AlertsUpdateSubscriptionLevelStateToInProgressSamples { /* * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * GetAlertSubscriptionLocation_example.json + * UpdateAlertSubscriptionLocation_inProgress_example.json */ /** - * Sample code: Get security alert on a subscription from a security data location. + * Sample code: Update security alert state on a subscription from a security data location. * * @param manager Entry point to SecurityManager. */ - public static void getSecurityAlertOnASubscriptionFromASecurityDataLocation( + public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( com.azure.resourcemanager.security.SecurityManager manager) { manager.alerts() - .getSubscriptionLevelWithResponse("westeurope", "2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA", - com.azure.core.util.Context.NONE); + .updateSubscriptionLevelStateToInProgressWithResponse("westeurope", + "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); } } ``` @@ -303,20 +571,23 @@ public final class AlertsGetSubscriptionLevelSamples { ```java /** - * Samples for Alerts List. + * Samples for Alerts UpdateResourceGroupLevelStateToResolve. */ -public final class AlertsListSamples { +public final class AlertsUpdateResourceGroupLevelStateToResolveSamples { /* * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * GetAlertsSubscription_example.json + * UpdateAlertResourceGroupLocation_resolve_example.json */ /** - * Sample code: Get security alerts on a subscription. + * Sample code: Update security alert state on a resource group from a security data location. * * @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); + 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); } } ``` @@ -324,21 +595,86 @@ public final class AlertsListSamples { ### Alerts_ListByResourceGroup ```java +import com.azure.resourcemanager.security.models.PartialAssessmentProperties; +import com.azure.resourcemanager.security.models.StandardSupportedCloud; +import java.util.Arrays; + /** - * Samples for Alerts ListByResourceGroup. + * Samples for SecurityStandards CreateOrUpdate. */ -public final class AlertsListByResourceGroupSamples { +public final class SecurityStandardsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * GetAlertsResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * PutBySubscriptionSecurityStandard_example.json */ /** - * Sample code: Get security alerts on a resource group. + * Sample code: Create or update security standard over subscription scope. * * @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); + 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(); } } ``` @@ -347,21 +683,23 @@ public final class AlertsListByResourceGroupSamples { ```java /** - * Samples for Alerts ListResourceGroupLevelByRegion. + * Samples for SecurityConnectors GetByResourceGroup. */ -public final class AlertsListResourceGroupLevelByRegionSamples { +public final class SecurityConnectorsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * GetAlertsResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /GetSecurityConnectorSingleResource_example.json */ /** - * Sample code: Get security alerts on a resource group from a security data location. + * Sample code: Retrieve a security connector. * * @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); + public static void retrieveASecurityConnector(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectors() + .getByResourceGroupWithResponse("exampleResourceGroup", "exampleSecurityConnectorName", + com.azure.core.util.Context.NONE); } } ``` @@ -369,22 +707,34 @@ public final class AlertsListResourceGroupLevelByRegionSamples { ### Alerts_ListSubscriptionLevelByRegion ```java +import com.azure.resourcemanager.security.models.ActionableRemediation; +import com.azure.resourcemanager.security.models.ActionableRemediationState; +import com.azure.resourcemanager.security.models.AzureDevOpsOrg; +import com.azure.resourcemanager.security.models.AzureDevOpsOrgProperties; +import com.azure.resourcemanager.security.models.OnboardingState; + /** - * Samples for Alerts ListSubscriptionLevelByRegion. + * Samples for AzureDevOpsOrgs Update. */ -public final class AlertsListSubscriptionLevelByRegionSamples { +public final class AzureDevOpsOrgsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * GetAlertsSubscriptionsLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * UpdateAzureDevOpsOrgs_example.json */ /** - * Sample code: Get security alerts on a subscription from a security data location. + * Sample code: Update_AzureDevOpsOrgs. * * @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); + public static void updateAzureDevOpsOrgs(com.azure.resourcemanager.security.SecurityManager manager) { + AzureDevOpsOrg resource = manager.azureDevOpsOrgs() + .getWithResponse("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new AzureDevOpsOrgProperties().withOnboardingState(OnboardingState.NOT_APPLICABLE) + .withActionableRemediation(new ActionableRemediation().withState(ActionableRemediationState.ENABLED))) + .apply(); } } ``` @@ -392,33 +742,23 @@ public final class AlertsListSubscriptionLevelByRegionSamples { ### 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. + * Samples for SecurityConnectors Delete. */ -public final class AlertsSimulateSamples { +public final class SecurityConnectorsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * SimulateAlerts_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /DeleteSecurityConnector_example.json */ /** - * Sample code: Simulate security alerts on a subscription. + * Sample code: Delete a security connector. * * @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); + public static void deleteASecurityConnector(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectors() + .deleteByResourceGroupWithResponse("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); } } ``` @@ -427,23 +767,22 @@ public final class AlertsSimulateSamples { ```java /** - * Samples for Alerts UpdateResourceGroupLevelStateToActivate. + * Samples for Automations List. */ -public final class AlertsUpdateResourceGroupLevelStateToActivateSamples { +public final class AutomationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertResourceGroupLocation_activate_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * GetAutomationsSubscription_example.json */ /** - * Sample code: Update security alert state on a resource group from a security data location. + * Sample code: List all security automations of a specified subscription. * * @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); + public static void + listAllSecurityAutomationsOfASpecifiedSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations().list(com.azure.core.util.Context.NONE); } } ``` @@ -452,23 +791,22 @@ public final class AlertsUpdateResourceGroupLevelStateToActivateSamples { ```java /** - * Samples for Alerts UpdateResourceGroupLevelStateToDismiss. + * Samples for SecurityConnectors ListByResourceGroup. */ -public final class AlertsUpdateResourceGroupLevelStateToDismissSamples { +public final class SecurityConnectorsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertResourceGroupLocation_dismiss_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /GetSecurityConnectorsResourceGroup_example.json */ /** - * Sample code: Update security alert state on a resource group from a security data location. + * Sample code: List all security connectors of a specified resource group. * * @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); + public static void + listAllSecurityConnectorsOfASpecifiedResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectors().listByResourceGroup("exampleResourceGroup", com.azure.core.util.Context.NONE); } } ``` @@ -477,23 +815,23 @@ public final class AlertsUpdateResourceGroupLevelStateToDismissSamples { ```java /** - * Samples for Alerts UpdateResourceGroupLevelStateToInProgress. + * Samples for ApiCollections ListByResourceGroup. */ -public final class AlertsUpdateResourceGroupLevelStateToInProgressSamples { +public final class ApiCollectionsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertResourceGroupLocation_inProgress_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_ListByResourceGroup_example.json */ /** - * Sample code: Update security alert state on a resource group from a security data location. + * 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 updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( + public static void getsAListOfAPICollectionsWithinAResourceGroupThatHaveBeenOnboardedToMicrosoftDefenderForAPIs( com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateResourceGroupLevelStateToInProgressWithResponse("myRg2", "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", com.azure.core.util.Context.NONE); + manager.apiCollections().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); } } ``` @@ -502,23 +840,23 @@ public final class AlertsUpdateResourceGroupLevelStateToInProgressSamples { ```java /** - * Samples for Alerts UpdateResourceGroupLevelStateToResolve. + * Samples for DiscoveredSecuritySolutions Get. */ -public final class AlertsUpdateResourceGroupLevelStateToResolveSamples { +public final class DiscoveredSecuritySolutionsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertResourceGroupLocation_resolve_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions + * /GetDiscoveredSecuritySolutionResourceGroupLocation_example.json */ /** - * Sample code: Update security alert state on a resource group from a security data location. + * Sample code: Get discovered security solution from a security data location. * * @param manager Entry point to SecurityManager. */ - public static void updateSecurityAlertStateOnAResourceGroupFromASecurityDataLocation( + public static void getDiscoveredSecuritySolutionFromASecurityDataLocation( com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateResourceGroupLevelStateToResolveWithResponse("myRg2", "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", com.azure.core.util.Context.NONE); + manager.discoveredSecuritySolutions() + .getWithResponse("myRg2", "centralus", "paloalto7", com.azure.core.util.Context.NONE); } } ``` @@ -527,23 +865,23 @@ public final class AlertsUpdateResourceGroupLevelStateToResolveSamples { ```java /** - * Samples for Alerts UpdateSubscriptionLevelStateToActivate. + * Samples for SecuritySolutions Get. */ -public final class AlertsUpdateSubscriptionLevelStateToActivateSamples { +public final class SecuritySolutionsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertSubscriptionLocation_activate_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/ + * GetSecuritySolutionsResourceGroupLocation_example.json */ /** - * Sample code: Update security alert state on a subscription from a security data location. + * Sample code: Get a security solution 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); + public static void + getASecuritySolutionFromASecurityDataLocation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securitySolutions() + .getWithResponse("myRg2", "centralus", "paloalto7", com.azure.core.util.Context.NONE); } } ``` @@ -551,24 +889,30 @@ public final class AlertsUpdateSubscriptionLevelStateToActivateSamples { ### Alerts_UpdateSubscriptionLevelStateToDismiss ```java +import com.azure.resourcemanager.security.models.AzureServersSetting; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsAzureSettingSelectedProvider; +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; + /** - * Samples for Alerts UpdateSubscriptionLevelStateToDismiss. + * Samples for ServerVulnerabilityAssessmentsSettings CreateOrUpdate. */ -public final class AlertsUpdateSubscriptionLevelStateToDismissSamples { +public final class ServerVulnerabilityAssessmentsSettingsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertSubscriptionLocation_dismiss_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ + * ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json */ /** - * Sample code: Update security alert state on a subscription from a security data location. + * Sample code: Set a server vulnerability assessments setting of the kind settingKind on the subscription. * * @param manager Entry point to SecurityManager. */ - public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( + public static void setAServerVulnerabilityAssessmentsSettingOfTheKindSettingKindOnTheSubscription( com.azure.resourcemanager.security.SecurityManager manager) { - manager.alerts() - .updateSubscriptionLevelStateToDismissWithResponse("westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); + manager.serverVulnerabilityAssessmentsSettings() + .createOrUpdateWithResponse(ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, + new AzureServersSetting() + .withSelectedProvider(ServerVulnerabilityAssessmentsAzureSettingSelectedProvider.MDE_TVM), + com.azure.core.util.Context.NONE); } } ``` @@ -577,23 +921,23 @@ public final class AlertsUpdateSubscriptionLevelStateToDismissSamples { ```java /** - * Samples for Alerts UpdateSubscriptionLevelStateToInProgress. + * Samples for AssessmentsMetadata GetInSubscription. */ -public final class AlertsUpdateSubscriptionLevelStateToInProgressSamples { +public final class AssessmentsMetadataGetInSubscriptionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertSubscriptionLocation_inProgress_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * GetAssessmentsMetadata_subscription_example.json */ /** - * Sample code: Update security alert state on a subscription from a security data location. + * Sample code: Get security assessment metadata for subscription. * * @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); + public static void + getSecurityAssessmentMetadataForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.assessmentsMetadatas() + .getInSubscriptionWithResponse("21300918-b2e3-0346-785f-c77ff57d243b", com.azure.core.util.Context.NONE); } } ``` @@ -602,694 +946,847 @@ public final class AlertsUpdateSubscriptionLevelStateToInProgressSamples { ```java /** - * Samples for Alerts UpdateSubscriptionLevelStateToResolve. + * Samples for AutoProvisioningSettings List. */ -public final class AlertsUpdateSubscriptionLevelStateToResolveSamples { +public final class AutoProvisioningSettingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ - * UpdateAlertSubscriptionLocation_resolve_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * AutoProvisioningSettings/GetAutoProvisioningSettingsSubscription_example.json */ /** - * Sample code: Update security alert state on a subscription from a security data location. + * Sample code: Get auto provisioning settings for subscription. * * @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); + public static void + getAutoProvisioningSettingsForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.autoProvisioningSettings().list(com.azure.core.util.Context.NONE); } } ``` -### AllowedConnections_Get +### AlertsSuppressionRules_Delete ```java -import com.azure.resourcemanager.security.models.ConnectionType; +import com.azure.resourcemanager.security.models.RulesResultsInput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; /** - * Samples for AllowedConnections Get. + * Samples for SqlVulnerabilityAssessmentBaselineRules Add. */ -public final class AllowedConnectionsGetSamples { +public final class SqlVulnerabilityAssessmentBaselineRulesAddSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/ - * GetAllowedConnections_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Add.json */ /** - * Sample code: Get allowed connections. + * Sample code: Create a baseline for all rules. * * @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); + public static void createABaselineForAllRules(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentBaselineRules() + .addWithResponse("55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + new RulesResultsInput().withLatestScan(false) + .withResults(mapOf("VA1234", + Arrays.asList(Arrays.asList("userA", "SELECT"), Arrays.asList("userB", "SELECT")), "VA5678", + Arrays.asList(Arrays.asList("Test", "0.0.0.0", "125.125.125.125")))), + 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 + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_AddLatest.json */ /** - * Sample code: Get allowed connections on a subscription. + * Sample code: Create a baseline for all rules using the latest scan results. * * @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); + public static void createABaselineForAllRulesUsingTheLatestScanResults( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentBaselineRules() + .addWithResponse("55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + new RulesResultsInput().withLatestScan(true).withResults(mapOf()), com.azure.core.util.Context.NONE); + } + + // 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; } } ``` -### AllowedConnections_ListByHomeRegion +### AlertsSuppressionRules_Get ```java +import com.azure.resourcemanager.security.models.SecurityContactName; + /** - * Samples for AllowedConnections ListByHomeRegion. + * Samples for SecurityContacts Delete. */ -public final class AllowedConnectionsListByHomeRegionSamples { +public final class SecurityContactsDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/ - * GetAllowedConnectionsSubscriptionLocation_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * DeleteSecurityContact_example.json */ /** - * Sample code: Get allowed connections on a subscription from security data location. + * Sample code: Deletes a security contact data. * * @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); + public static void deletesASecurityContactData(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityContacts().deleteWithResponse(SecurityContactName.DEFAULT, com.azure.core.util.Context.NONE); } } ``` -### ApiCollections_GetByAzureApiManagementService +### AlertsSuppressionRules_List ```java /** - * Samples for ApiCollections GetByAzureApiManagementService. + * Samples for JitNetworkAccessPolicies ListByResourceGroup. */ -public final class ApiCollectionsGetByAzureApiManagementServiceSamples { +public final class JitNetworkAccessPoliciesListByResourceGroupSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ - * APICollections_GetByAzureApiManagementService_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * GetJitNetworkAccessPoliciesResourceGroup_example.json */ /** - * Sample code: Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. + * Sample code: Get JIT network access policies on a resource group. * * @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); + public static void + getJITNetworkAccessPoliciesOnAResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { + manager.jitNetworkAccessPolicies().listByResourceGroup("myRg1", com.azure.core.util.Context.NONE); } } ``` -### ApiCollections_List +### AlertsSuppressionRules_Update ```java /** - * Samples for ApiCollections List. + * Samples for Assessments List. */ -public final class ApiCollectionsListSamples { +public final class AssessmentsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ - * APICollections_ListBySubscription_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ + * ListAssessments_example.json */ /** - * Sample code: Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender - * for APIs. + * Sample code: List security assessments. * * @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); + 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); } } ``` -### ApiCollections_ListByAzureApiManagementService +### AllowedConnections_Get ```java /** - * Samples for ApiCollections ListByAzureApiManagementService. + * Samples for AdvancedThreatProtection Get. */ -public final class ApiCollectionsListByAzureApiManagementServiceSamples { +public final class AdvancedThreatProtectionGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ - * APICollections_ListByAzureApiManagementService_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/ + * GetAdvancedThreatProtectionSettings_example.json */ /** - * Sample code: Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. + * Sample code: Gets the Advanced Threat Protection settings for the specified resource. * * @param manager Entry point to SecurityManager. */ - public static void getsAListOfAzureAPIManagementAPIsThatHaveBeenOnboardedToMicrosoftDefenderForAPIs( + public static void getsTheAdvancedThreatProtectionSettingsForTheSpecifiedResource( com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections() - .listByAzureApiManagementService("rg1", "apimService1", com.azure.core.util.Context.NONE); + manager.advancedThreatProtections() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + com.azure.core.util.Context.NONE); } } ``` -### ApiCollections_ListByResourceGroup +### AllowedConnections_List ```java /** - * Samples for ApiCollections ListByResourceGroup. + * Samples for GovernanceRules Get. */ -public final class ApiCollectionsListByResourceGroupSamples { +public final class GovernanceRulesGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ - * APICollections_ListByResourceGroup_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetManagementGroupGovernanceRule_example.json */ /** - * Sample code: Gets a list of API collections within a resource group that have been onboarded to Microsoft - * Defender for APIs. + * Sample code: Get a governance rule over management group scope. * * @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); + public static void + getAGovernanceRuleOverManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .getWithResponse("providers/Microsoft.Management/managementGroups/contoso", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); } -} -``` -### ApiCollections_OffboardAzureApiManagementApi + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetGovernanceRule_example.json + */ + /** + * Sample code: Get a governance rule over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getAGovernanceRuleOverSubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } -```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 + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetSecurityConnectorGovernanceRule_example.json */ /** - * Sample code: Offboard an Azure API Management API from Microsoft Defender for APIs. + * Sample code: Get a governance rule over security connector scope. * * @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); + public static void + getAGovernanceRuleOverSecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); } } ``` -### ApiCollections_OnboardAzureApiManagementApi +### AllowedConnections_ListByHomeRegion ```java /** - * Samples for ApiCollections OnboardAzureApiManagementApi. + * Samples for GovernanceAssignments Get. */ -public final class ApiCollectionsOnboardAzureApiManagementApiSamples { +public final class GovernanceAssignmentsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ - * APICollections_OnboardAzureApiManagementApi_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/GetGovernanceAssignment_example.json */ /** - * Sample code: Onboard an Azure API Management API to Microsoft Defender for APIs. + * Sample code: Get governanceAssignment by specific governanceAssignmentKey. * * @param manager Entry point to SecurityManager. */ - public static void onboardAnAzureAPIManagementAPIToMicrosoftDefenderForAPIs( + public static void getGovernanceAssignmentBySpecificGovernanceAssignmentKey( com.azure.resourcemanager.security.SecurityManager manager) { - manager.apiCollections() - .onboardAzureApiManagementApi("rg1", "apimService1", "echo-api", com.azure.core.util.Context.NONE); + manager.governanceAssignments() + .getWithResponse( + "subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", + "6b9421dd-5555-2251-9b3d-2be58e2f82cd", "6634ff9f-127b-4bf2-8e6e-b1737f5e789c", + com.azure.core.util.Context.NONE); } } ``` -### Assessments_CreateOrUpdate +### ApiCollections_GetByAzureApiManagementService ```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. + * Samples for AdvancedThreatProtection Create. */ -public final class AssessmentsCreateOrUpdateSamples { +public final class AdvancedThreatProtectionCreateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ - * PutAssessment_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/ + * PutAdvancedThreatProtectionSettings_example.json */ /** - * Sample code: Create security recommendation task on a resource. + * Sample code: Creates or updates the Advanced Threat Protection settings on a specified 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") + public static void createsOrUpdatesTheAdvancedThreatProtectionSettingsOnASpecifiedResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.advancedThreatProtections() + .define() .withExistingResourceId( - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2") - .withStatus(new AssessmentStatus().withCode(AssessmentStatusCode.HEALTHY)) - .withResourceDetails(new AzureResourceDetails()) + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount") + .withIsEnabled(true) .create(); } } ``` -### Assessments_Delete +### ApiCollections_List ```java /** - * Samples for Assessments Delete. + * Samples for ApiCollections ListByAzureApiManagementService. */ -public final class AssessmentsDeleteSamples { +public final class ApiCollectionsListByAzureApiManagementServiceSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ - * DeleteAssessment_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_ListByAzureApiManagementService_example.json */ /** - * Sample code: Delete a security recommendation task on a resource. + * 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 - 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); + public static void getsAListOfAzureAPIManagementAPIsThatHaveBeenOnboardedToMicrosoftDefenderForAPIs( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.apiCollections() + .listByAzureApiManagementService("rg1", "apimService1", com.azure.core.util.Context.NONE); } } ``` -### Assessments_Get +### ApiCollections_ListByAzureApiManagementService ```java -import com.azure.resourcemanager.security.models.ExpandEnum; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import com.azure.resourcemanager.security.models.ApplicationSourceResourceType; +import java.io.IOException; +import java.util.Arrays; /** - * Samples for Assessments Get. + * Samples for SecurityConnectorApplicationOperation CreateOrUpdate. */ -public final class AssessmentsGetSamples { +public final class SecurityConnectorApplicationOperationCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ - * GetAssessmentWithExpand_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * PutSecurityConnectorApplication_example.json */ /** - * Sample code: Get security recommendation task from security data location with expand parameter. + * Sample code: Create Application. * * @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); + public static void createApplication(com.azure.resourcemanager.security.SecurityManager manager) + throws IOException { + manager.securityConnectorApplicationOperations() + .createOrUpdateWithResponse("gcpResourceGroup", "gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + new ApplicationInner().withDisplayName("GCP Admin's application") + .withDescription("An application on critical GCP recommendations") + .withSourceResourceType(ApplicationSourceResourceType.ASSESSMENTS) + .withConditionSets(Arrays.asList(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"conditions\":[{\"operator\":\"contains\",\"property\":\"$.Id\",\"value\":\"-prod-\"}]}", + Object.class, SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); } +} +``` +### ApiCollections_ListByResourceGroup + +```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/2021-06-01/examples/Assessments/ - * GetAssessment_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/ + * UpdateSetting_example.json */ /** - * Sample code: Get security recommendation task from security data location. + * Sample code: Update a setting for subscription. * * @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); + 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); } } ``` -### Assessments_List +### ApiCollections_OffboardAzureApiManagementApi ```java /** - * Samples for Assessments List. + * Samples for AssessmentsMetadata List. */ -public final class AssessmentsListSamples { +public final class AssessmentsMetadataListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ - * ListAssessments_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * ListAssessmentsMetadata_example.json */ /** - * Sample code: List security assessments. + * Sample code: List security assessment metadata. * * @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); + public static void listSecurityAssessmentMetadata(com.azure.resourcemanager.security.SecurityManager manager) { + manager.assessmentsMetadatas().list(com.azure.core.util.Context.NONE); } } ``` -### AssessmentsMetadata_CreateInSubscription +### ApiCollections_OnboardAzureApiManagementApi ```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 com.azure.resourcemanager.security.fluent.models.AutomationInner; +import com.azure.resourcemanager.security.models.AutomationActionLogicApp; +import com.azure.resourcemanager.security.models.AutomationRuleSet; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.azure.resourcemanager.security.models.AutomationTriggeringRule; +import com.azure.resourcemanager.security.models.EventSource; +import com.azure.resourcemanager.security.models.Operator; +import com.azure.resourcemanager.security.models.PropertyType; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; /** - * Samples for AssessmentsMetadata CreateInSubscription. + * Samples for Automations Validate. */ -public final class AssessmentsMetadataCreateInSubscriptionSamples { +public final class AutomationsValidateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ - * CreateAssessmentsMetadata_subscription_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * ValidateAutomation_example.json */ /** - * Sample code: Create security assessment metadata for subscription. + * Sample code: Validate the security automation model before create or update. * * @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(); + public static void validateTheSecurityAutomationModelBeforeCreateOrUpdate( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations() + .validateWithResponse("exampleResourceGroup", "exampleAutomation", new AutomationInner() + .withLocation("Central US") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment") + .withIsEnabled(true) + .withScopes(Arrays.asList(new AutomationScope().withDescription( + "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath( + "/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources(Arrays.asList(new AutomationSource().withEventSource(EventSource.ASSESSMENTS) + .withRuleSets(Arrays.asList(new AutomationRuleSet().withRules( + Arrays.asList(new AutomationTriggeringRule().withPropertyJPath("$.Entity.AssessmentType") + .withPropertyType(PropertyType.STRING) + .withExpectedValue("customAssessment") + .withOperator(Operator.EQUALS))))))) + .withActions(Arrays.asList(new AutomationActionLogicApp().withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))), + com.azure.core.util.Context.NONE); + } + + // 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; } } ``` -### AssessmentsMetadata_DeleteInSubscription +### ApplicationOperation_CreateOrUpdate ```java /** - * Samples for AssessmentsMetadata DeleteInSubscription. + * Samples for SecuritySolutions List. */ -public final class AssessmentsMetadataDeleteInSubscriptionSamples { +public final class SecuritySolutionsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ - * DeleteAssessmentsMetadata_subscription_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/ + * GetSecuritySolutionsSubscription_example.json */ /** - * Sample code: Delete a security assessment metadata for subscription. + * Sample code: Get security solutions. * * @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); + public static void getSecuritySolutions(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securitySolutions().list(com.azure.core.util.Context.NONE); } } ``` -### AssessmentsMetadata_Get +### ApplicationOperation_Delete ```java +import com.azure.resourcemanager.security.models.ActionableRemediation; +import com.azure.resourcemanager.security.models.ActionableRemediationState; +import com.azure.resourcemanager.security.models.AzureDevOpsProject; +import com.azure.resourcemanager.security.models.AzureDevOpsProjectProperties; +import com.azure.resourcemanager.security.models.OnboardingState; + /** - * Samples for AssessmentsMetadata Get. + * Samples for AzureDevOpsProjects Update. */ -public final class AssessmentsMetadataGetSamples { +public final class AzureDevOpsProjectsUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ - * GetAssessmentsMetadata_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * UpdateAzureDevOpsProjects_example.json */ /** - * Sample code: Get security assessment metadata. + * Sample code: Update_AzureDevOpsProjects. * * @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); + public static void updateAzureDevOpsProjects(com.azure.resourcemanager.security.SecurityManager manager) { + AzureDevOpsProject resource = manager.azureDevOpsProjects() + .getWithResponse("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new AzureDevOpsProjectProperties().withOnboardingState(OnboardingState.NOT_APPLICABLE) + .withActionableRemediation(new ActionableRemediation().withState(ActionableRemediationState.ENABLED))) + .apply(); } } ``` -### AssessmentsMetadata_GetInSubscription +### ApplicationOperation_Get ```java /** - * Samples for AssessmentsMetadata GetInSubscription. + * Samples for GitHubRepos List. */ -public final class AssessmentsMetadataGetInSubscriptionSamples { +public final class GitHubReposListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ - * GetAssessmentsMetadata_subscription_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListGitHubRepos_example.json */ /** - * Sample code: Get security assessment metadata for subscription. + * Sample code: List_GitHubRepos. * * @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); + public static void listGitHubRepos(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitHubRepos() + .list("myRg", "mySecurityConnectorName", "myGitHubOwner", com.azure.core.util.Context.NONE); } } ``` -### AssessmentsMetadata_List +### Applications_List ```java /** - * Samples for AssessmentsMetadata List. + * Samples for SoftwareInventories ListByExtendedResource. */ -public final class AssessmentsMetadataListSamples { +public final class SoftwareInventoriesListByExtendedResourceSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ - * ListAssessmentsMetadata_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/ + * SoftwareInventories/ListByExtendedResourceSoftwareInventories_example.json */ /** - * Sample code: List security assessment metadata. + * Sample code: Gets the software inventory of the virtual machine. * * @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); + public static void + getsTheSoftwareInventoryOfTheVirtualMachine(com.azure.resourcemanager.security.SecurityManager manager) { + manager.softwareInventories() + .listByExtendedResource("EITAN-TESTS", "Microsoft.Compute", "virtualMachines", "Eitan-Test1", + com.azure.core.util.Context.NONE); } } ``` -### AssessmentsMetadata_ListBySubscription +### Assessments_CreateOrUpdate ```java /** - * Samples for AssessmentsMetadata ListBySubscription. + * Samples for SecurityConnectorApplicationOperation Delete. */ -public final class AssessmentsMetadataListBySubscriptionSamples { +public final class SecurityConnectorApplicationOperationDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ - * ListAssessmentsMetadata_subscription_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * DeleteSecurityConnectorApplication_example.json */ /** - * Sample code: List security assessment metadata for subscription. + * Sample code: Delete security Application. * * @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); + public static void deleteSecurityApplication(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectorApplicationOperations() + .deleteWithResponse("gcpResourceGroup", "gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + com.azure.core.util.Context.NONE); } } ``` -### ComplianceResults_Get +### Assessments_Delete ```java /** - * Samples for ComplianceResults Get. + * Samples for StandardAssignments Get. */ -public final class ComplianceResultsGetSamples { +public final class StandardAssignmentsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/ - * GetComplianceResults_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * GetStandardAssignment.json */ /** - * Sample code: Get compliance results on subscription. + * Sample code: Retrieve a standard assignment. * * @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); + 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); } } ``` -### ComplianceResults_List +### Assessments_Get ```java +import com.azure.resourcemanager.security.models.InformationProtectionKeyword; +import com.azure.resourcemanager.security.models.InformationProtectionPolicyName; +import com.azure.resourcemanager.security.models.InformationType; +import com.azure.resourcemanager.security.models.SensitivityLabel; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + /** - * Samples for ComplianceResults List. + * Samples for InformationProtectionPolicies CreateOrUpdate. */ -public final class ComplianceResultsListSamples { +public final class InformationProtectionPoliciesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/ - * ListComplianceResults_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/CreateOrUpdateInformationProtectionPolicy_example.json */ /** - * Sample code: Get compliance results on subscription. + * Sample code: Create or update an information protection policy for a management group. * * @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); + public static void createOrUpdateAnInformationProtectionPolicyForAManagementGroup( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.informationProtectionPolicies() + .define(InformationProtectionPolicyName.CUSTOM) + .withExistingScope("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e") + .withLabels(mapOf("1345da73-bc5a-4a8f-b7dd-3820eb713da8", + new SensitivityLabel().withDisplayName("Public").withOrder(100).withEnabled(true), + "575739d2-3d53-4df0-9042-4c7772d5c7b1", + new SensitivityLabel().withDisplayName("Confidential").withOrder(300).withEnabled(true), + "7aa516c7-5a53-4857-bc6e-6808c6acd542", + new SensitivityLabel().withDisplayName("General").withOrder(200).withEnabled(true))) + .withInformationTypes(mapOf("3bf35491-99b8-41f2-86d5-c1200a7df658", + new InformationType().withDisplayName("Custom") + .withOrder(1400) + .withRecommendedLabelId(UUID.fromString("7aa516c7-5a53-4857-bc6e-6808c6acd542")) + .withEnabled(true) + .withCustom(true) + .withKeywords(Arrays.asList(new InformationProtectionKeyword().withPattern("%custom%") + .withCustom(true) + .withCanBeNumeric(true))), + "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07", + new InformationType().withDisplayName("Networking") + .withOrder(100) + .withRecommendedLabelId(UUID.fromString("575739d2-3d53-4df0-9042-4c7772d5c7b1")) + .withEnabled(true) + .withCustom(false) + .withKeywords(Arrays.asList(new InformationProtectionKeyword().withPattern("%networking%") + .withCustom(true) + .withCanBeNumeric(false))))) + .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; } } ``` -### CustomRecommendations_CreateOrUpdate +### Assessments_List ```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. + * Samples for StandardAssignments Delete. */ -public final class CustomRecommendationsCreateOrUpdateSamples { +public final class StandardAssignmentsDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * PutBySecurityConnectorCustomRecommendation_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * DeleteStandardAssignment.json */ /** - * Sample code: Create or update custom recommendation over security connector scope. + * Sample code: Delete a standard assignment. * * @param manager Entry point to SecurityManager. */ - public static void createOrUpdateCustomRecommendationOverSecurityConnectorScope( + 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); + } +} +``` + +### AssessmentsMetadata_CreateInSubscription + +```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.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(); + manager.alerts() + .updateSubscriptionLevelStateToActivateWithResponse("westeurope", + "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); + } +} +``` + +### AssessmentsMetadata_DeleteInSubscription + +```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); } +} +``` + +### AssessmentsMetadata_Get +```java +/** + * Samples for Automations Delete. + */ +public final class AutomationsDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * PutBySubscriptionCustomRecommendation_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * DeleteAutomation_example.json */ /** - * Sample code: Create or update custom recommendation over subscription scope. + * Sample code: Delete a security automation. * * @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(); + public static void deleteASecurityAutomation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations() + .deleteByResourceGroupWithResponse("myRg", "myAutomationName", com.azure.core.util.Context.NONE); } +} +``` + +### AssessmentsMetadata_GetInSubscription +```java +/** + * Samples for AllowedConnections List. + */ +public final class AllowedConnectionsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * PutByManagementGroupCustomRecommendation_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/ + * GetAllowedConnectionsSubscription_example.json */ /** - * Sample code: Create or update custom recommendation over management group scope. + * Sample code: Get allowed connections on a subscription. * * @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(); + public static void + getAllowedConnectionsOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.allowedConnections().list(com.azure.core.util.Context.NONE); } } ``` -### CustomRecommendations_Delete +### AssessmentsMetadata_List ```java /** @@ -1350,980 +1847,5423 @@ public final class CustomRecommendationsDeleteSamples { } ``` -### CustomRecommendations_Get +### AssessmentsMetadata_ListBySubscription ```java /** - * Samples for CustomRecommendations Get. + * Samples for CustomAssessmentAutomations GetByResourceGroup. */ -public final class CustomRecommendationsGetSamples { +public final class CustomAssessmentAutomationsGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * GetByManagementGroupCustomRecommendation_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationGet_example.json */ /** - * Sample code: Get a custom recommendation over management group scope. + * Sample code: Get a Custom Assessment Automation. * * @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); + public static void getACustomAssessmentAutomation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customAssessmentAutomations() + .getByResourceGroupWithResponse("TestResourceGroup", "MyCustomAssessmentAutomation", + com.azure.core.util.Context.NONE); } +} +``` +### AutoProvisioningSettings_Create + +```java +/** + * Samples for GitLabProjects Get. + */ +public final class GitLabProjectsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * GetBySecurityConnectorCustomRecommendation_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetGitLabProjects_example.json */ /** - * Sample code: Get a custom recommendation over security connector scope. + * Sample code: Get_GitLabProjects. * * @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); + public static void getGitLabProjects(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitLabProjects() + .getWithResponse("myRg", "mySecurityConnectorName", "myGitLabGroup$mySubGroup", "myGitLabProject", + com.azure.core.util.Context.NONE); } +} +``` +### AutoProvisioningSettings_Get + +```java +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; +import com.azure.resourcemanager.security.models.AgentlessConfiguration; +import com.azure.resourcemanager.security.models.AgentlessEnablement; +import com.azure.resourcemanager.security.models.AutoDiscovery; +import com.azure.resourcemanager.security.models.DevOpsConfigurationProperties; +import com.azure.resourcemanager.security.models.InventoryKind; +import com.azure.resourcemanager.security.models.InventoryList; +import com.azure.resourcemanager.security.models.InventoryListKind; +import java.util.Arrays; + +/** + * Samples for DevOpsConfigurations Update. + */ +public final class DevOpsConfigurationsUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * GetBySubscriptionCustomRecommendation_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * UpdateDevOpsConfigurations_example.json */ /** - * Sample code: Get a custom recommendation over subscription scope. + * Sample code: Update_DevOpsConfigurations. * * @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); + public static void updateDevOpsConfigurations(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .update("myRg", "mySecurityConnectorName", + new DevOpsConfigurationInner() + .withProperties(new DevOpsConfigurationProperties().withAutoDiscovery(AutoDiscovery.ENABLED) + .withAgentlessConfiguration( + new AgentlessConfiguration().withAgentlessEnabled(AgentlessEnablement.ENABLED) + .withAgentlessAutoDiscovery(AutoDiscovery.DISABLED) + .withScanners(Arrays.asList("scanner1", "scanner2")) + .withInventoryListType(InventoryListKind.INCLUSION) + .withInventoryList(Arrays.asList( + new InventoryList().withInventoryKind(InventoryKind.AZURE_DEV_OPS_ORGANIZATION) + .withValue("org1"))))), + com.azure.core.util.Context.NONE); } } ``` -### CustomRecommendations_List +### AutoProvisioningSettings_List ```java +import com.azure.resourcemanager.security.models.TaskUpdateActionType; + /** - * Samples for CustomRecommendations List. + * Samples for Tasks UpdateResourceGroupLevelTaskState. */ -public final class CustomRecommendationsListSamples { +public final class TasksUpdateResourceGroupLevelTaskStateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * ListByManagementGroupCustomRecommendations_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * UpdateTaskResourceGroupLocation_example.json */ /** - * Sample code: List custom recommendations by management group scope. + * Sample code: Change security recommendation task state. * * @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); + changeSecurityRecommendationTaskState(com.azure.resourcemanager.security.SecurityManager manager) { + manager.tasks() + .updateResourceGroupLevelTaskStateWithResponse("myRg", "westeurope", "d55b4dc0-779c-c66c-33e5-d7bce24c4222", + TaskUpdateActionType.DISMISS, com.azure.core.util.Context.NONE); } +} +``` + +### Automations_CreateOrUpdate +```java +/** + * Samples for IotSecuritySolutionsAnalyticsRecommendation Get. + */ +public final class IotSecuritySolutionsAnalyticsRecommendationGetSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * ListBySubscriptionCustomRecommendations_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json */ /** - * Sample code: List custom recommendations by subscription scope. + * Sample code: Get the aggregated security analytics recommendation of yours IoT Security solution. * * @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); + public static void getTheAggregatedSecurityAnalyticsRecommendationOfYoursIoTSecuritySolution( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.iotSecuritySolutionsAnalyticsRecommendations() + .getWithResponse("IoTEdgeResources", "default", "OpenPortsOnDevice", com.azure.core.util.Context.NONE); } +} +``` +### Automations_Delete + +```java +/** + * Samples for SecurityContacts List. + */ +public final class SecurityContactsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ - * ListBySecurityConnectorCustomRecommendations_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * GetSecurityContactsSubscription_example.json */ /** - * Sample code: List custom recommendations by security connector scope. + * Sample code: List security contact data. * * @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); + public static void listSecurityContactData(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityContacts().list(com.azure.core.util.Context.NONE); } } ``` -### DeviceSecurityGroups_CreateOrUpdate +### Automations_GetByResourceGroup ```java -import com.azure.resourcemanager.security.models.ActiveConnectionsNotInAllowedRange; -import java.time.Duration; -import java.util.Arrays; - /** - * Samples for DeviceSecurityGroups CreateOrUpdate. + * Samples for IotSecuritySolutionsAnalyticsAggregatedAlert Get. */ -public final class DeviceSecurityGroupsCreateOrUpdateSamples { +public final class IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ - * PutDeviceSecurityGroups_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlert.json */ /** - * Sample code: Create or update a device security group for the specified IoT hub resource. + * 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 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(); + 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); } } ``` -### DeviceSecurityGroups_Delete +### Automations_List ```java /** - * Samples for DeviceSecurityGroups Delete. + * Samples for IotSecuritySolutionAnalytics List. */ -public final class DeviceSecurityGroupsDeleteSamples { +public final class IotSecuritySolutionAnalyticsListSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ - * DeleteDeviceSecurityGroups_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json */ /** - * Sample code: Delete a device security group for the specified IoT Hub resource. + * Sample code: Get Security Solution Analytics. * * @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); + public static void getSecuritySolutionAnalytics(com.azure.resourcemanager.security.SecurityManager manager) { + manager.iotSecuritySolutionAnalytics().listWithResponse("MyGroup", "default", com.azure.core.util.Context.NONE); } } ``` -### DeviceSecurityGroups_Get +### Automations_ListByResourceGroup ```java /** - * Samples for DeviceSecurityGroups Get. + * Samples for SecurityOperators CreateOrUpdate. */ -public final class DeviceSecurityGroupsGetSamples { +public final class SecurityOperatorsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ - * GetDeviceSecurityGroups_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * PutSecurityOperatorByName_example.json */ /** - * Sample code: Get a device security group for the specified IoT Hub resource. + * Sample code: Create a security operator on the given scope. * * @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); + public static void + createASecurityOperatorOnTheGivenScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityOperators() + .createOrUpdateWithResponse("CloudPosture", "DefenderCSPMSecurityOperator", + com.azure.core.util.Context.NONE); } } ``` -### DeviceSecurityGroups_List +### Automations_Update ```java /** - * Samples for DeviceSecurityGroups List. + * Samples for SqlVulnerabilityAssessmentBaselineRules List. */ -public final class DeviceSecurityGroupsListSamples { +public final class SqlVulnerabilityAssessmentBaselineRulesListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ - * ListDeviceSecurityGroups_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_List.json */ /** - * Sample code: List all device security groups for the specified IoT Hub resource. + * Sample code: List baseline for all rules. * * @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", + public static void listBaselineForAllRules(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentBaselineRules() + .listWithResponse("55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", com.azure.core.util.Context.NONE); } } ``` -### DiscoveredSecuritySolutions_Get +### Automations_Validate ```java +import com.azure.resourcemanager.security.models.ActiveConnectionsNotInAllowedRange; +import java.time.Duration; +import java.util.Arrays; + /** - * Samples for DiscoveredSecuritySolutions Get. + * Samples for DeviceSecurityGroups CreateOrUpdate. */ -public final class DiscoveredSecuritySolutionsGetSamples { +public final class DeviceSecurityGroupsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions - * /GetDiscoveredSecuritySolutionResourceGroupLocation_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ + * PutDeviceSecurityGroups_example.json */ /** - * Sample code: Get discovered security solution from a security data location. + * Sample code: Create or update a device security group for the specified IoT hub resource. * * @param manager Entry point to SecurityManager. */ - public static void getDiscoveredSecuritySolutionFromASecurityDataLocation( + public static void createOrUpdateADeviceSecurityGroupForTheSpecifiedIoTHubResource( com.azure.resourcemanager.security.SecurityManager manager) { - manager.discoveredSecuritySolutions() - .getWithResponse("myRg2", "centralus", "paloalto7", com.azure.core.util.Context.NONE); + 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(); } } ``` -### DiscoveredSecuritySolutions_List +### AzureDevOpsOrgs_CreateOrUpdate ```java /** - * Samples for DiscoveredSecuritySolutions List. + * Samples for ApiCollections List. */ -public final class DiscoveredSecuritySolutionsListSamples { +public final class ApiCollectionsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions - * /GetDiscoveredSecuritySolutionsSubscription_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_ListBySubscription_example.json */ /** - * Sample code: Get discovered security solutions. + * 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 getDiscoveredSecuritySolutions(com.azure.resourcemanager.security.SecurityManager manager) { - manager.discoveredSecuritySolutions().list(com.azure.core.util.Context.NONE); + public static void getsAListOfAPICollectionsWithinASubscriptionThatHaveBeenOnboardedToMicrosoftDefenderForAPIs( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.apiCollections().list(com.azure.core.util.Context.NONE); } } ``` -### DiscoveredSecuritySolutions_ListByHomeRegion +### AzureDevOpsOrgs_Get ```java /** - * Samples for DiscoveredSecuritySolutions ListByHomeRegion. + * Samples for JitNetworkAccessPolicies Get. */ -public final class DiscoveredSecuritySolutionsListByHomeRegionSamples { +public final class JitNetworkAccessPoliciesGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions - * /GetDiscoveredSecuritySolutionsSubscriptionLocation_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * GetJitNetworkAccessPolicy_example.json */ /** - * Sample code: Get discovered security solutions from a security data location. + * Sample code: Get JIT network access policy. * * @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); + public static void getJITNetworkAccessPolicy(com.azure.resourcemanager.security.SecurityManager manager) { + manager.jitNetworkAccessPolicies() + .getWithResponse("myRg1", "westeurope", "default", com.azure.core.util.Context.NONE); } } ``` -### ExternalSecuritySolutions_Get +### AzureDevOpsOrgs_List ```java +import com.azure.resourcemanager.security.models.UpdateSensitivitySettingsRequest; +import java.util.Arrays; +import java.util.UUID; + /** - * Samples for ExternalSecuritySolutions Get. + * Samples for SensitivitySettings CreateOrUpdate. */ -public final class ExternalSecuritySolutionsGetSamples { +public final class SensitivitySettingsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/ - * GetExternalSecuritySolution_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/ + * SensitivitySettings/PutSensitivitySettings_example.json */ /** - * Sample code: Get external security solution. + * Sample code: Update sensitivity settings. * * @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); + public static void updateSensitivitySettings(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sensitivitySettings() + .createOrUpdateWithResponse( + new UpdateSensitivitySettingsRequest() + .withSensitiveInfoTypesIds(Arrays.asList(UUID.fromString("f2f8a7a1-28c0-404b-9ab4-30a0a7af18cb"), + UUID.fromString("b452f22b-f87d-4f48-8490-ecf0873325b5"), + UUID.fromString("d59ee8b6-2618-404b-a5e7-aa377cd67543"))) + .withSensitivityThresholdLabelOrder(2.0F) + .withSensitivityThresholdLabelId(UUID.fromString("f2f8a7a1-28c0-404b-9ab4-30a0a7af18cb")), + com.azure.core.util.Context.NONE); } } ``` -### ExternalSecuritySolutions_List +### AzureDevOpsOrgs_ListAvailable ```java /** - * Samples for ExternalSecuritySolutions List. + * Samples for Pricings Get. */ -public final class ExternalSecuritySolutionsListSamples { +public final class PricingsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/ - * GetExternalSecuritySolutionsSubscription_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetResourcePricingByNameVirtualMachines_example.json */ /** - * Sample code: Get external security solutions on a subscription. + * Sample code: Get pricings on resource - VirtualMachines plan. * * @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); + 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); } -} -``` -### 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 + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetPricingByNameCloudPosture_example.json */ /** - * Sample code: Get external security solutions on a subscription from security data location. + * Sample code: Get pricings on subscription - CloudPosture plan. * * @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); - } -} -``` - + 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); + } +} +``` + +### AzureDevOpsOrgs_Update + +```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); + } +} +``` + +### AzureDevOpsProjects_CreateOrUpdate + +```java +/** + * Samples for SensitivitySettings Get. + */ +public final class SensitivitySettingsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/ + * SensitivitySettings/GetSensitivitySettings_example.json + */ + /** + * Sample code: Get sensitivity settings. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSensitivitySettings(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sensitivitySettings().getWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### AzureDevOpsProjects_Get + +```java +/** + * Samples for GovernanceRules Delete. + */ +public final class GovernanceRulesDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * DeleteManagementGroupGovernanceRule_example.json + */ + /** + * Sample code: Delete a Governance rule over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteAGovernanceRuleOverManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .delete("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/preview/2022-01-01-preview/examples/GovernanceRules/ + * DeleteGovernanceRule_example.json + */ + /** + * Sample code: Delete a Governance rule over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteAGovernanceRuleOverSubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .delete("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * DeleteSecurityConnectorGovernanceRule_example.json + */ + /** + * Sample code: Delete a Governance rule over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteAGovernanceRuleOverSecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .delete( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureDevOpsProjects_List + +```java +/** + * Samples for HealthReports Get. + */ +public final class HealthReportsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/ + * GetHealthReports_example.json + */ + /** + * Sample code: Get health report of resource. + * + * @param manager Entry point to SecurityManager. + */ + public static void getHealthReportOfResource(com.azure.resourcemanager.security.SecurityManager manager) { + manager.healthReports() + .getWithResponse( + "subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2/resourcegroups/E2E-IBB0WX/providers/Microsoft.Security/securityconnectors/AwsConnectorAllOfferings", + "909c629a-bf39-4521-8e4f-10b443a0bc02", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureDevOpsProjects_Update + +```java +/** + * Samples for CustomAssessmentAutomations ListByResourceGroup. + */ +public final class CustomAssessmentAutomationsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationListByResourceGroup_example.json + */ + /** + * Sample code: List Custom Assessment Automations in a subscription and a resource group. + * + * @param manager Entry point to SecurityManager. + */ + public static void listCustomAssessmentAutomationsInASubscriptionAndAResourceGroup( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.customAssessmentAutomations() + .listByResourceGroup("TestResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureDevOpsRepos_CreateOrUpdate + +```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); + } +} +``` + +### AzureDevOpsRepos_Get + +```java +/** + * Samples for Tasks GetSubscriptionLevelTask. + */ +public final class TasksGetSubscriptionLevelTaskSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTaskSubscriptionLocation_example.json + */ + /** + * Sample code: Get security recommendation task from security data location. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSecurityRecommendationTaskFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.tasks() + .getSubscriptionLevelTaskWithResponse("westeurope", "62609ee7-d0a5-8616-9fe4-1df5cca7758d", + com.azure.core.util.Context.NONE); + } +} +``` + +### AzureDevOpsRepos_List + +```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); + } +} +``` + +### AzureDevOpsRepos_Update + +```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); + } +} +``` + +### ComplianceResults_Get + +```java +/** + * Samples for AzureDevOpsOrgs ListAvailable. + */ +public final class AzureDevOpsOrgsListAvailableSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListAvailableAzureDevOpsOrgs_example.json + */ + /** + * Sample code: ListAvailable_AzureDevOpsOrgs. + * + * @param manager Entry point to SecurityManager. + */ + public static void listAvailableAzureDevOpsOrgs(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsOrgs() + .listAvailableWithResponse("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } +} +``` + +### ComplianceResults_List + +```java +/** + * Samples for Connectors Get. + */ +public final class ConnectorsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * GetConnectorSubscription_example.json + */ + /** + * Sample code: Details of a specific cloud account connector. + * + * @param manager Entry point to SecurityManager. + */ + public static void + detailsOfASpecificCloudAccountConnector(com.azure.resourcemanager.security.SecurityManager manager) { + manager.connectors().getWithResponse("aws_dev1", com.azure.core.util.Context.NONE); + } +} +``` + +### Compliances_Get + +```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(); + } +} +``` + +### Compliances_List + +```java +/** + * Samples for SoftwareInventories List. + */ +public final class SoftwareInventoriesListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/ + * SoftwareInventories/ListBySubscriptionSoftwareInventories_example.json + */ + /** + * Sample code: Gets the software inventory of all virtual machines in the subscriptions. + * + * @param manager Entry point to SecurityManager. + */ + public static void getsTheSoftwareInventoryOfAllVirtualMachinesInTheSubscriptions( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.softwareInventories().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Connectors_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(); + } +} +``` + +### Connectors_Delete + +```java +/** + * Samples for SubAssessments List. + */ +public final class SubAssessmentsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ + * ListSubAssessments_example.json + */ + /** + * Sample code: List security sub-assessments. + * + * @param manager Entry point to SecurityManager. + */ + public static void listSecuritySubAssessments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.subAssessments() + .list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "82e20e14-edc5-4373-bfc4-f13121257c37", + com.azure.core.util.Context.NONE); + } +} +``` + +### Connectors_Get + +```java +import com.azure.resourcemanager.security.models.AutoProvision; +import com.azure.resourcemanager.security.models.AwAssumeRoleAuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.AwsCredsAuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.GcpCredentialsDetailsProperties; +import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; +import com.azure.resourcemanager.security.models.ProxyServerProperties; +import com.azure.resourcemanager.security.models.ServicePrincipalProperties; + +/** + * Samples for Connectors CreateOrUpdate. + */ +public final class ConnectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * CreateUpdateGcpCredentialsConnectorSubscription_example.json + */ + /** + * Sample code: gcpCredentials - Create a cloud account connector for a subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void gcpCredentialsCreateACloudAccountConnectorForASubscription( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.connectors() + .define("gcp_dev") + .withHybridComputeSettings(new HybridComputeSettingsProperties().withAutoProvision(AutoProvision.OFF)) + .withAuthenticationDetails(new GcpCredentialsDetailsProperties().withOrganizationId("AscDemoOrg") + .withType("service_account") + .withProjectId("asc-project-1234") + .withPrivateKeyId("fakeTokenPlaceholder") + .withPrivateKey("fakeTokenPlaceholder") + .withClientEmail("asc-135@asc-project-1234.iam.gserviceaccount.com") + .withClientId("105889053725632919854") + .withAuthUri("https://accounts.google.com/o/oauth2/auth") + .withTokenUri("fakeTokenPlaceholder") + .withAuthProviderX509CertUrl("https://www.googleapis.com/oauth2/v1/certs") + .withClientX509CertUrl( + "https://www.googleapis.com/robot/v1/metadata/x509/asc-135%40asc-project-1234.iam.gserviceaccount.com")) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * CreateUpdateAwsCredConnectorSubscription_example.json + */ + /** + * Sample code: AwsCred - Create a cloud account connector for a subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void awsCredCreateACloudAccountConnectorForASubscription( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.connectors() + .define("aws_dev1") + .withHybridComputeSettings(new HybridComputeSettingsProperties().withAutoProvision(AutoProvision.ON) + .withResourceGroupName("AwsConnectorRG") + .withRegion("West US 2") + .withProxyServer(new ProxyServerProperties().withIp("167.220.197.140").withPort("34")) + .withServicePrincipal( + new ServicePrincipalProperties().withApplicationId("ad9bcd79-be9c-45ab-abd8-80ca1654a7d1") + .withSecret("fakeTokenPlaceholder"))) + .withAuthenticationDetails( + new AwsCredsAuthenticationDetailsProperties().withAwsAccessKeyId("fakeTokenPlaceholder") + .withAwsSecretAccessKey("fakeTokenPlaceholder")) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * CreateUpdateAwsAssumeRoleConnectorSubscription_example.json + */ + /** + * Sample code: AwsAssumeRole - Create a cloud account connector for a subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void awsAssumeRoleCreateACloudAccountConnectorForASubscription( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.connectors() + .define("aws_dev2") + .withHybridComputeSettings(new HybridComputeSettingsProperties().withAutoProvision(AutoProvision.ON) + .withResourceGroupName("AwsConnectorRG") + .withRegion("West US 2") + .withProxyServer(new ProxyServerProperties().withIp("167.220.197.140").withPort("34")) + .withServicePrincipal( + new ServicePrincipalProperties().withApplicationId("ad9bcd79-be9c-45ab-abd8-80ca1654a7d1") + .withSecret("fakeTokenPlaceholder"))) + .withAuthenticationDetails(new AwAssumeRoleAuthenticationDetailsProperties() + .withAwsAssumeRoleArn("arn:aws:iam::81231569658:role/AscConnector") + .withAwsExternalId("20ff7fc3-e762-44dd-bd96-b71116dcdc23")) + .create(); + } +} +``` + +### Connectors_List + +```java +import com.azure.resourcemanager.security.models.WorkspaceSetting; + +/** + * Samples for WorkspaceSettings Update. + */ +public final class WorkspaceSettingsUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * UpdateWorkspaceSetting_example.json + */ + /** + * Sample code: Update a workspace setting data for subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void + updateAWorkspaceSettingDataForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + WorkspaceSetting resource + = manager.workspaceSettings().getWithResponse("default", com.azure.core.util.Context.NONE).getValue(); + resource.update() + .withWorkspaceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace") + .apply(); + } +} +``` + +### CustomAssessmentAutomations_Create + +```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(); + } +} +``` + +### CustomAssessmentAutomations_Delete + +```java +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; +import com.azure.resourcemanager.security.models.AgentlessConfiguration; +import com.azure.resourcemanager.security.models.AgentlessEnablement; +import com.azure.resourcemanager.security.models.Authorization; +import com.azure.resourcemanager.security.models.AutoDiscovery; +import com.azure.resourcemanager.security.models.DevOpsConfigurationProperties; +import com.azure.resourcemanager.security.models.InventoryKind; +import com.azure.resourcemanager.security.models.InventoryList; +import com.azure.resourcemanager.security.models.InventoryListKind; +import java.util.Arrays; + +/** + * Samples for DevOpsConfigurations CreateOrUpdate. + */ +public final class DevOpsConfigurationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * CreateOrUpdateDevOpsConfigurationsOnboardCurrentAndFuture_example.json + */ + /** + * Sample code: CreateOrUpdate_DevOpsConfigurations_OnboardCurrentAndFuture. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateDevOpsConfigurationsOnboardCurrentAndFuture( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .createOrUpdate("myRg", "mySecurityConnectorName", + new DevOpsConfigurationInner().withProperties(new DevOpsConfigurationProperties() + .withAuthorization(new Authorization().withCode("fakeTokenPlaceholder")) + .withAutoDiscovery(AutoDiscovery.ENABLED)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * CreateOrUpdateDevOpsConfigurationsWithAgentlessConfigurations_example.json + */ + /** + * Sample code: CreateOrUpdate_DevOpsConfigurations_WithAgentlessConfigurations. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateDevOpsConfigurationsWithAgentlessConfigurations( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .createOrUpdate("myRg", "mySecurityConnectorName", + new DevOpsConfigurationInner().withProperties(new DevOpsConfigurationProperties() + .withAuthorization(new Authorization().withCode("fakeTokenPlaceholder")) + .withAutoDiscovery(AutoDiscovery.ENABLED) + .withAgentlessConfiguration( + new AgentlessConfiguration().withAgentlessEnabled(AgentlessEnablement.ENABLED) + .withAgentlessAutoDiscovery(AutoDiscovery.DISABLED) + .withScanners(Arrays.asList("scanner1", "scanner2")) + .withInventoryListType(InventoryListKind.INCLUSION) + .withInventoryList(Arrays + .asList(new InventoryList().withInventoryKind(InventoryKind.AZURE_DEV_OPS_ORGANIZATION) + .withValue("org1"))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * CreateOrUpdateDevOpsConfigurationsOnboardCurrentOnly_example.json + */ + /** + * Sample code: CreateOrUpdate_DevOpsConfigurations_OnboardCurrentOnly. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateDevOpsConfigurationsOnboardCurrentOnly( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .createOrUpdate("myRg", "mySecurityConnectorName", + new DevOpsConfigurationInner().withProperties(new DevOpsConfigurationProperties() + .withAuthorization(new Authorization().withCode("fakeTokenPlaceholder")) + .withAutoDiscovery(AutoDiscovery.DISABLED)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * CreateOrUpdateDevOpsConfigurationsOnboardSelected_example.json + */ + /** + * Sample code: CreateOrUpdate_DevOpsConfigurations_OnboardSelected. + * + * @param manager Entry point to SecurityManager. + */ + public static void + createOrUpdateDevOpsConfigurationsOnboardSelected(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .createOrUpdate("myRg", "mySecurityConnectorName", + new DevOpsConfigurationInner().withProperties(new DevOpsConfigurationProperties() + .withAuthorization(new Authorization().withCode("fakeTokenPlaceholder")) + .withAutoDiscovery(AutoDiscovery.DISABLED) + .withTopLevelInventoryList(Arrays.asList("org1", "org2"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### CustomAssessmentAutomations_GetByResourceGroup + +```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); + } +} +``` + +### CustomAssessmentAutomations_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); + } +} +``` + +### CustomAssessmentAutomations_ListByResourceGroup + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; +import com.azure.resourcemanager.security.models.RuleState; +import com.azure.resourcemanager.security.models.ScopeElement; +import com.azure.resourcemanager.security.models.SuppressionAlertsScope; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AlertsSuppressionRules Update. + */ +public final class AlertsSuppressionRulesUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/PutAlertsSuppressionRule_example.json + */ + /** + * Sample code: Update or create suppression rule for subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void updateOrCreateSuppressionRuleForSubscription( + com.azure.resourcemanager.security.SecurityManager manager) throws IOException { + manager.alertsSuppressionRules() + .updateWithResponse("dismissIpAnomalyAlerts", new AlertsSuppressionRuleInner().withAlertType("IpAnomaly") + .withExpirationDateUtc(OffsetDateTime.parse("2019-12-01T19:50:47.083633Z")) + .withReason("FalsePositive") + .withState(RuleState.ENABLED) + .withComment("Test VM") + .withSuppressionAlertsScope(new SuppressionAlertsScope().withAllOf(Arrays.asList(new ScopeElement() + .withField("entities.ip.address") + .withAdditionalProperties(mapOf("in", SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("[\"104.215.95.187\",\"52.164.206.56\"]", Object.class, SerializerEncoding.JSON))), + new ScopeElement().withField("entities.process.commandline") + .withAdditionalProperties(mapOf("contains", "POWERSHELL.EXE"))))), + com.azure.core.util.Context.NONE); + } + + // 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; + } +} +``` + +### CustomEntityStoreAssignments_Create + +```java +import com.azure.resourcemanager.security.models.Automation; +import com.azure.resourcemanager.security.models.AutomationActionLogicApp; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.azure.resourcemanager.security.models.EventSource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Automations Update. + */ +public final class AutomationsUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PatchAutomation_example.json + */ + /** + * Sample code: Update a security automation. + * + * @param manager Entry point to SecurityManager. + */ + public static void updateASecurityAutomation(com.azure.resourcemanager.security.SecurityManager manager) { + Automation resource = manager.automations() + .getByResourceGroupWithResponse("exampleResourceGroup", "exampleAutomation", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Example", "exampleTag")) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment") + .withScopes(Arrays.asList(new AutomationScope().withDescription( + "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources(Arrays.asList(new AutomationSource().withEventSource(EventSource.ASSESSMENTS))) + .withActions(Arrays.asList(new AutomationActionLogicApp().withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))) + .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; + } +} +``` + +### CustomEntityStoreAssignments_Delete + +```java +/** + * Samples for SensitivitySettings List. + */ +public final class SensitivitySettingsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/ + * SensitivitySettings/GetSensitivitySettingsList_example.json + */ + /** + * Sample code: Get sensitivity settings list. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSensitivitySettingsList(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sensitivitySettings().listWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### CustomEntityStoreAssignments_GetByResourceGroup + +```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); + } +} +``` + +### CustomEntityStoreAssignments_List + +```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(); + } +} +``` + +### CustomEntityStoreAssignments_ListByResourceGroup + +```java +/** + * Samples for AzureDevOpsProjects List. + */ +public final class AzureDevOpsProjectsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListAzureDevOpsProjects_example.json + */ + /** + * Sample code: List_AzureDevOpsProjects. + * + * @param manager Entry point to SecurityManager. + */ + public static void listAzureDevOpsProjects(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsProjects() + .list("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", com.azure.core.util.Context.NONE); + } +} +``` + +### CustomRecommendations_CreateOrUpdate + +```java +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; + +/** + * Samples for GovernanceAssignments CreateOrUpdate. + */ +public final class GovernanceAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/PutGovernanceAssignment_example.json + */ + /** + * Sample code: Create Governance assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void createGovernanceAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceAssignments() + .define("6634ff9f-127b-4bf2-8e6e-b1737f5e789c") + .withExistingAssessment( + "subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", + "6b9421dd-5555-2251-9b3d-2be58e2f82cd") + .withOwner("user@contoso.com") + .withRemediationDueDate(OffsetDateTime.parse("2022-01-07T13:00:00.0000000Z")) + .withRemediationEta(new RemediationEta().withEta(OffsetDateTime.parse("2022-01-08T13:00:00.0000000Z")) + .withJustification("Justification of ETA")) + .withIsGracePeriod(true) + .withGovernanceEmailNotification( + new GovernanceEmailNotification().withDisableManagerEmailNotification(false) + .withDisableOwnerEmailNotification(false)) + .withAdditionalData(new GovernanceAssignmentAdditionalData().withTicketNumber(123123) + .withTicketLink("https://snow.com") + .withTicketStatus("Active")) + .create(); + } +} +``` + +### CustomRecommendations_Delete + +```java +/** + * Samples for GitHubOwners Get. + */ +public final class GitHubOwnersGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetGitHubOwners_example.json + */ + /** + * Sample code: Get_GitHubOwners. + * + * @param manager Entry point to SecurityManager. + */ + public static void getGitHubOwners(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitHubOwners() + .getWithResponse("myRg", "mySecurityConnectorName", "myGitHubOwner", com.azure.core.util.Context.NONE); + } +} +``` + +### CustomRecommendations_Get + +```java +import com.azure.resourcemanager.security.models.MinimalRiskLevel; +import com.azure.resourcemanager.security.models.MinimalSeverity; +import com.azure.resourcemanager.security.models.NotificationsSourceAlert; +import com.azure.resourcemanager.security.models.NotificationsSourceAttackPath; +import com.azure.resourcemanager.security.models.SecurityContactName; +import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole; +import com.azure.resourcemanager.security.models.SecurityContactRole; +import com.azure.resourcemanager.security.models.State; +import java.util.Arrays; + +/** + * Samples for SecurityContacts Create. + */ +public final class SecurityContactsCreateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * CreateSecurityContact_example.json + */ + /** + * Sample code: Create security contact data. + * + * @param manager Entry point to SecurityManager. + */ + public static void createSecurityContactData(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityContacts() + .define(SecurityContactName.DEFAULT) + .withEmails("john@contoso.com;jane@contoso.com") + .withPhone("(214)275-4038") + .withIsEnabled(true) + .withNotificationsSources( + Arrays.asList(new NotificationsSourceAttackPath().withMinimalRiskLevel(MinimalRiskLevel.CRITICAL), + new NotificationsSourceAlert().withMinimalSeverity(MinimalSeverity.MEDIUM))) + .withNotificationsByRole( + new SecurityContactPropertiesNotificationsByRole().withState(State.fromString("On")) + .withRoles(Arrays.asList(SecurityContactRole.OWNER))) + .create(); + } +} +``` + +### CustomRecommendations_List + +```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); + } +} +``` + +### DefenderForStorage_CancelMalwareScan + +```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); + } +} +``` + +### DefenderForStorage_Create + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-10-01-preview/examples/Operations/ + * ListOperations_example.json + */ + /** + * Sample code: List the operations for the Microsoft.Security (Microsoft Defender for Cloud) resource provider. + * + * @param manager Entry point to SecurityManager. + */ + public static void listTheOperationsForTheMicrosoftSecurityMicrosoftDefenderForCloudResourceProvider( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DefenderForStorage_Get + +```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); + } +} +``` + +### DefenderForStorage_GetMalwareScan + +```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); + } +} +``` + +### DefenderForStorage_StartMalwareScan + +```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); + } +} +``` + +### DevOpsConfigurations_CreateOrUpdate + +```java +import com.azure.resourcemanager.security.models.SeverityEnum; +import com.azure.resourcemanager.security.models.SupportedCloudEnum; + +/** + * Samples for CustomAssessmentAutomations Create. + */ +public final class CustomAssessmentAutomationsCreateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationCreate_example.json + */ + /** + * Sample code: Create a Custom Assessment Automation. + * + * @param manager Entry point to SecurityManager. + */ + public static void createACustomAssessmentAutomation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customAssessmentAutomations() + .define("MyCustomAssessmentAutomation") + .withExistingResourceGroup("TestResourceGroup") + .withCompressedQuery( + "DQAKAEkAYQBtAF8ARwByAG8AdQBwAA0ACgB8ACAAZQB4AHQAZQBuAGQAIABIAGUAYQBsAHQAaABTAHQAYQB0AHUAcwAgAD0AIABpAGYAZgAoAHQAbwBzAHQAcgBpAG4AZwAoAFIAZQBjAG8AcgBkAC4AVQBzAGUAcgBOAGEAbQBlACkAIABjAG8AbgB0AGEAaQBuAHMAIAAnAHUAcwBlAHIAJwAsACAAJwBVAE4ASABFAEEATABUAEgAWQAnACwAIAAnAEgARQBBAEwAVABIAFkAJwApAA0ACgA=") + .withSupportedCloud(SupportedCloudEnum.AWS) + .withSeverity(SeverityEnum.MEDIUM) + .withDisplayName("Password Policy") + .withDescription("Data should be encrypted") + .withRemediationDescription("Encrypt store by...") + .create(); + } +} +``` + +### DevOpsConfigurations_Delete + +```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(); + } +} +``` + +### DevOpsConfigurations_Get + +```java +/** + * Samples for Connectors Delete. + */ +public final class ConnectorsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * DeleteConnectorSubscription_example.json + */ + /** + * Sample code: Delete a cloud account connector from a subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteACloudAccountConnectorFromASubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.connectors().deleteWithResponse("aws_dev1", com.azure.core.util.Context.NONE); + } +} +``` + +### DevOpsConfigurations_List + +```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); + } +} +``` + +### DevOpsConfigurations_Update + +```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); + } +} +``` + +### DevOpsOperationResults_Get + +```java +/** + * Samples for CustomEntityStoreAssignments Delete. + */ +public final class CustomEntityStoreAssignmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentDelete_example.json + */ + /** + * Sample code: Delete a custom entity store assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteACustomEntityStoreAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customEntityStoreAssignments() + .deleteByResourceGroupWithResponse("TestResourceGroup", "33e7cc6e-a139-4723-a0e5-76993aee0771", + com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceSecurityGroups_CreateOrUpdate + +```java +/** + * Samples for HealthReports List. + */ +public final class HealthReportsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/ + * ListHealthReports_example.json + */ + /** + * Sample code: List health reports. + * + * @param manager Entry point to SecurityManager. + */ + public static void listHealthReports(com.azure.resourcemanager.security.SecurityManager manager) { + manager.healthReports() + .list("subscriptions/a1efb6ca-fbc5-4782-9aaa-5c7daded1ce2", com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceSecurityGroups_Delete + +```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); + } +} +``` + +### DeviceSecurityGroups_Get + +```java +/** + * Samples for GovernanceRules OperationResults. + */ +public final class GovernanceRulesOperationResultsSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetManagementGroupGovernanceRuleExecuteStatus_example.json + */ + /** + * Sample code: Get governance rules long run operation result over management group. + * + * @param manager Entry point to SecurityManager. + */ + public static void getGovernanceRulesLongRunOperationResultOverManagementGroup( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .operationResultsWithResponse("providers/Microsoft.Management/managementGroups/contoso", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", "58b33f4f-c8c7-4b01-99cc-d437db4d40dd", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetSecurityConnectorGovernanceRuleExecuteStatus_example.json + */ + /** + * Sample code: Get governance rules long run operation result over security connector. + * + * @param manager Entry point to SecurityManager. + */ + public static void getGovernanceRulesLongRunOperationResultOverSecurityConnector( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .operationResultsWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", "58b33f4f-c8c7-4b01-99cc-d437db4d40dd", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetGovernanceRuleExecuteStatus_example.json + */ + /** + * Sample code: Get governance rules long run operation result over subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void getGovernanceRulesLongRunOperationResultOverSubscription( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .operationResultsWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", "58b33f4f-c8c7-4b01-99cc-d437db4d40dd", + com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceSecurityGroups_List + +```java +import java.util.Arrays; + +/** + * Samples for SqlVulnerabilityAssessmentBaselineRules CreateOrUpdate. + */ +public final class SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_PutLatest.json + */ + /** + * Sample code: Create a baseline using the latest scan results. + * + * @param manager Entry point to SecurityManager. + */ + public static void + createABaselineUsingTheLatestScanResults(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentBaselineRules() + .define("VA1234") + .withExistingResourceId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master") + .withLatestScan(true) + .withResults(Arrays.asList()) + .withWorkspaceId("55555555-6666-7777-8888-999999999999") + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Put.json + */ + /** + * Sample code: Create a baseline. + * + * @param manager Entry point to SecurityManager. + */ + public static void createABaseline(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentBaselineRules() + .define("VA1234") + .withExistingResourceId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master") + .withLatestScan(false) + .withResults(Arrays.asList(Arrays.asList("userA", "SELECT"), Arrays.asList("userB", "SELECT"))) + .withWorkspaceId("55555555-6666-7777-8888-999999999999") + .create(); + } +} +``` + +### DiscoveredSecuritySolutions_Get + +```java +/** + * Samples for RegulatoryComplianceAssessments Get. + */ +public final class RegulatoryComplianceAssessmentsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceAssessment_example.json + */ + /** + * Sample code: Get selected regulatory compliance assessment details and state. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSelectedRegulatoryComplianceAssessmentDetailsAndState( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.regulatoryComplianceAssessments() + .getWithResponse("PCI-DSS-3.2", "1.1", "968548cb-02b3-8cd2-11f8-0cf64ab1a347", + com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredSecuritySolutions_List + +```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); + } +} +``` + +### DiscoveredSecuritySolutions_ListByHomeRegion + +```java +import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; + +/** + * Samples for DefenderForStorage CancelMalwareScan. + */ +public final class DefenderForStorageCancelMalwareScanSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-01-01/examples/DefenderForStorage/ + * CancelMalwareScan_example.json + */ + /** + * Sample code: Cancel a Defender for Storage malware scan for the specified storage resource. + * + * @param manager Entry point to SecurityManager. + */ + public static void cancelADefenderForStorageMalwareScanForTheSpecifiedStorageResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.defenderForStorages() + .cancelMalwareScanWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + SettingNameAutoGenerated.CURRENT, "latest", com.azure.core.util.Context.NONE); + } +} +``` + +### ExternalSecuritySolutions_Get + +```java +import com.azure.resourcemanager.security.models.ActionableRemediation; +import com.azure.resourcemanager.security.models.ActionableRemediationState; +import com.azure.resourcemanager.security.models.AzureDevOpsRepositoryProperties; +import com.azure.resourcemanager.security.models.OnboardingState; + +/** + * Samples for AzureDevOpsRepos CreateOrUpdate. + */ +public final class AzureDevOpsReposCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * CreateOrUpdateAzureDevOpsRepos_example.json + */ + /** + * Sample code: CreateOrUpdate_AzureDevOpsRepos. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateAzureDevOpsRepos(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsRepos() + .define("myAzDevOpsRepo") + .withExistingProject("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject") + .withProperties(new AzureDevOpsRepositoryProperties().withOnboardingState(OnboardingState.NOT_APPLICABLE) + .withActionableRemediation(new ActionableRemediation().withState(ActionableRemediationState.ENABLED))) + .create(); + } +} +``` + +### ExternalSecuritySolutions_List + +```java +/** + * Samples for GitHubOwners ListAvailable. + */ +public final class GitHubOwnersListAvailableSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListAvailableGitHubOwners_example.json + */ + /** + * Sample code: ListAvailable_GitHubOwners. + * + * @param manager Entry point to SecurityManager. + */ + public static void listAvailableGitHubOwners(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitHubOwners() + .listAvailableWithResponse("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } +} +``` + +### ExternalSecuritySolutions_ListByHomeRegion + +```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); + } +} +``` + +### GitHubOwners_Get + +```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); + } +} +``` + +### GitHubOwners_List + +```java +import com.azure.resourcemanager.security.models.ActionableRemediation; +import com.azure.resourcemanager.security.models.ActionableRemediationState; +import com.azure.resourcemanager.security.models.AzureDevOpsOrgProperties; +import com.azure.resourcemanager.security.models.OnboardingState; + +/** + * Samples for AzureDevOpsOrgs CreateOrUpdate. + */ +public final class AzureDevOpsOrgsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * CreateOrUpdateAzureDevOpsOrgs_example.json + */ + /** + * Sample code: CreateOrUpdate_AzureDevOpsOrgs. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateAzureDevOpsOrgs(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsOrgs() + .define("myAzDevOpsOrg") + .withExistingSecurityConnector("myRg", "mySecurityConnectorName") + .withProperties(new AzureDevOpsOrgProperties().withOnboardingState(OnboardingState.NOT_APPLICABLE) + .withActionableRemediation(new ActionableRemediation().withState(ActionableRemediationState.ENABLED))) + .create(); + } +} +``` + +### GitHubOwners_ListAvailable + +```java +/** + * Samples for GitLabGroups ListAvailable. + */ +public final class GitLabGroupsListAvailableSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListAvailableGitLabGroups_example.json + */ + /** + * Sample code: ListAvailable_GitLabGroups. + * + * @param manager Entry point to SecurityManager. + */ + public static void listAvailableGitLabGroups(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitLabGroups() + .listAvailableWithResponse("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } +} +``` + +### GitHubRepos_Get + +```java +/** + * Samples for Compliances Get. + */ +public final class CompliancesGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/ + * GetCompliance_example.json + */ + /** + * Sample code: Get security compliance data for a day. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSecurityComplianceDataForADay(com.azure.resourcemanager.security.SecurityManager manager) { + manager.compliances() + .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "2018-01-01Z", + com.azure.core.util.Context.NONE); + } +} +``` + +### GitHubRepos_List + +```java +/** + * Samples for WorkspaceSettings List. + */ +public final class WorkspaceSettingsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * GetWorkspaceSettings_example.json + */ + /** + * Sample code: Get workspace settings on subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void getWorkspaceSettingsOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.workspaceSettings().list(com.azure.core.util.Context.NONE); + } +} +``` + +### GitLabGroups_Get + +```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); + } +} +``` + +### GitLabGroups_List + +```java +/** + * Samples for SqlVulnerabilityAssessmentBaselineRules Delete. + */ +public final class SqlVulnerabilityAssessmentBaselineRulesDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Delete.json + */ + /** + * Sample code: Delete the baseline. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteTheBaseline(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentBaselineRules() + .deleteWithResponse("VA1234", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + com.azure.core.util.Context.NONE); + } +} +``` + +### GitLabGroups_ListAvailable + +```java +/** + * Samples for AzureDevOpsRepos Get. + */ +public final class AzureDevOpsReposGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetAzureDevOpsRepos_example.json + */ + /** + * Sample code: Get_AzureDevOpsRepos. + * + * @param manager Entry point to SecurityManager. + */ + public static void getAzureDevOpsRepos(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsRepos() + .getWithResponse("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", "myAzDevOpsRepo", + com.azure.core.util.Context.NONE); + } +} +``` + +### GitLabProjects_Get + +```java +/** + * Samples for GitHubRepos Get. + */ +public final class GitHubReposGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetGitHubRepos_example.json + */ + /** + * Sample code: Get_GitHubRepos. + * + * @param manager Entry point to SecurityManager. + */ + public static void getGitHubRepos(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitHubRepos() + .getWithResponse("myRg", "mySecurityConnectorName", "myGitHubOwner", "myGitHubRepo", + com.azure.core.util.Context.NONE); + } +} +``` + +### GitLabProjects_List + +```java +/** + * Samples for DevOpsConfigurations List. + */ +public final class DevOpsConfigurationsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListDevOpsConfigurations_example.json + */ + /** + * Sample code: List_DevOpsConfigurations. + * + * @param manager Entry point to SecurityManager. + */ + public static void listDevOpsConfigurations(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations().list("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } +} +``` + +### GitLabSubgroups_List + +```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); + } +} +``` + +### GovernanceAssignments_CreateOrUpdate + +```java +/** + * Samples for GovernanceAssignments Delete. + */ +public final class GovernanceAssignmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/DeleteGovernanceAssignment_example.json + */ + /** + * Sample code: Delete security assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteSecurityAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceAssignments() + .deleteWithResponse( + "subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd/resourceGroups/compute_servers/providers/Microsoft.Compute/virtualMachines/win2012", + "6b9421dd-5555-2251-9b3d-2be58e2f82cd", "6634ff9f-127b-4bf2-8e6e-b1737f5e789c", + com.azure.core.util.Context.NONE); + } +} +``` + +### GovernanceAssignments_Delete + +```java +/** + * Samples for Locations Get. + */ +public final class LocationsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/ + * GetLocation_example.json + */ + /** + * Sample code: Get security data location. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSecurityDataLocation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.locations().getWithResponse("centralus", com.azure.core.util.Context.NONE); + } +} +``` + +### GovernanceAssignments_Get + +```java +/** + * Samples for DevOpsConfigurations Get. + */ +public final class DevOpsConfigurationsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetDevOpsConfigurationsWithAgentlessConfigurations_example.json + */ + /** + * Sample code: Get_DevOpsConfigurations_WithAgentlessConfigurations. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getDevOpsConfigurationsWithAgentlessConfigurations(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .getWithResponse("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetDevOpsConfigurationsWithCapabilities_example.json + */ + /** + * Sample code: Get_DevOpsConfigurations_WithCapabilities. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getDevOpsConfigurationsWithCapabilities(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .getWithResponse("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetDevOpsConfigurations_example.json + */ + /** + * Sample code: Get_DevOpsConfigurations. + * + * @param manager Entry point to SecurityManager. + */ + public static void getDevOpsConfigurations(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations() + .getWithResponse("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } +} +``` + +### GovernanceAssignments_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); + } +} +``` + +### GovernanceRules_CreateOrUpdate + +```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); + } +} +``` + +### GovernanceRules_Delete + +```java +/** + * Samples for CustomEntityStoreAssignments GetByResourceGroup. + */ +public final class CustomEntityStoreAssignmentsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentGet_example.json + */ + /** + * Sample code: Get a custom entity store assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void getACustomEntityStoreAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customEntityStoreAssignments() + .getByResourceGroupWithResponse("TestResourceGroup", "33e7cc6e-a139-4723-a0e5-76993aee0771", + com.azure.core.util.Context.NONE); + } +} +``` + +### GovernanceRules_Execute + +```java +import com.azure.resourcemanager.security.models.AutoProvision; + +/** + * Samples for AutoProvisioningSettings Create. + */ +public final class AutoProvisioningSettingsCreateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * AutoProvisioningSettings/CreateAutoProvisioningSettingsSubscription_example.json + */ + /** + * Sample code: Create auto provisioning settings for subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void + createAutoProvisioningSettingsForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.autoProvisioningSettings().define("default").withAutoProvision(AutoProvision.ON).create(); + } +} +``` + +### GovernanceRules_Get + +```java +/** + * Samples for GitLabGroups List. + */ +public final class GitLabGroupsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListGitLabGroups_example.json + */ + /** + * Sample code: List_GitLabGroups. + * + * @param manager Entry point to SecurityManager. + */ + public static void listGitLabGroups(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitLabGroups().list("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } +} +``` + +### GovernanceRules_List + +```java +import com.azure.resourcemanager.security.models.SecurityContactName; + +/** + * Samples for SecurityContacts Get. + */ +public final class SecurityContactsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * GetSecurityContact_example.json + */ + /** + * Sample code: Get a security contact. + * + * @param manager Entry point to SecurityManager. + */ + public static void getASecurityContact(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityContacts().getWithResponse(SecurityContactName.DEFAULT, com.azure.core.util.Context.NONE); + } +} +``` + +### GovernanceRules_OperationResults + +```java +/** + * Samples for CustomAssessmentAutomations List. + */ +public final class CustomAssessmentAutomationsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationListBySubscription_example.json + */ + /** + * Sample code: List Custom Assessment Automations in a subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listCustomAssessmentAutomationsInASubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customAssessmentAutomations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### HealthReports_Get + +```java +/** + * Samples for Applications List. + */ +public final class ApplicationsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * ListBySubscriptionApplications_example.json + */ + /** + * Sample code: List applications security by subscription level scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listApplicationsSecurityBySubscriptionLevelScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.applications().list(com.azure.core.util.Context.NONE); + } +} +``` + +### HealthReports_List + +```java +/** + * Samples for Automations ListByResourceGroup. + */ +public final class AutomationsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * GetAutomationsResourceGroup_example.json + */ + /** + * Sample code: List all security automations of a specified resource group. + * + * @param manager Entry point to SecurityManager. + */ + public static void listAllSecurityAutomationsOfASpecifiedResourceGroup( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations().listByResourceGroup("exampleResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### InformationProtectionPolicies_CreateOrUpdate + +```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); + } +} +``` + +### InformationProtectionPolicies_Get + +```java +import com.azure.resourcemanager.security.models.DefenderForStorageSettingProperties; +import com.azure.resourcemanager.security.models.MalwareScanningProperties; +import com.azure.resourcemanager.security.models.OnUploadProperties; +import com.azure.resourcemanager.security.models.SensitiveDataDiscoveryProperties; +import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; + +/** + * Samples for DefenderForStorage Create. + */ +public final class DefenderForStorageCreateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-01-01/examples/DefenderForStorage/ + * PutDefenderForStorageSettings_example.json + */ + /** + * Sample code: Creates or updates the Defender for Storage settings on a specified resource. + * + * @param manager Entry point to SecurityManager. + */ + public static void createsOrUpdatesTheDefenderForStorageSettingsOnASpecifiedResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.defenderForStorages() + .define(SettingNameAutoGenerated.CURRENT) + .withExistingResourceId( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount") + .withProperties(new DefenderForStorageSettingProperties().withIsEnabled(true) + .withMalwareScanning(new MalwareScanningProperties() + .withOnUpload(new OnUploadProperties().withIsEnabled(true).withCapGBPerMonth(-1)) + .withScanResultsEventGridTopicResourceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic")) + .withSensitiveDataDiscovery(new SensitiveDataDiscoveryProperties().withIsEnabled(true)) + .withOverrideSubscriptionLevelSettings(true)) + .create(); + } +} +``` + +### InformationProtectionPolicies_List + +```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); + } +} +``` + ### 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; +```java +/** + * Samples for SecurityOperators List. + */ +public final class SecurityOperatorsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * ListSecurityOperators_example.json + */ + /** + * Sample code: List SecurityOperators. + * + * @param manager Entry point to SecurityManager. + */ + public static void listSecurityOperators(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityOperators().listWithResponse("CloudPosture", com.azure.core.util.Context.NONE); + } +} +``` + +### IotSecuritySolution_Delete + +```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); + } +} +``` + +### IotSecuritySolution_GetByResourceGroup + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.security.models.GovernanceRuleEmailNotification; +import com.azure.resourcemanager.security.models.GovernanceRuleOwnerSource; +import com.azure.resourcemanager.security.models.GovernanceRuleOwnerSourceType; +import com.azure.resourcemanager.security.models.GovernanceRuleSourceResourceType; +import com.azure.resourcemanager.security.models.GovernanceRuleType; +import java.io.IOException; +import java.util.Arrays; + +/** + * Samples for GovernanceRules CreateOrUpdate. + */ +public final class GovernanceRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PutManagementGroupGovernanceRule_example.json + */ + /** + * Sample code: Create or update governance rule over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateGovernanceRuleOverManagementGroupScope( + com.azure.resourcemanager.security.SecurityManager manager) throws IOException { + manager.governanceRules() + .define("ad9a8e26-29d9-4829-bb30-e597a58cdbb8") + .withExistingScope("providers/Microsoft.Management/managementGroups/contoso") + .withDisplayName("Management group rule") + .withDescription("A rule for a management group") + .withRemediationTimeframe("7.00:00:00") + .withIsGracePeriod(true) + .withRulePriority(200) + .withIsDisabled(false) + .withRuleType(GovernanceRuleType.INTEGRATED) + .withSourceResourceType(GovernanceRuleSourceResourceType.ASSESSMENTS) + .withExcludedScopes(Arrays.asList("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23")) + .withConditionSets(Arrays.asList(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"conditions\":[{\"operator\":\"In\",\"property\":\"$.AssessmentKey\",\"value\":\"[\\\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\\\", \\\"fe83f80b-073d-4ccf-93d9-6797eb870201\\\"]\"}]}", + Object.class, SerializerEncoding.JSON))) + .withOwnerSource(new GovernanceRuleOwnerSource().withType(GovernanceRuleOwnerSourceType.MANUALLY) + .withValue("user@contoso.com")) + .withGovernanceEmailNotification( + new GovernanceRuleEmailNotification().withDisableManagerEmailNotification(true) + .withDisableOwnerEmailNotification(false)) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PutSecurityConnectorGovernanceRule_example.json + */ + /** + * Sample code: Create or update governance rule over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateGovernanceRuleOverSecurityConnectorScope( + com.azure.resourcemanager.security.SecurityManager manager) throws IOException { + manager.governanceRules() + .define("ad9a8e26-29d9-4829-bb30-e597a58cdbb8") + .withExistingScope( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector") + .withDisplayName("GCP Admin's rule") + .withDescription("A rule on critical GCP recommendations") + .withRemediationTimeframe("7.00:00:00") + .withIsGracePeriod(true) + .withRulePriority(200) + .withIsDisabled(false) + .withRuleType(GovernanceRuleType.INTEGRATED) + .withSourceResourceType(GovernanceRuleSourceResourceType.ASSESSMENTS) + .withConditionSets(Arrays.asList(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"conditions\":[{\"operator\":\"In\",\"property\":\"$.AssessmentKey\",\"value\":\"[\\\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\\\", \\\"fe83f80b-073d-4ccf-93d9-6797eb870201\\\"]\"}]}", + Object.class, SerializerEncoding.JSON))) + .withOwnerSource(new GovernanceRuleOwnerSource().withType(GovernanceRuleOwnerSourceType.MANUALLY) + .withValue("user@contoso.com")) + .withGovernanceEmailNotification( + new GovernanceRuleEmailNotification().withDisableManagerEmailNotification(true) + .withDisableOwnerEmailNotification(false)) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PutGovernanceRule_example.json + */ + /** + * Sample code: Create or update governance rule over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateGovernanceRuleOverSubscriptionScope( + com.azure.resourcemanager.security.SecurityManager manager) throws IOException { + manager.governanceRules() + .define("ad9a8e26-29d9-4829-bb30-e597a58cdbb8") + .withExistingScope("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23") + .withDisplayName("Admin's rule") + .withDescription("A rule for critical recommendations") + .withRemediationTimeframe("7.00:00:00") + .withIsGracePeriod(true) + .withRulePriority(200) + .withIsDisabled(false) + .withRuleType(GovernanceRuleType.INTEGRATED) + .withSourceResourceType(GovernanceRuleSourceResourceType.ASSESSMENTS) + .withConditionSets(Arrays.asList(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"conditions\":[{\"operator\":\"In\",\"property\":\"$.AssessmentKey\",\"value\":\"[\\\"b1cd27e0-4ecc-4246-939f-49c426d9d72f\\\", \\\"fe83f80b-073d-4ccf-93d9-6797eb870201\\\"]\"}]}", + Object.class, SerializerEncoding.JSON))) + .withOwnerSource(new GovernanceRuleOwnerSource().withType(GovernanceRuleOwnerSourceType.MANUALLY) + .withValue("user@contoso.com")) + .withGovernanceEmailNotification( + new GovernanceRuleEmailNotification().withDisableManagerEmailNotification(false) + .withDisableOwnerEmailNotification(false)) + .create(); + } +} +``` + +### IotSecuritySolution_List + +```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); + } +} +``` + +### IotSecuritySolution_ListByResourceGroup + +```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); + } +} +``` + +### IotSecuritySolution_Update + +```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); + } +} +``` + +### IotSecuritySolutionAnalytics_Get + +```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); + } +} +``` + +### IotSecuritySolutionAnalytics_List + +```java +/** + * Samples for SqlVulnerabilityAssessmentScanResults List. + */ +public final class SqlVulnerabilityAssessmentScanResultsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_ListLatest.json + */ + /** + * Sample code: List scan results of the latest scan. + * + * @param manager Entry point to SecurityManager. + */ + public static void listScanResultsOfTheLatestScan(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentScanResults() + .listWithResponse("latest", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_List.json + */ + /** + * Sample code: List scan results. + * + * @param manager Entry point to SecurityManager. + */ + public static void listScanResults(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentScanResults() + .listWithResponse("Scheduled-20200623", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + com.azure.core.util.Context.NONE); + } +} +``` + +### IotSecuritySolutionsAnalyticsAggregatedAlert_Dismiss + +```java +/** + * Samples for Tasks GetResourceGroupLevelTask. + */ +public final class TasksGetResourceGroupLevelTaskSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTaskResourceGroupLocation_example.json + */ + /** + * Sample code: Get security recommendation task in a resource group. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getSecurityRecommendationTaskInAResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { + manager.tasks() + .getResourceGroupLevelTaskWithResponse("myRg", "westeurope", "d55b4dc0-779c-c66c-33e5-d7bce24c4222", + com.azure.core.util.Context.NONE); + } +} +``` + +### IotSecuritySolutionsAnalyticsAggregatedAlert_Get + +```java +/** + * Samples for AzureDevOpsProjects Get. + */ +public final class AzureDevOpsProjectsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetAzureDevOpsProjects_example.json + */ + /** + * Sample code: Get_AzureDevOpsProjects. + * + * @param manager Entry point to SecurityManager. + */ + public static void getAzureDevOpsProjects(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsProjects() + .getWithResponse("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", + com.azure.core.util.Context.NONE); + } +} +``` + +### IotSecuritySolutionsAnalyticsAggregatedAlert_List + +```java +/** + * Samples for SqlVulnerabilityAssessmentScanResults Get. + */ +public final class SqlVulnerabilityAssessmentScanResultsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_Get.json + */ + /** + * Sample code: Get scan details of a scan record. + * + * @param manager Entry point to SecurityManager. + */ + public static void getScanDetailsOfAScanRecord(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentScanResults() + .getWithResponse("Scheduled-20200623", "VA2063", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_GetLatest.json + */ + /** + * Sample code: Get scan details of the latest scan record. + * + * @param manager Entry point to SecurityManager. + */ + public static void getScanDetailsOfTheLatestScanRecord(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentScanResults() + .getWithResponse("latest", "VA2063", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + com.azure.core.util.Context.NONE); + } +} +``` + +### IotSecuritySolutionsAnalyticsRecommendation_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); + } +} +``` + +### IotSecuritySolutionsAnalyticsRecommendation_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); + } +} +``` + +### JitNetworkAccessPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.security.models.InformationProtectionPolicyName; + +/** + * Samples for InformationProtectionPolicies Get. + */ +public final class InformationProtectionPoliciesGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/GetCustomInformationProtectionPolicy_example.json + */ + /** + * Sample code: Get the customized information protection policy for a management group. + * + * @param manager Entry point to SecurityManager. + */ + public static void getTheCustomizedInformationProtectionPolicyForAManagementGroup( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.informationProtectionPolicies() + .getWithResponse("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + InformationProtectionPolicyName.CUSTOM, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/GetEffectiveInformationProtectionPolicy_example.json + */ + /** + * Sample code: Get the effective information protection policy for a management group. + * + * @param manager Entry point to SecurityManager. + */ + public static void getTheEffectiveInformationProtectionPolicyForAManagementGroup( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.informationProtectionPolicies() + .getWithResponse("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + InformationProtectionPolicyName.EFFECTIVE, com.azure.core.util.Context.NONE); + } +} +``` + +### JitNetworkAccessPolicies_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); + } +} +``` + +### JitNetworkAccessPolicies_Get + +```java +/** + * Samples for ApplicationOperation Get. + */ +public final class ApplicationOperationGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * GetApplication_example.json + */ + /** + * Sample code: Get security application by specific applicationId. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getSecurityApplicationBySpecificApplicationId(com.azure.resourcemanager.security.SecurityManager manager) { + manager.applicationOperations() + .getWithResponse("ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } +} +``` + +### JitNetworkAccessPolicies_Initiate + +```java +/** + * Samples for CustomEntityStoreAssignments ListByResourceGroup. + */ +public final class CustomEntityStoreAssignmentsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentListByResourceGroup_example.json + */ + /** + * Sample code: List custom entity store assignments in a subscription and a resource group. + * + * @param manager Entry point to SecurityManager. + */ + public static void listCustomEntityStoreAssignmentsInASubscriptionAndAResourceGroup( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.customEntityStoreAssignments() + .listByResourceGroup("TestResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### JitNetworkAccessPolicies_List + +```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; + } +} +``` + +### JitNetworkAccessPolicies_ListByRegion + +```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); + } +} +``` + +### JitNetworkAccessPolicies_ListByResourceGroup + +```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); + } +} +``` + +### JitNetworkAccessPolicies_ListByResourceGroupAndRegion + +```java +import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; + +/** + * Samples for DefenderForStorage Get. + */ +public final class DefenderForStorageGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-01-01/examples/DefenderForStorage/ + * GetDefenderForStorageSettings_example.json + */ + /** + * Sample code: Gets the Defender for Storage settings for the specified resource. + * + * @param manager Entry point to SecurityManager. + */ + public static void getsTheDefenderForStorageSettingsForTheSpecifiedResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.defenderForStorages() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + SettingNameAutoGenerated.CURRENT, com.azure.core.util.Context.NONE); + } +} +``` + +### Locations_Get + +```java +/** + * Samples for CustomEntityStoreAssignments List. + */ +public final class CustomEntityStoreAssignmentsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentListBySubscription_example.json + */ + /** + * Sample code: List custom entity store assignments in a subscription. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listCustomEntityStoreAssignmentsInASubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customEntityStoreAssignments().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Locations_List + +```java +/** + * Samples for DevOpsConfigurations Delete. + */ +public final class DevOpsConfigurationsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * DeleteDevOpsConfigurations_example.json + */ + /** + * Sample code: Delete_DevOpsConfigurations. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteDevOpsConfigurations(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsConfigurations().delete("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); + } +} +``` + +### MdeOnboardings_Get + +```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); + } +} +``` + +### MdeOnboardings_List + +```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); + } +} +``` + +### Operations_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); + } +} +``` + +### Pricings_Delete + +```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); + } +} +``` + +### Pricings_Get + +```java +/** + * Samples for SecurityConnectorApplicationOperation Get. + */ +public final class SecurityConnectorApplicationOperationGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * GetSecurityConnectorApplication_example.json + */ + /** + * Sample code: Get security applications by specific applicationId. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getSecurityApplicationsBySpecificApplicationId(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectorApplicationOperations() + .getWithResponse("gcpResourceGroup", "gcpconnector", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + com.azure.core.util.Context.NONE); + } +} +``` + +### Pricings_List + +```java +/** + * Samples for MdeOnboardings List. + */ +public final class MdeOnboardingsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/ + * ListMdeOnboardings_example.json + */ + /** + * Sample code: The configuration or data needed to onboard the machine to MDE. + * + * @param manager Entry point to SecurityManager. + */ + public static void theConfigurationOrDataNeededToOnboardTheMachineToMDE( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.mdeOnboardings().listWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### Pricings_Update + +```java +import com.azure.resourcemanager.security.models.ActionableRemediation; +import com.azure.resourcemanager.security.models.ActionableRemediationState; +import com.azure.resourcemanager.security.models.AzureDevOpsProjectProperties; +import com.azure.resourcemanager.security.models.OnboardingState; + +/** + * Samples for AzureDevOpsProjects CreateOrUpdate. + */ +public final class AzureDevOpsProjectsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * CreateOrUpdateAzureDevOpsProjects_example.json + */ + /** + * Sample code: CreateOrUpdate_AzureDevOpsProjects. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateAzureDevOpsProjects(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsProjects() + .define("myAzDevOpsProject") + .withExistingAzureDevOpsOrg("myRg", "mySecurityConnectorName", "myAzDevOpsOrg") + .withProperties(new AzureDevOpsProjectProperties().withOnboardingState(OnboardingState.NOT_APPLICABLE) + .withActionableRemediation(new ActionableRemediation().withState(ActionableRemediationState.ENABLED))) + .create(); + } +} +``` + +### RegulatoryComplianceAssessments_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); + } +} +``` + +### RegulatoryComplianceAssessments_List + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.security.models.ParametersSchema; +import java.io.IOException; +import java.util.Arrays; + +/** + * Samples for ResourceProvider View. + */ +public final class ResourceProviderViewSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2025-05-01-preview/examples/View_example.json + */ + /** + * Sample code: View example. + * + * @param manager Entry point to SecurityManager. + */ + public static void viewExample(com.azure.resourcemanager.security.SecurityManager manager) throws IOException { + manager.resourceProviders() + .viewWithResponse(new ParametersSchema().withScopes(Arrays.asList( + "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6", + "/subscriptions/8e22af33-2b2b-4f43-be9a-82aae2f0c2b5/resourcegroups/cus-test-platform/providers/Microsoft.Security/securityConnectors/TestNotifications")) + .withScenarioName("secureScopre/cloudInitiativeMetrics") + .withScenarioParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"startDateTime\":\"2025-05-06T07:06:02.280Z\"}", Object.class, + SerializerEncoding.JSON)), + com.azure.core.util.Context.NONE); + } +} +``` + +### RegulatoryComplianceControls_Get + +```java +/** + * Samples for SecurityConnectorApplications List. + */ +public final class SecurityConnectorApplicationsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * ListBySecurityConnectorApplications_example.json + */ + /** + * Sample code: List security applications by security connector level scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void listSecurityApplicationsBySecurityConnectorLevelScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectorApplications() + .list("gcpResourceGroup", "gcpconnector", com.azure.core.util.Context.NONE); + } +} +``` + +### RegulatoryComplianceControls_List + +```java +/** + * Samples for SqlVulnerabilityAssessmentScans List. + */ +public final class SqlVulnerabilityAssessmentScansListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_List.json + */ + /** + * Sample code: List scan details. + * + * @param manager Entry point to SecurityManager. + */ + public static void listScanDetails(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentScans() + .listWithResponse("55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + com.azure.core.util.Context.NONE); + } +} +``` + +### RegulatoryComplianceStandards_Get + +```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); + } +} +``` + +### RegulatoryComplianceStandards_List + +```java +/** + * Samples for GitLabSubgroups List. + */ +public final class GitLabSubgroupsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListGitLabSubgroups_example.json + */ + /** + * Sample code: List_GitLabSubgroups. + * + * @param manager Entry point to SecurityManager. + */ + public static void listGitLabSubgroups(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitLabSubgroups() + .listWithResponse("myRg", "mySecurityConnectorName", "myGitLabGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_View + +```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); + } +} +``` + +### SecureScoreControlDefinitions_List + +```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); + } +} +``` + +### SecureScoreControlDefinitions_ListBySubscription + +```java +/** + * Samples for DevOpsOperationResults Get. + */ +public final class DevOpsOperationResultsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetDevOpsOperationResultsFailed_example.json + */ + /** + * Sample code: Get_DevOpsOperationResults_Failed. + * + * @param manager Entry point to SecurityManager. + */ + public static void getDevOpsOperationResultsFailed(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsOperationResults() + .getWithResponse("myRg", "mySecurityConnectorName", "8d4caace-e7b3-4b3e-af99-73f76829ebcf", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetDevOpsOperationResultsSucceeded_example.json + */ + /** + * Sample code: Get_DevOpsOperationResults_Succeeded. + * + * @param manager Entry point to SecurityManager. + */ + public static void getDevOpsOperationResultsSucceeded(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsOperationResults() + .getWithResponse("myRg", "mySecurityConnectorName", "4e826cf1-5c36-4808-a7d2-fb4f5170978b", + com.azure.core.util.Context.NONE); + } +} +``` + +### SecureScoreControls_List + +```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); + } +} +``` + +### SecureScoreControls_ListBySecureScore + +```java +import com.azure.resourcemanager.security.models.AutomationActionLogicApp; +import com.azure.resourcemanager.security.models.AutomationRuleSet; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import com.azure.resourcemanager.security.models.AutomationTriggeringRule; +import com.azure.resourcemanager.security.models.EventSource; +import com.azure.resourcemanager.security.models.Operator; +import com.azure.resourcemanager.security.models.PropertyType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Automations CreateOrUpdate. + */ +public final class AutomationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PutAutomationAllAssessments_example.json + */ + /** + * Sample code: Create or update a security automation for all assessments (including all severities). + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateASecurityAutomationForAllAssessmentsIncludingAllSeverities( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations() + .define("exampleAutomation") + .withRegion("Central US") + .withExistingResourceGroup("exampleResourceGroup") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment") + .withIsEnabled(true) + .withScopes(Arrays.asList(new AutomationScope().withDescription( + "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources(Arrays.asList(new AutomationSource().withEventSource(EventSource.ASSESSMENTS))) + .withActions(Arrays.asList(new AutomationActionLogicApp().withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PutDisableAutomation_example.json + */ + /** + * Sample code: Disable or enable a security automation. + * + * @param manager Entry point to SecurityManager. + */ + public static void disableOrEnableASecurityAutomation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations() + .define("exampleAutomation") + .withRegion("Central US") + .withExistingResourceGroup("exampleResourceGroup") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment") + .withIsEnabled(false) + .withScopes(Arrays.asList(new AutomationScope().withDescription( + "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources(Arrays.asList(new AutomationSource().withEventSource(EventSource.ASSESSMENTS) + .withRuleSets(Arrays.asList(new AutomationRuleSet() + .withRules(Arrays.asList(new AutomationTriggeringRule().withPropertyJPath("$.Entity.AssessmentType") + .withPropertyType(PropertyType.STRING) + .withExpectedValue("customAssessment") + .withOperator(Operator.EQUALS))))))) + .withActions(Arrays.asList(new AutomationActionLogicApp().withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PutAutomationHighSeverityAssessments_example.json + */ + /** + * Sample code: Create or update a security automation for all high severity assessments. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateASecurityAutomationForAllHighSeverityAssessments( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations() + .define("exampleAutomation") + .withRegion("Central US") + .withExistingResourceGroup("exampleResourceGroup") + .withTags(mapOf()) + .withDescription( + "An example of a security automation that triggers one LogicApp resource (myTest1) on any high severity security assessment") + .withIsEnabled(true) + .withScopes(Arrays.asList(new AutomationScope().withDescription( + "A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5") + .withScopePath("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"))) + .withSources(Arrays.asList(new AutomationSource().withEventSource(EventSource.ASSESSMENTS) + .withRuleSets(Arrays.asList(new AutomationRuleSet().withRules( + Arrays.asList(new AutomationTriggeringRule().withPropertyJPath("properties.metadata.severity") + .withPropertyType(PropertyType.STRING) + .withExpectedValue("High") + .withOperator(Operator.EQUALS))))))) + .withActions(Arrays.asList(new AutomationActionLogicApp().withLogicAppResourceId( + "/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1") + .withUri("https://exampleTriggerUri1.com"))) + .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; + } +} +``` + +### SecureScores_Get + +```java +/** + * Samples for Tasks List. + */ +public final class TasksListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTasksSubscription_example.json + */ + /** + * Sample code: Get security recommendations tasks. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSecurityRecommendationsTasks(com.azure.resourcemanager.security.SecurityManager manager) { + manager.tasks().list(null, com.azure.core.util.Context.NONE); + } +} +``` + +### SecureScores_List + +```java +import com.azure.resourcemanager.security.models.AwsEnvironmentData; +import com.azure.resourcemanager.security.models.CloudName; +import com.azure.resourcemanager.security.models.CspmMonitorAwsOffering; +import com.azure.resourcemanager.security.models.CspmMonitorAwsOfferingNativeCloudConnection; +import com.azure.resourcemanager.security.models.SecurityConnector; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SecurityConnectors Update. + */ +public final class SecurityConnectorsUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /PatchSecurityConnector_example.json + */ + /** + * Sample code: Update a security connector. + * + * @param manager Entry point to SecurityManager. + */ + public static void updateASecurityConnector(com.azure.resourcemanager.security.SecurityManager manager) { + SecurityConnector resource = manager.securityConnectors() + .getByResourceGroupWithResponse("exampleResourceGroup", "exampleSecurityConnectorName", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withHierarchyIdentifier("exampleHierarchyId") + .withEnvironmentName(CloudName.AWS) + .withOfferings(Arrays.asList( + new CspmMonitorAwsOffering().withNativeCloudConnection(new CspmMonitorAwsOfferingNativeCloudConnection() + .withCloudRoleArn("arn:aws:iam::00000000:role/ASCMonitor")))) + .withEnvironmentData(new AwsEnvironmentData()) + .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; + } +} +``` + +### SecurityConnectorApplicationOperation_CreateOrUpdate + +```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); + } +} +``` + +### SecurityConnectorApplicationOperation_Delete + +```java +/** + * Samples for Tasks ListByHomeRegion. + */ +public final class TasksListByHomeRegionSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTasksSubscriptionLocation_example.json + */ + /** + * Sample code: Get security recommendations tasks from security data location. + * + * @param manager Entry point to SecurityManager. + */ + public static void getSecurityRecommendationsTasksFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.tasks().listByHomeRegion("westeurope", null, com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityConnectorApplicationOperation_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); + } +} +``` + +### SecurityConnectorApplications_List + +```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); + } +} +``` + +### SecurityConnectors_CreateOrUpdate + +```java +/** + * Samples for RegulatoryComplianceControls List. + */ +public final class RegulatoryComplianceControlsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceControlList_example.json + */ + /** + * Sample code: Get all regulatory compliance controls details and state for selected standard. + * + * @param manager Entry point to SecurityManager. + */ + public static void getAllRegulatoryComplianceControlsDetailsAndStateForSelectedStandard( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.regulatoryComplianceControls().list("PCI-DSS-3.2", null, com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityConnectors_Delete + +```java +/** + * Samples for GovernanceRules List. + */ +public final class GovernanceRulesListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * ListBySubscriptionGovernanceRules_example.json + */ + /** + * Sample code: List governance rules by subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listGovernanceRulesBySubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * ListBySecurityConnectorGovernanceRules_example.json + */ + /** + * Sample code: List governance rules by security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listGovernanceRulesBySecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * ListByManagementGroupGovernanceRules_example.json + */ + /** + * Sample code: List governance rules by management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listGovernanceRulesByManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .list("providers/Microsoft.Management/managementGroups/contoso", com.azure.core.util.Context.NONE); + } +} +``` +### SecurityConnectors_GetByResourceGroup + +```java /** - * Samples for IotSecuritySolution CreateOrUpdate. + * Samples for CustomRecommendations Get. */ -public final class IotSecuritySolutionCreateOrUpdateSamples { +public final class CustomRecommendationsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ - * CreateIoTSecuritySolution.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * GetByManagementGroupCustomRecommendation_example.json */ /** - * Sample code: Create or update a IoT security solution. + * Sample code: Get a custom recommendation over management group scope. * * @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(); + 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); } - // 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; + /* + * 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); } } ``` -### IotSecuritySolution_Delete +### SecurityConnectors_List ```java +import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; + /** - * Samples for IotSecuritySolution Delete. + * Samples for DefenderForStorage StartMalwareScan. */ -public final class IotSecuritySolutionDeleteSamples { +public final class DefenderForStorageStartMalwareScanSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ - * DeleteIoTSecuritySolution.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-01-01/examples/DefenderForStorage/ + * StartMalwareScan_example.json */ /** - * Sample code: Delete an IoT security solution. + * Sample code: Initiate a Defender for Storage malware scan for the specified storage account. * * @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); + public static void initiateADefenderForStorageMalwareScanForTheSpecifiedStorageAccount( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.defenderForStorages() + .startMalwareScanWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + SettingNameAutoGenerated.CURRENT, com.azure.core.util.Context.NONE); } } ``` -### IotSecuritySolution_GetByResourceGroup +### SecurityConnectors_ListByResourceGroup ```java /** - * Samples for IotSecuritySolution GetByResourceGroup. + * Samples for GitLabProjects List. */ -public final class IotSecuritySolutionGetByResourceGroupSamples { +public final class GitLabProjectsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ - * GetIoTSecuritySolution.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListGitLabProjects_example.json */ /** - * Sample code: Get a IoT security solution. + * Sample code: List_GitLabProjects. * * @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); + public static void listGitLabProjects(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitLabProjects() + .list("myRg", "mySecurityConnectorName", "myGitLabGroup$mySubGroup", com.azure.core.util.Context.NONE); } } ``` -### IotSecuritySolution_List +### SecurityConnectors_Update ```java /** - * Samples for IotSecuritySolution List. + * Samples for AlertsSuppressionRules List. */ -public final class IotSecuritySolutionListSamples { +public final class AlertsSuppressionRulesListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ - * GetIoTSecuritySolutionsList.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/GetAlertsSuppressionRules_example.json */ /** - * Sample code: List IoT Security solutions by subscription. + * Sample code: Get suppression rules for 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); + public static void getSuppressionRulesForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.alertsSuppressionRules().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 + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/GetAlertsSuppressionRulesWithAlertType_example.json */ /** - * Sample code: List IoT Security solutions by IoT Hub. + * Sample code: Get suppression alert rule for subscription, filtered by AlertType. * * @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); + public static void getSuppressionAlertRuleForSubscriptionFilteredByAlertType( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.alertsSuppressionRules().list("IpAnomaly", com.azure.core.util.Context.NONE); } } ``` -### IotSecuritySolution_ListByResourceGroup +### SecurityContacts_Create ```java /** - * Samples for IotSecuritySolution ListByResourceGroup. + * Samples for DeviceSecurityGroups List. */ -public final class IotSecuritySolutionListByResourceGroupSamples { +public final class DeviceSecurityGroupsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ - * GetIoTSecuritySolutionsListByIotHubAndRg.json + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ + * ListDeviceSecurityGroups_example.json */ /** - * Sample code: List IoT Security solutions by resource group and IoT Hub. + * Sample code: List all device security groups for the specified IoT Hub resource. * * @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\")", + 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); } +} +``` + +### SecurityContacts_Delete +```java +/** + * Samples for MdeOnboardings Get. + */ +public final class MdeOnboardingsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ - * GetIoTSecuritySolutionsListByRg.json + * specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/ + * GetMdeOnboardings_example.json */ /** - * Sample code: List IoT Security solutions by resource group. + * Sample code: The default configuration or data needed to onboard the machine to MDE. * * @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); + public static void theDefaultConfigurationOrDataNeededToOnboardTheMachineToMDE( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.mdeOnboardings().getWithResponse(com.azure.core.util.Context.NONE); } } ``` -### IotSecuritySolution_Update +### SecurityContacts_Get ```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. + * Samples for RegulatoryComplianceStandards Get. */ -public final class IotSecuritySolutionUpdateSamples { +public final class RegulatoryComplianceStandardsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ - * UpdateIoTSecuritySolution.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceStandard_example.json */ /** - * Sample code: Use this method to update existing IoT Security solution. + * Sample code: Get selected regulatory compliance standard details and state. * * @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(); + public static void getSelectedRegulatoryComplianceStandardDetailsAndState( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.regulatoryComplianceStandards().getWithResponse("PCI-DSS-3.2", com.azure.core.util.Context.NONE); } +} +``` - // 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; +### SecurityContacts_List + +```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); } } ``` -### IotSecuritySolutionAnalytics_Get +### SecurityOperators_CreateOrUpdate ```java /** - * Samples for IotSecuritySolutionAnalytics Get. + * Samples for Alerts UpdateResourceGroupLevelStateToActivate. */ -public final class IotSecuritySolutionAnalyticsGetSamples { +public final class AlertsUpdateResourceGroupLevelStateToActivateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ - * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalytics.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertResourceGroupLocation_activate_example.json */ /** - * Sample code: Get Security Solution Analytics. + * Sample code: Update security alert state on a resource group from a security data location. * * @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); + */ + 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); } } ``` -### IotSecuritySolutionAnalytics_List +### SecurityOperators_Delete ```java /** - * Samples for IotSecuritySolutionAnalytics List. + * Samples for SecurityStandards Delete. */ -public final class IotSecuritySolutionAnalyticsListSamples { +public final class SecurityStandardsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ - * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * DeleteBySecurityConnectorSecurityStandard_example.json */ /** - * Sample code: Get Security Solution Analytics. + * Sample code: Delete a security standard over security connector scope. * * @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); + 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); } -} -``` -### 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 + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * DeleteByManagementGroupSecurityStandard_example.json */ /** - * Sample code: Dismiss an aggregated IoT Security Solution Alert. + * Sample code: Delete a security standard over management group scope. * * @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); + 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); } -} -``` -### 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 + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * DeleteBySubscriptionSecurityStandard_example.json */ /** - * Sample code: Get the aggregated security analytics alert of yours IoT Security solution. This aggregation is - * performed by alert name. + * Sample code: Delete a security standard over subscription scope. * * @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); + 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); } } ``` -### IotSecuritySolutionsAnalyticsAggregatedAlert_List +### SecurityOperators_Get ```java /** - * Samples for IotSecuritySolutionsAnalyticsAggregatedAlert List. + * Samples for Locations List. */ -public final class IotSecuritySolutionsAnalyticsAggregatedAlertListSamples { +public final class LocationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ - * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlertList.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/ + * GetLocations_example.json */ /** - * Sample code: Get the aggregated alert list of yours IoT Security solution. + * Sample code: Get security data locations. * * @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); + public static void getSecurityDataLocations(com.azure.resourcemanager.security.SecurityManager manager) { + manager.locations().list(com.azure.core.util.Context.NONE); } } ``` -### IotSecuritySolutionsAnalyticsRecommendation_Get +### SecurityOperators_List ```java /** - * Samples for IotSecuritySolutionsAnalyticsRecommendation Get. + * Samples for AutoProvisioningSettings Get. */ -public final class IotSecuritySolutionsAnalyticsRecommendationGetSamples { +public final class AutoProvisioningSettingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ - * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * AutoProvisioningSettings/GetAutoProvisioningSettingSubscription_example.json */ /** - * Sample code: Get the aggregated security analytics recommendation of yours IoT Security solution. + * Sample code: Get an auto provisioning setting for subscription. * * @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); + public static void + getAnAutoProvisioningSettingForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.autoProvisioningSettings().getWithResponse("default", com.azure.core.util.Context.NONE); } } ``` -### IotSecuritySolutionsAnalyticsRecommendation_List +### SecuritySolutions_Get ```java /** - * Samples for IotSecuritySolutionsAnalyticsRecommendation List. + * Samples for DiscoveredSecuritySolutions List. */ -public final class IotSecuritySolutionsAnalyticsRecommendationListSamples { +public final class DiscoveredSecuritySolutionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ - * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendationList.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions + * /GetDiscoveredSecuritySolutionsSubscription_example.json */ /** - * Sample code: Get the list of aggregated security analytics recommendations of yours IoT Security solution. + * Sample code: Get discovered security solutions. * * @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); + public static void getDiscoveredSecuritySolutions(com.azure.resourcemanager.security.SecurityManager manager) { + manager.discoveredSecuritySolutions().list(com.azure.core.util.Context.NONE); } } ``` -### JitNetworkAccessPolicies_CreateOrUpdate +### SecuritySolutions_List ```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; +import com.azure.resourcemanager.security.models.ExpandControlsEnum; /** - * Samples for JitNetworkAccessPolicies CreateOrUpdate. + * Samples for SecureScoreControls ListBySecureScore. */ -public final class JitNetworkAccessPoliciesCreateOrUpdateSamples { +public final class SecureScoreControlsListBySecureScoreSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ - * CreateJitNetworkAccessPolicy_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ + * ListSecureScoreControlsForNameWithExpand_builtin_example.json */ /** - * Sample code: Create JIT network access policy. + * 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 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(); + public static void getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiativeWithTheExpandParameter( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.secureScoreControls() + .listBySecureScore("ascScore", ExpandControlsEnum.DEFINITION, com.azure.core.util.Context.NONE); } -} -``` - -### 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 + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ + * ListSecureScoreControlsForName_builtin_example.json */ /** - * Sample code: Delete a JIT network access policy. + * Sample code: Get security controls and their current score for the specified initiative. * * @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); + public static void getSecurityControlsAndTheirCurrentScoreForTheSpecifiedInitiative( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.secureScoreControls().listBySecureScore("ascScore", null, com.azure.core.util.Context.NONE); } } ``` -### JitNetworkAccessPolicies_Get +### SecuritySolutionsReferenceData_List ```java /** - * Samples for JitNetworkAccessPolicies Get. + * Samples for SubAssessments Get. */ -public final class JitNetworkAccessPoliciesGetSamples { +public final class SubAssessmentsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ - * GetJitNetworkAccessPolicy_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ + * GetSubAssessment_example.json */ /** - * Sample code: Get JIT network access policy. + * Sample code: Get security recommendation task from security data location. * * @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); + public static void getSecurityRecommendationTaskFromSecurityDataLocation( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.subAssessments() + .getWithResponse( + "subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2", + "1195afff-c881-495e-9bc5-1486211ae03f", "95f7da9c-a2a4-1322-0758-fcd24ef09b85", + com.azure.core.util.Context.NONE); } } ``` -### JitNetworkAccessPolicies_Initiate +### SecuritySolutionsReferenceData_ListByHomeRegion ```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. + * Samples for Compliances List. */ -public final class JitNetworkAccessPoliciesInitiateSamples { +public final class CompliancesListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ - * InitiateJitNetworkAccessPolicy_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/ + * GetCompliances_example.json */ /** - * Sample code: Initiate an action on a JIT network access policy. + * Sample code: Get security compliance data over time. * * @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); + public static void getSecurityComplianceDataOverTime(com.azure.resourcemanager.security.SecurityManager manager) { + manager.compliances() + .list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", com.azure.core.util.Context.NONE); } } ``` -### JitNetworkAccessPolicies_List +### SecurityStandards_CreateOrUpdate ```java +import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; + /** - * Samples for JitNetworkAccessPolicies List. + * Samples for ServerVulnerabilityAssessmentsSettings Delete. */ -public final class JitNetworkAccessPoliciesListSamples { +public final class ServerVulnerabilityAssessmentsSettingsDeleteSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ - * GetJitNetworkAccessPoliciesSubscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ + * ServerVulnerabilityAssessmentsSettings/DeleteServerVulnerabilityAssessmentsSetting_example.json */ /** - * Sample code: Get JIT network access policies on a subscription. + * Sample code: Delete the server vulnerability assessments setting of the kind settingKind from the 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); + public static void deleteTheServerVulnerabilityAssessmentsSettingOfTheKindSettingKindFromTheSubscription( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.serverVulnerabilityAssessmentsSettings() + .deleteWithResponse(ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, + com.azure.core.util.Context.NONE); } } ``` -### JitNetworkAccessPolicies_ListByRegion +### SecurityStandards_Delete ```java /** @@ -2347,1356 +7287,1442 @@ public final class JitNetworkAccessPoliciesListByRegionSamples { } ``` -### JitNetworkAccessPolicies_ListByResourceGroup +### SecurityStandards_Get ```java /** - * Samples for JitNetworkAccessPolicies ListByResourceGroup. + * Samples for WorkspaceSettings Create. */ -public final class JitNetworkAccessPoliciesListByResourceGroupSamples { +public final class WorkspaceSettingsCreateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ - * GetJitNetworkAccessPoliciesResourceGroup_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * CreateWorkspaceSetting_example.json */ /** - * Sample code: Get JIT network access policies on a resource group. + * Sample code: Create a workspace setting data for subscription. * * @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); + createAWorkspaceSettingDataForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.workspaceSettings() + .define("default") + .withWorkspaceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace") + .withScope("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23") + .create(); } } ``` -### JitNetworkAccessPolicies_ListByResourceGroupAndRegion +### SecurityStandards_List ```java /** - * Samples for JitNetworkAccessPolicies ListByResourceGroupAndRegion. + * Samples for AlertsSuppressionRules Get. */ -public final class JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples { +public final class AlertsSuppressionRulesGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ - * GetJitNetworkAccessPoliciesResourceGroupLocation_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/GetAlertsSuppressionRule_example.json */ /** - * Sample code: Get JIT network access policies on a resource group from a security data location. + * Sample code: Get suppression alert rule for subscription. * * @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); + public static void + getSuppressionAlertRuleForSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.alertsSuppressionRules().getWithResponse("dismissIpAnomalyAlerts", com.azure.core.util.Context.NONE); } } ``` -### Pricings_Delete +### SensitivitySettings_CreateOrUpdate ```java /** - * Samples for Pricings Delete. + * Samples for StandardAssignments List. */ -public final class PricingsDeleteSamples { +public final class StandardAssignmentsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * DeleteResourcePricing_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * ListStandardAssignments.json */ /** - * Sample code: Delete a pricing on resource. + * Sample code: List standard assignments. * * @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); + 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); } } ``` -### Pricings_Get +### SensitivitySettings_Get ```java + /** - * Samples for Pricings Get. + * Samples for GovernanceRules Execute. */ -public final class PricingsGetSamples { +public final class GovernanceRulesExecuteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * GetResourcePricingByNameVirtualMachines_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PostSecurityConnectorGovernanceRule_example.json */ /** - * Sample code: Get pricings on resource - VirtualMachines plan. + * Sample code: Execute governance rule over security connector scope. * * @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); + executeGovernanceRuleOverSecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .execute( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", null, 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 + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PostGovernanceRule_example.json */ /** - * Sample code: Get pricings on subscription - CloudPosture plan. + * Sample code: Execute Governance rule over subscription scope. * * @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", + executeGovernanceRuleOverSubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .execute("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", null, 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 + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PostManagementGroupGovernanceRule_example.json */ /** - * Sample code: Get pricings on subscription - Dns plan. + * Sample code: Execute governance rule over management group scope. * * @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); + public static void + executeGovernanceRuleOverManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceRules() + .execute("providers/Microsoft.Management/managementGroups/contoso", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", + null, com.azure.core.util.Context.NONE); } +} +``` + +### SensitivitySettings_List +```java +/** + * Samples for SecurityOperators Delete. + */ +public final class SecurityOperatorsDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * GetPricingByNameContainers_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * DeleteSecurityOperatorByName_example.json */ /** - * Sample code: Get pricings on subscription - Containers plan. + * Sample code: Delete SecurityOperator on subscription. * * @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", + deleteSecurityOperatorOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityOperators() + .deleteByResourceGroupWithResponse("CloudPosture", "DefenderCSPMSecurityOperator", com.azure.core.util.Context.NONE); } +} +``` + +### ServerVulnerabilityAssessment_CreateOrUpdate +```java +/** + * Samples for WorkspaceSettings Get. + */ +public final class WorkspaceSettingsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * GetPricingByNameStorageAccounts_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * GetWorkspaceSetting_example.json */ /** - * Sample code: Get pricings on subscription - StorageAccounts plan. + * Sample code: Get a workspace setting on subscription. * * @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); + public static void getAWorkspaceSettingOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.workspaceSettings().getWithResponse("default", com.azure.core.util.Context.NONE); } +} +``` + +### ServerVulnerabilityAssessment_Delete + +```java +import com.azure.resourcemanager.security.models.AwsEnvironmentData; +import com.azure.resourcemanager.security.models.CloudName; +import com.azure.resourcemanager.security.models.CspmMonitorAwsOffering; +import com.azure.resourcemanager.security.models.CspmMonitorAwsOfferingNativeCloudConnection; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +/** + * Samples for SecurityConnectors CreateOrUpdate. + */ +public final class SecurityConnectorsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * GetPricingByNameVirtualMachines_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /PutSecurityConnector_example.json */ /** - * Sample code: Get pricings on subscription - VirtualMachines plan. + * Sample code: Create or update a security connector. * * @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); + public static void createOrUpdateASecurityConnector(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityConnectors() + .define("exampleSecurityConnectorName") + .withRegion("Central US") + .withExistingResourceGroup("exampleResourceGroup") + .withTags(mapOf()) + .withHierarchyIdentifier("exampleHierarchyId") + .withEnvironmentName(CloudName.AWS) + .withOfferings(Arrays.asList( + new CspmMonitorAwsOffering().withNativeCloudConnection(new CspmMonitorAwsOfferingNativeCloudConnection() + .withCloudRoleArn("arn:aws:iam::00000000:role/ASCMonitor")))) + .withEnvironmentData(new AwsEnvironmentData().withScanInterval(4L)) + .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; } } ``` -### Pricings_List +### ServerVulnerabilityAssessment_Get ```java /** - * Samples for Pricings List. + * Samples for SecurityOperators Get. */ -public final class PricingsListSamples { +public final class SecurityOperatorsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * ListPricingsWithPlanFilter_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * GetSecurityOperatorByName_example.json */ /** - * Sample code: Get pricings on subscription with plans filter. + * Sample code: Get a specific security operator by scope and securityOperatorName. * * @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); + public static void getASpecificSecurityOperatorByScopeAndSecurityOperatorName( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityOperators() + .getWithResponse("CloudPosture", "DefenderCSPMSecurityOperator", com.azure.core.util.Context.NONE); } +} +``` + +### ServerVulnerabilityAssessment_ListByExtendedResource +```java +/** + * Samples for CustomEntityStoreAssignments Create. + */ +public final class CustomEntityStoreAssignmentsCreateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * ListPricings_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentCreate_example.json */ /** - * Sample code: Get pricings on subscription. + * Sample code: Create a custom entity store assignment. * * @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); + public static void createACustomEntityStoreAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customEntityStoreAssignments() + .define("33e7cc6e-a139-4723-a0e5-76993aee0771") + .withExistingResourceGroup("TestResourceGroup") + .withPrincipal("aaduser=f3923a3e-ad57-4752-b1a9-fbf3c8e5e082;72f988bf-86f1-41af-91ab-2d7cd011db47") + .create(); } +} +``` + +### ServerVulnerabilityAssessmentsSettings_CreateOrUpdate +```java +/** + * Samples for SoftwareInventories Get. + */ +public final class SoftwareInventoriesGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * ListResourcePricings_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/ + * SoftwareInventories/GetSoftware_example.json */ /** - * Sample code: Get pricings on resource. + * Sample code: Gets a single software data of the virtual machine. * * @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); + public static void + getsASingleSoftwareDataOfTheVirtualMachine(com.azure.resourcemanager.security.SecurityManager manager) { + manager.softwareInventories() + .getWithResponse("EITAN-TESTS", "Microsoft.Compute", "virtualMachines", "Eitan-Test1", + "outlook_16.0.10371.20060", com.azure.core.util.Context.NONE); } } ``` -### Pricings_Update +### ServerVulnerabilityAssessmentsSettings_Delete ```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. + * Samples for ApplicationOperation Delete. */ -public final class PricingsUpdateSamples { +public final class ApplicationOperationDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * PutPricingByName_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * DeleteApplication_example.json */ /** - * Sample code: Update pricing on subscription (example for CloudPosture plan). + * Sample code: Delete security Application. * * @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); + public static void deleteSecurityApplication(com.azure.resourcemanager.security.SecurityManager manager) { + manager.applicationOperations() + .deleteWithResponse("ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); } +} +``` + +### ServerVulnerabilityAssessmentsSettings_Get +```java +/** + * Samples for SecurityStandards Get. + */ +public final class SecurityStandardsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ - * PutPricingByNamePartialSuccess_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * GetBySecurityConnectorSecurityStandard_example.json */ /** - * Sample code: Update pricing on subscription (example for CloudPosture plan) - partial success. + * Sample code: Get a security standard over security connector scope. * * @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); + 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-01-01/examples/Pricings/ - * PutPricingVMsByName_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * GetByManagementGroupSecurityStandard_example.json */ /** - * Sample code: Update pricing on subscription (example for VirtualMachines plan). + * Sample code: Get a security standard over management group scope. * * @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); + 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-01-01/examples/Pricings/ - * PutResourcePricingByNameVirtualMachines_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * GetBySubscriptionSecurityStandard_example.json */ /** - * Sample code: Update pricing on resource (example for VirtualMachines plan). + * Sample code: Get a security standard over subscription scope. * * @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); + 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); } } ``` -### SecureScoreControlDefinitions_List +### ServerVulnerabilityAssessmentsSettings_List ```java /** - * Samples for SecureScoreControlDefinitions List. + * Samples for CustomAssessmentAutomations Delete. */ -public final class SecureScoreControlDefinitionsListSamples { +public final class CustomAssessmentAutomationsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * secureScoreControlDefinitions/ListSecureScoreControlDefinitions_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationDelete_example.json */ /** - * Sample code: List security controls definition. + * Sample code: Delete a Custom Assessment Automation. * * @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); + public static void deleteACustomAssessmentAutomation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customAssessmentAutomations() + .deleteByResourceGroupWithResponse("TestResourceGroup", "MyCustomAssessmentAutomation", + com.azure.core.util.Context.NONE); } } ``` -### SecureScoreControlDefinitions_ListBySubscription +### Settings_Get ```java /** - * Samples for SecureScoreControlDefinitions ListBySubscription. + * Samples for GovernanceAssignments List. */ -public final class SecureScoreControlDefinitionsListBySubscriptionSamples { +public final class GovernanceAssignmentsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/ListGovernanceAssignments_example.json */ /** - * Sample code: List security controls definition by subscription. + * Sample code: List governance assignments. * * @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); + public static void listGovernanceAssignments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.governanceAssignments() + .list("subscriptions/c32e05d9-7207-4e22-bdf4-4f7d9c72e5fd", "6b9421dd-5555-2251-9b3d-2be58e2f82cd", + com.azure.core.util.Context.NONE); } } ``` -### SecureScoreControls_List +### Settings_List ```java - /** - * Samples for SecureScoreControls List. + * Samples for IotSecuritySolution GetByResourceGroup. */ -public final class SecureScoreControlsListSamples { +public final class IotSecuritySolutionGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ - * ListSecureScoreControls_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * GetIoTSecuritySolution.json */ /** - * Sample code: List all secure scores controls. + * Sample code: Get a IoT security solution. * * @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); + public static void getAIoTSecuritySolution(com.azure.resourcemanager.security.SecurityManager manager) { + manager.iotSecuritySolutions() + .getByResourceGroupWithResponse("MyGroup", "default", com.azure.core.util.Context.NONE); } } ``` -### SecureScoreControls_ListBySecureScore +### Settings_Update ```java -import com.azure.resourcemanager.security.models.ExpandControlsEnum; - /** - * Samples for SecureScoreControls ListBySecureScore. + * Samples for WorkspaceSettings Delete. */ -public final class SecureScoreControlsListBySecureScoreSamples { +public final class WorkspaceSettingsDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ - * ListSecureScoreControlsForNameWithExpand_builtin_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * DeleteWorkspaceSetting_example.json */ /** - * Sample code: Get security controls and their current score for the specified initiative with the expand - * parameter. + * Sample code: Delete a workspace setting data for resource group. * * @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); + public static void + deleteAWorkspaceSettingDataForResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { + manager.workspaceSettings().deleteWithResponse("default", com.azure.core.util.Context.NONE); } +} +``` + +### SoftwareInventories_Get +```java +/** + * Samples for AzureDevOpsOrgs List. + */ +public final class AzureDevOpsOrgsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ - * ListSecureScoreControlsForName_builtin_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListAzureDevOpsOrgs_example.json */ /** - * Sample code: Get security controls and their current score for the specified initiative. + * Sample code: List_AzureDevOpsOrgs. * * @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); + public static void listAzureDevOpsOrgs(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsOrgs().list("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); } } ``` -### SecureScores_Get +### SoftwareInventories_List ```java /** - * Samples for SecureScores Get. + * Samples for RegulatoryComplianceStandards List. */ -public final class SecureScoresGetSamples { +public final class RegulatoryComplianceStandardsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ - * GetSecureScoresSingle_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceStandardList_example.json */ /** - * Sample code: Get single secure score. + * Sample code: Get all supported regulatory compliance standards details and state. * * @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); + public static void getAllSupportedRegulatoryComplianceStandardsDetailsAndState( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.regulatoryComplianceStandards().list(null, com.azure.core.util.Context.NONE); } } ``` -### SecureScores_List +### SoftwareInventories_ListByExtendedResource ```java /** - * Samples for SecureScores List. + * Samples for RegulatoryComplianceAssessments List. */ -public final class SecureScoresListSamples { +public final class RegulatoryComplianceAssessmentsListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ - * ListSecureScores_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceAssessmentList_example.json */ /** - * Sample code: List secure scores. + * Sample code: Get all assessments mapped to selected regulatory compliance control. * * @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); + public static void getAllAssessmentsMappedToSelectedRegulatoryComplianceControl( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.regulatoryComplianceAssessments().list("PCI-DSS-3.2", "1.1", null, com.azure.core.util.Context.NONE); } } ``` -### SecuritySolutions_Get +### SqlVulnerabilityAssessmentBaselineRules_Add ```java /** - * Samples for SecuritySolutions Get. + * Samples for AlertsSuppressionRules Delete. */ -public final class SecuritySolutionsGetSamples { +public final class AlertsSuppressionRulesDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/ - * GetSecuritySolutionsResourceGroupLocation_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/DeleteAlertsSuppressionRule_example.json */ /** - * Sample code: Get a security solution from a security data location. + * Sample code: Delete suppression rule data for a subscription. * * @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); + deleteSuppressionRuleDataForASubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.alertsSuppressionRules().deleteWithResponse("dismissIpAnomalyAlerts", com.azure.core.util.Context.NONE); } } ``` -### SecuritySolutions_List +### SqlVulnerabilityAssessmentBaselineRules_CreateOrUpdate ```java +import com.azure.resourcemanager.security.models.SettingName; + /** - * Samples for SecuritySolutions List. + * Samples for Settings Get. */ -public final class SecuritySolutionsListSamples { +public final class SettingsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/ - * GetSecuritySolutionsSubscription_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSetting_example + * .json */ /** - * Sample code: Get security solutions. + * Sample code: Get a setting on subscription. * * @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); + public static void getASettingOnSubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.settings().getWithResponse(SettingName.WDATP, com.azure.core.util.Context.NONE); } } ``` -### SecuritySolutionsReferenceData_List +### SqlVulnerabilityAssessmentBaselineRules_Delete ```java /** - * Samples for SecuritySolutionsReferenceData List. + * Samples for SecureScoreControlDefinitions List. */ -public final class SecuritySolutionsReferenceDataListSamples { +public final class SecureScoreControlDefinitionsListSamples { /* * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscription_example.json + * secureScoreControlDefinitions/ListSecureScoreControlDefinitions_example.json */ /** - * Sample code: Get security solutions. + * Sample code: List security controls definition. * * @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); + public static void listSecurityControlsDefinition(com.azure.resourcemanager.security.SecurityManager manager) { + manager.secureScoreControlDefinitions().list(com.azure.core.util.Context.NONE); } } ``` -### SecuritySolutionsReferenceData_ListByHomeRegion +### SqlVulnerabilityAssessmentBaselineRules_Get ```java /** - * Samples for SecuritySolutionsReferenceData ListByHomeRegion. + * Samples for ServerVulnerabilityAssessment Get. */ -public final class SecuritySolutionsReferenceDataListByHomeRegionSamples { +public final class ServerVulnerabilityAssessmentGetSamples { /* * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscriptionLocation_example.json + * ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json */ /** - * Sample code: Get security solutions from a security data location. + * 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 - getSecuritySolutionsFromASecurityDataLocation(com.azure.resourcemanager.security.SecurityManager manager) { - manager.securitySolutionsReferenceDatas() - .listByHomeRegionWithResponse("westcentralus", com.azure.core.util.Context.NONE); + getAServerVulnerabilityAssessmentsOnboardingStatusOnAResourceCurrentlyMicrosoftSecurityOnlySupportsTheSingleDefaultResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.serverVulnerabilityAssessments() + .getWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", com.azure.core.util.Context.NONE); } } ``` -### SecurityStandards_CreateOrUpdate +### SqlVulnerabilityAssessmentBaselineRules_List ```java -import com.azure.resourcemanager.security.models.PartialAssessmentProperties; -import com.azure.resourcemanager.security.models.StandardSupportedCloud; -import java.util.Arrays; - /** - * Samples for SecurityStandards CreateOrUpdate. + * Samples for SubAssessments ListAll. */ -public final class SecurityStandardsCreateOrUpdateSamples { +public final class SubAssessmentsListAllSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * PutBySubscriptionSecurityStandard_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ + * ListSubscriptionSubAssessments_example.json */ /** - * Sample code: Create or update security standard over subscription scope. + * Sample code: List security sub-assessments. * * @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(); + public static void listSecuritySubAssessments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.subAssessments() + .listAll("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/ - * 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(); - } +### SqlVulnerabilityAssessmentScanResults_Get +```java +/** + * Samples for IotSecuritySolutionsAnalyticsAggregatedAlert List. + */ +public final class IotSecuritySolutionsAnalyticsAggregatedAlertListSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * PutByManagementGroupSecurityStandard_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlertList.json */ /** - * Sample code: Create or update security standard over management group scope. + * Sample code: Get the aggregated alert list of yours IoT Security solution. * * @param manager Entry point to SecurityManager. */ - public static void createOrUpdateSecurityStandardOverManagementGroupScope( + public static void getTheAggregatedAlertListOfYoursIoTSecuritySolution( 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(); + manager.iotSecuritySolutionsAnalyticsAggregatedAlerts() + .list("MyGroup", "default", null, com.azure.core.util.Context.NONE); } } ``` -### SecurityStandards_Delete +### SqlVulnerabilityAssessmentScanResults_List ```java +import com.azure.resourcemanager.security.models.ActionableRemediation; +import com.azure.resourcemanager.security.models.ActionableRemediationState; +import com.azure.resourcemanager.security.models.AzureDevOpsRepository; +import com.azure.resourcemanager.security.models.AzureDevOpsRepositoryProperties; +import com.azure.resourcemanager.security.models.OnboardingState; + /** - * Samples for SecurityStandards Delete. + * Samples for AzureDevOpsRepos Update. */ -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); - } - +public final class AzureDevOpsReposUpdateSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * DeleteBySubscriptionSecurityStandard_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * UpdateAzureDevOpsRepos_example.json */ /** - * Sample code: Delete a security standard over subscription scope. + * Sample code: Update_AzureDevOpsRepos. * * @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); + public static void updateAzureDevOpsRepos(com.azure.resourcemanager.security.SecurityManager manager) { + AzureDevOpsRepository resource = manager.azureDevOpsRepos() + .getWithResponse("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", "myAzDevOpsRepo", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new AzureDevOpsRepositoryProperties().withOnboardingState(OnboardingState.NOT_APPLICABLE) + .withActionableRemediation(new ActionableRemediation().withState(ActionableRemediationState.ENABLED))) + .apply(); } } ``` -### SecurityStandards_Get +### SqlVulnerabilityAssessmentScans_Get ```java /** - * Samples for SecurityStandards Get. + * Samples for DeviceSecurityGroups Delete. */ -public final class SecurityStandardsGetSamples { +public final class DeviceSecurityGroupsDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * GetBySecurityConnectorSecurityStandard_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ + * DeleteDeviceSecurityGroups_example.json */ /** - * Sample code: Get a security standard over security connector scope. + * Sample code: Delete a device security group for the specified IoT Hub resource. * * @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); + 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); } +} +``` + +### SqlVulnerabilityAssessmentScans_List +```java +/** + * Samples for RegulatoryComplianceControls Get. + */ +public final class RegulatoryComplianceControlsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * GetByManagementGroupSecurityStandard_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceControl_example.json */ /** - * Sample code: Get a security standard over management group scope. + * Sample code: Get selected regulatory compliance control details and state. * * @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); + public static void getSelectedRegulatoryComplianceControlDetailsAndState( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.regulatoryComplianceControls().getWithResponse("PCI-DSS-3.2", "1.1", com.azure.core.util.Context.NONE); } +} +``` + +### StandardAssignments_Create +```java +/** + * Samples for SecureScoreControlDefinitions ListBySubscription. + */ +public final class SecureScoreControlDefinitionsListBySubscriptionSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * GetBySubscriptionSecurityStandard_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json */ /** - * Sample code: Get a security standard over subscription scope. + * Sample code: List security controls definition by subscription. * * @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); + listSecurityControlsDefinitionBySubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.secureScoreControlDefinitions().listBySubscription(com.azure.core.util.Context.NONE); } } ``` -### SecurityStandards_List +### StandardAssignments_Delete ```java +import com.azure.resourcemanager.security.models.TaskUpdateActionType; + /** - * Samples for SecurityStandards List. + * Samples for Tasks UpdateSubscriptionLevelTaskState. */ -public final class SecurityStandardsListSamples { +public final class TasksUpdateSubscriptionLevelTaskStateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * ListByManagementGroupSecurityStandards_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * UpdateTaskSubscriptionLocation_example.json */ /** - * Sample code: List security standards by management group scope. + * Sample code: Change security recommendation task state. * * @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); + changeSecurityRecommendationTaskState(com.azure.resourcemanager.security.SecurityManager manager) { + manager.tasks() + .updateSubscriptionLevelTaskStateWithResponse("westeurope", "62609ee7-d0a5-8616-9fe4-1df5cca7758d", + TaskUpdateActionType.DISMISS, com.azure.core.util.Context.NONE); } +} +``` + +### StandardAssignments_Get +```java +/** + * Samples for InformationProtectionPolicies List. + */ +public final class InformationProtectionPoliciesListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * ListBySubscriptionSecurityStandards_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/ListInformationProtectionPolicies_example.json */ /** - * Sample code: List security standards by subscription scope. + * Sample code: Get information protection policies. * * @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); + public static void getInformationProtectionPolicies(com.azure.resourcemanager.security.SecurityManager manager) { + manager.informationProtectionPolicies() + .list("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", + com.azure.core.util.Context.NONE); } +} +``` + +### StandardAssignments_List +```java +/** + * Samples for AzureDevOpsRepos List. + */ +public final class AzureDevOpsReposListSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ - * ListBySecurityConnectorSecurityStandards_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListAzureDevOpsRepos_example.json */ /** - * Sample code: List security standards by security connector scope. + * Sample code: List_AzureDevOpsRepos. * * @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", + public static void listAzureDevOpsRepos(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsRepos() + .list("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", "myAzDevOpsProject", com.azure.core.util.Context.NONE); } } ``` -### ServerVulnerabilityAssessment_CreateOrUpdate +### SubAssessments_Get ```java /** - * Samples for ServerVulnerabilityAssessment CreateOrUpdate. + * Samples for GitHubOwners List. */ -public final class ServerVulnerabilityAssessmentCreateOrUpdateSamples { +public final class GitHubOwnersListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * ServerVulnerabilityAssessments/CreateServerVulnerabilityAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * ListGitHubOwners_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. + * Sample code: List_GitHubOwners. * * @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); + public static void listGitHubOwners(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitHubOwners().list("myRg", "mySecurityConnectorName", com.azure.core.util.Context.NONE); } } ``` -### ServerVulnerabilityAssessment_Delete +### SubAssessments_List ```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.security.models.ApplicationSourceResourceType; +import java.io.IOException; +import java.util.Arrays; + /** - * Samples for ServerVulnerabilityAssessment Delete. + * Samples for ApplicationOperation CreateOrUpdate. */ -public final class ServerVulnerabilityAssessmentDeleteSamples { +public final class ApplicationOperationCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * ServerVulnerabilityAssessments/DeleteServerVulnerabilityAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * PutApplication_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. + * Sample code: Create application. * * @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); + public static void createApplication(com.azure.resourcemanager.security.SecurityManager manager) + throws IOException { + manager.applicationOperations() + .define("ad9a8e26-29d9-4829-bb30-e597a58cdbb8") + .withDisplayName("Admin's application") + .withDescription("An application on critical recommendations") + .withSourceResourceType(ApplicationSourceResourceType.ASSESSMENTS) + .withConditionSets(Arrays.asList(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"conditions\":[{\"operator\":\"contains\",\"property\":\"$.Id\",\"value\":\"-bil-\"}]}", + Object.class, SerializerEncoding.JSON))) + .create(); } } ``` -### ServerVulnerabilityAssessment_Get +### SubAssessments_ListAll ```java /** - * Samples for ServerVulnerabilityAssessment Get. + * Samples for ExternalSecuritySolutions List. */ -public final class ServerVulnerabilityAssessmentGetSamples { +public final class ExternalSecuritySolutionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/ + * GetExternalSecuritySolutionsSubscription_example.json */ /** - * Sample code: Get a server vulnerability assessments onboarding status on a resource. Currently Microsoft.Security - * only supports the single 'default' resource. + * Sample code: Get external security solutions on a subscription. * * @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); + getExternalSecuritySolutionsOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { + manager.externalSecuritySolutions().list(com.azure.core.util.Context.NONE); } } ``` -### ServerVulnerabilityAssessment_ListByExtendedResource +### Tasks_GetResourceGroupLevelTask ```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 ServerVulnerabilityAssessment ListByExtendedResource. + * Samples for Alerts Simulate. */ -public final class ServerVulnerabilityAssessmentListByExtendedResourceSamples { +public final class AlertsSimulateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ - * ServerVulnerabilityAssessments/ListByExtendedResourceServerVulnerabilityAssessments_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * SimulateAlerts_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. + * Sample code: Simulate security alerts on a subscription. * * @param manager Entry point to SecurityManager. */ public static void - getAListOfServerVulnerabilityAssessmentsOnAResourceThoughThisAPIReturnsAListCurrentlyMicrosoftSecurityOnlySupportsASingleDefaultTypeOfServerVulnerabilityAssessment( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessments() - .listByExtendedResourceWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", + 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); } } ``` -### ServerVulnerabilityAssessmentsSettings_CreateOrUpdate +### Tasks_GetSubscriptionLevelTask ```java -import com.azure.resourcemanager.security.models.AzureServersSetting; -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsAzureSettingSelectedProvider; -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; +import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; /** - * Samples for ServerVulnerabilityAssessmentsSettings CreateOrUpdate. + * Samples for DefenderForStorage GetMalwareScan. */ -public final class ServerVulnerabilityAssessmentsSettingsCreateOrUpdateSamples { +public final class DefenderForStorageGetMalwareScanSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ - * ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2025-01-01/examples/DefenderForStorage/ + * GetMalwareScan_example.json */ /** - * Sample code: Set a server vulnerability assessments setting of the kind settingKind on the subscription. + * Sample code: Gets the Defender for Storage malware scan for the specified storage resource. * * @param manager Entry point to SecurityManager. */ - public static void setAServerVulnerabilityAssessmentsSettingOfTheKindSettingKindOnTheSubscription( + public static void getsTheDefenderForStorageMalwareScanForTheSpecifiedStorageResource( 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); + manager.defenderForStorages() + .getMalwareScanWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + SettingNameAutoGenerated.CURRENT, "latest", com.azure.core.util.Context.NONE); } } ``` -### ServerVulnerabilityAssessmentsSettings_Delete +### Tasks_List ```java -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; - /** - * Samples for ServerVulnerabilityAssessmentsSettings Delete. + * Samples for Automations GetByResourceGroup. */ -public final class ServerVulnerabilityAssessmentsSettingsDeleteSamples { +public final class AutomationsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ - * ServerVulnerabilityAssessmentsSettings/DeleteServerVulnerabilityAssessmentsSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * GetAutomationResourceGroup_example.json */ /** - * Sample code: Delete the server vulnerability assessments setting of the kind settingKind from the subscription. + * Sample code: Retrieve a security automation. * * @param manager Entry point to SecurityManager. */ - public static void deleteTheServerVulnerabilityAssessmentsSettingOfTheKindSettingKindFromTheSubscription( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessmentsSettings() - .deleteWithResponse(ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, + public static void retrieveASecurityAutomation(com.azure.resourcemanager.security.SecurityManager manager) { + manager.automations() + .getByResourceGroupWithResponse("exampleResourceGroup", "exampleAutomation", com.azure.core.util.Context.NONE); } } ``` -### ServerVulnerabilityAssessmentsSettings_Get +### Tasks_ListByHomeRegion ```java -import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; +/** + * 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); + } +} +``` + +### Tasks_ListByResourceGroup +```java /** - * Samples for ServerVulnerabilityAssessmentsSettings Get. + * Samples for SqlVulnerabilityAssessmentBaselineRules Get. */ -public final class ServerVulnerabilityAssessmentsSettingsGetSamples { +public final class SqlVulnerabilityAssessmentBaselineRulesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ - * ServerVulnerabilityAssessmentsSettings/GetServerVulnerabilityAssessmentsSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Get.json */ /** - * Sample code: Get the server vulnerability assessments setting of the kind settingKind that is set on the - * subscription. + * Sample code: Get the baseline. * * @param manager Entry point to SecurityManager. */ - public static void getTheServerVulnerabilityAssessmentsSettingOfTheKindSettingKindThatIsSetOnTheSubscription( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessmentsSettings() - .getWithResponse(ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, + public static void getTheBaseline(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentBaselineRules() + .getWithResponse("VA1234", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", com.azure.core.util.Context.NONE); } } ``` -### ServerVulnerabilityAssessmentsSettings_List +### Tasks_UpdateResourceGroupLevelTaskState ```java /** - * Samples for ServerVulnerabilityAssessmentsSettings List. + * Samples for Alerts UpdateSubscriptionLevelStateToResolve. */ -public final class ServerVulnerabilityAssessmentsSettingsListSamples { +public final class AlertsUpdateSubscriptionLevelStateToResolveSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ - * ServerVulnerabilityAssessmentsSettings/ListServerVulnerabilityAssessmentsSettings_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertSubscriptionLocation_resolve_example.json */ /** - * Sample code: List the server vulnerability assessments settings set on the subscription. + * Sample code: Update security alert state on a subscription from a security data location. * * @param manager Entry point to SecurityManager. */ - public static void listTheServerVulnerabilityAssessmentsSettingsSetOnTheSubscription( + public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation( com.azure.resourcemanager.security.SecurityManager manager) { - manager.serverVulnerabilityAssessmentsSettings().list(com.azure.core.util.Context.NONE); + manager.alerts() + .updateSubscriptionLevelStateToResolveWithResponse("westeurope", + "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE); } } ``` -### Settings_Get +### Tasks_UpdateSubscriptionLevelTaskState ```java -import com.azure.resourcemanager.security.models.SettingName; - /** - * Samples for Settings Get. + * Samples for GitLabGroups Get. */ -public final class SettingsGetSamples { +public final class GitLabGroupsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSetting_example - * .json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetGitLabGroups_example.json */ /** - * Sample code: Get a setting on subscription. + * Sample code: Get_GitLabGroups. * * @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); + public static void getGitLabGroups(com.azure.resourcemanager.security.SecurityManager manager) { + manager.gitLabGroups() + .getWithResponse("myRg", "mySecurityConnectorName", "myGitLabGroup$mySubGroup", + com.azure.core.util.Context.NONE); } } ``` -### Settings_List +### Topology_Get ```java /** - * Samples for Settings List. + * Samples for SqlVulnerabilityAssessmentScans Get. */ -public final class SettingsListSamples { +public final class SqlVulnerabilityAssessmentScansGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/ - * GetSettings_example.json + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_Get.json */ /** - * Sample code: Get settings of subscription. + * Sample code: Get scan details of a scan record. * * @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); + public static void getScanDetailsOfAScanRecord(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentScans() + .getWithResponse("Scheduled-20200623", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", + 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 + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_GetLatest.json */ /** - * Sample code: Update a setting for subscription. + * Sample code: Get scan details of the latest scan record. * * @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), + public static void getScanDetailsOfTheLatestScanRecord(com.azure.resourcemanager.security.SecurityManager manager) { + manager.sqlVulnerabilityAssessmentScans() + .getWithResponse("latest", "55555555-6666-7777-8888-999999999999", + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", com.azure.core.util.Context.NONE); } } ``` -### StandardAssignments_Create +### Topology_List ```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. + * Samples for ApiCollections GetByAzureApiManagementService. */ -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(); - } - +public final class ApiCollectionsGetByAzureApiManagementServiceSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ - * PutExemptionStandardAssignment.json + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_GetByAzureApiManagementService_example.json */ /** - * Sample code: Put exemption standard assignment. + * 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 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(); + public static void getsAnAzureAPIManagementAPIIfItHasBeenOnboardedToMicrosoftDefenderForAPIs( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.apiCollections() + .getByAzureApiManagementServiceWithResponse("rg1", "apimService1", "echo-api", + com.azure.core.util.Context.NONE); } } ``` -### StandardAssignments_Delete +### Topology_ListByHomeRegion ```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 StandardAssignments Delete. + * Samples for IotSecuritySolution Update. */ -public final class StandardAssignmentsDeleteSamples { +public final class IotSecuritySolutionUpdateSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ - * DeleteStandardAssignment.json + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * UpdateIoTSecuritySolution.json */ /** - * Sample code: Delete a standard assignment. + * Sample code: Use this method to update existing IoT Security solution. * * @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); + 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; } } ``` -### StandardAssignments_Get +### WorkspaceSettings_Create ```java /** - * Samples for StandardAssignments Get. + * Samples for Tasks ListByResourceGroup. */ -public final class StandardAssignmentsGetSamples { +public final class TasksListByResourceGroupSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ - * GetStandardAssignment.json + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTasksResourceGroupLocation_example.json */ /** - * Sample code: Retrieve a standard assignment. + * Sample code: Get security recommendation tasks in a resource group. * * @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); + public static void + getSecurityRecommendationTasksInAResourceGroup(com.azure.resourcemanager.security.SecurityManager manager) { + manager.tasks().listByResourceGroup("myRg", "westeurope", null, com.azure.core.util.Context.NONE); } } ``` -### StandardAssignments_List +### WorkspaceSettings_Delete ```java /** - * Samples for StandardAssignments List. + * Samples for ServerVulnerabilityAssessment Delete. */ -public final class StandardAssignmentsListSamples { +public final class ServerVulnerabilityAssessmentDeleteSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ - * ListStandardAssignments.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * ServerVulnerabilityAssessments/DeleteServerVulnerabilityAssessments_example.json */ /** - * Sample code: List standard assignments. + * 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 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); + public static void + deleteAServerVulnerabilityAssessmentsOnAResourceOnlyDefaultResourceIsSupportedOnceDeletingMicrosoftSecurityWillNotProvideVulnerabilityAssessmentFindingsOnTheResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.serverVulnerabilityAssessments() + .delete("rg1", "Microsoft.Compute", "virtualMachines", "vm1", com.azure.core.util.Context.NONE); } } ``` -### Topology_Get +### WorkspaceSettings_Get ```java /** - * Samples for Topology Get. + * Samples for AzureDevOpsOrgs Get. */ -public final class TopologyGetSamples { +public final class AzureDevOpsOrgsGetSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/ - * GetTopology_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2025-03-01/examples/SecurityConnectorsDevOps/ + * GetAzureDevOpsOrgs_example.json */ /** - * Sample code: Get topology. + * Sample code: Get_AzureDevOpsOrgs. * * @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); + public static void getAzureDevOpsOrgs(com.azure.resourcemanager.security.SecurityManager manager) { + manager.azureDevOpsOrgs() + .getWithResponse("myRg", "mySecurityConnectorName", "myAzDevOpsOrg", com.azure.core.util.Context.NONE); } } ``` -### Topology_List +### WorkspaceSettings_List ```java /** - * Samples for Topology List. + * Samples for ServerVulnerabilityAssessment ListByExtendedResource. */ -public final class TopologyListSamples { +public final class ServerVulnerabilityAssessmentListByExtendedResourceSamples { /* - * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/ - * GetTopologySubscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * ServerVulnerabilityAssessments/ListByExtendedResourceServerVulnerabilityAssessments_example.json */ /** - * Sample code: Get topology on a subscription. + * 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 getTopologyOnASubscription(com.azure.resourcemanager.security.SecurityManager manager) { - manager.topologies().list(com.azure.core.util.Context.NONE); + public static void + getAListOfServerVulnerabilityAssessmentsOnAResourceThoughThisAPIReturnsAListCurrentlyMicrosoftSecurityOnlySupportsASingleDefaultTypeOfServerVulnerabilityAssessment( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.serverVulnerabilityAssessments() + .listByExtendedResourceWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", + com.azure.core.util.Context.NONE); } } ``` -### Topology_ListByHomeRegion +### WorkspaceSettings_Update ```java /** - * Samples for Topology ListByHomeRegion. + * Samples for Pricings Delete. */ -public final class TopologyListByHomeRegionSamples { +public final class PricingsDeleteSamples { /* * x-ms-original-file: - * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/ - * GetTopologySubscriptionLocation_example.json + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * DeleteResourcePricing_example.json */ /** - * Sample code: Get topology on a subscription from security data location. + * Sample code: Delete a pricing on resource. * * @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); + 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); } } ``` diff --git a/sdk/security/azure-resourcemanager-security/pom.xml b/sdk/security/azure-resourcemanager-security/pom.xml index 9220f1fe5979..3141edbdd021 100644 --- a/sdk/security/azure-resourcemanager-security/pom.xml +++ b/sdk/security/azure-resourcemanager-security/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -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..69442283ccd8 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 @@ -22,69 +22,159 @@ 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.ApplicationOperationsImpl; +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.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.ConnectorsImpl; +import com.azure.resourcemanager.security.implementation.CustomAssessmentAutomationsImpl; +import com.azure.resourcemanager.security.implementation.CustomEntityStoreAssignmentsImpl; import com.azure.resourcemanager.security.implementation.CustomRecommendationsImpl; +import com.azure.resourcemanager.security.implementation.DefenderForStoragesImpl; +import com.azure.resourcemanager.security.implementation.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.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.OperationsImpl; import com.azure.resourcemanager.security.implementation.PricingsImpl; +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.ResourceProvidersImpl; 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.SecurityConnectorApplicationOperationsImpl; +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.SoftwareInventoriesImpl; +import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentBaselineRulesImpl; +import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentScanResultsImpl; +import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentScansImpl; import com.azure.resourcemanager.security.implementation.StandardAssignmentsImpl; +import com.azure.resourcemanager.security.implementation.SubAssessmentsImpl; +import com.azure.resourcemanager.security.implementation.TasksImpl; import com.azure.resourcemanager.security.implementation.TopologiesImpl; +import com.azure.resourcemanager.security.implementation.WorkspaceSettingsImpl; import com.azure.resourcemanager.security.models.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.ApplicationOperations; +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.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.Connectors; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomations; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignments; import com.azure.resourcemanager.security.models.CustomRecommendations; +import com.azure.resourcemanager.security.models.DefenderForStorages; +import com.azure.resourcemanager.security.models.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.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.Operations; import com.azure.resourcemanager.security.models.Pricings; +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.ResourceProviders; 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.SecurityConnectorApplicationOperations; +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.SoftwareInventories; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentBaselineRules; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanResults; +import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScans; import com.azure.resourcemanager.security.models.StandardAssignments; +import com.azure.resourcemanager.security.models.SubAssessments; +import com.azure.resourcemanager.security.models.Tasks; import com.azure.resourcemanager.security.models.Topologies; +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; @@ -93,6 +183,72 @@ * API spec for Microsoft.Security (Azure Security Center) resource provider. */ public final class SecurityManager { + private Locations locations; + + private Tasks tasks; + + private AutoProvisioningSettings autoProvisioningSettings; + + private Compliances compliances; + + private InformationProtectionPolicies informationProtectionPolicies; + + private WorkspaceSettings workspaceSettings; + + private AlertsSuppressionRules alertsSuppressionRules; + + private RegulatoryComplianceStandards regulatoryComplianceStandards; + + private RegulatoryComplianceControls regulatoryComplianceControls; + + private RegulatoryComplianceAssessments regulatoryComplianceAssessments; + + private SubAssessments subAssessments; + + private Connectors connectors; + + private SoftwareInventories softwareInventories; + + private CustomAssessmentAutomations customAssessmentAutomations; + + private CustomEntityStoreAssignments customEntityStoreAssignments; + + private MdeOnboardings mdeOnboardings; + + private GovernanceAssignments governanceAssignments; + + private GovernanceRules governanceRules; + + private Applications applications; + + private ApplicationOperations applicationOperations; + + private SecurityConnectorApplications securityConnectorApplications; + + private SecurityConnectorApplicationOperations securityConnectorApplicationOperations; + + private SecurityOperators securityOperators; + + private SqlVulnerabilityAssessmentBaselineRules sqlVulnerabilityAssessmentBaselineRules; + + private SqlVulnerabilityAssessmentScans sqlVulnerabilityAssessmentScans; + + private SqlVulnerabilityAssessmentScanResults sqlVulnerabilityAssessmentScanResults; + + private SensitivitySettings sensitivitySettings; + + private HealthReports healthReports; + + private Automations automations; + + private SecurityContacts securityContacts; + + private SecurityConnectors securityConnectors; + + private Operations operations; + + private ResourceProviders resourceProviders; + private ComplianceResults complianceResults; private AdvancedThreatProtections advancedThreatProtections; @@ -149,6 +305,28 @@ public final class SecurityManager { private CustomRecommendations customRecommendations; + private DefenderForStorages defenderForStorages; + + private AzureDevOpsOrgs azureDevOpsOrgs; + + private AzureDevOpsProjects azureDevOpsProjects; + + private AzureDevOpsRepos azureDevOpsRepos; + + private DevOpsConfigurations devOpsConfigurations; + + private GitHubOwners gitHubOwners; + + private GitHubRepos gitHubRepos; + + private GitLabGroups gitLabGroups; + + private GitLabSubgroups gitLabSubgroups; + + private GitLabProjects gitLabProjects; + + private DevOpsOperationResults devOpsOperationResults; + private final SecurityCenter clientObject; private SecurityManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -201,6 +379,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 +489,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")) @@ -359,6 +542,415 @@ public SecurityManager authenticate(TokenCredential credential, AzureProfile pro } } + /** + * 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 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 AutoProvisioningSettings. It manages AutoProvisioningSetting. + * + * @return Resource collection API of AutoProvisioningSettings. + */ + public AutoProvisioningSettings autoProvisioningSettings() { + if (this.autoProvisioningSettings == null) { + this.autoProvisioningSettings + = new AutoProvisioningSettingsImpl(clientObject.getAutoProvisioningSettings(), this); + } + return autoProvisioningSettings; + } + + /** + * Gets the resource collection API of Compliances. + * + * @return Resource collection API of Compliances. + */ + public Compliances compliances() { + if (this.compliances == null) { + this.compliances = new CompliancesImpl(clientObject.getCompliances(), this); + } + return compliances; + } + + /** + * Gets the resource collection API of InformationProtectionPolicies. It manages InformationProtectionPolicy. + * + * @return Resource collection API of InformationProtectionPolicies. + */ + public InformationProtectionPolicies informationProtectionPolicies() { + if (this.informationProtectionPolicies == null) { + this.informationProtectionPolicies + = new InformationProtectionPoliciesImpl(clientObject.getInformationProtectionPolicies(), this); + } + return informationProtectionPolicies; + } + + /** + * Gets the resource collection API of WorkspaceSettings. It manages WorkspaceSetting. + * + * @return Resource collection API of WorkspaceSettings. + */ + public WorkspaceSettings workspaceSettings() { + if (this.workspaceSettings == null) { + this.workspaceSettings = new WorkspaceSettingsImpl(clientObject.getWorkspaceSettings(), this); + } + return workspaceSettings; + } + + /** + * Gets the resource collection API of AlertsSuppressionRules. + * + * @return Resource collection API of AlertsSuppressionRules. + */ + public AlertsSuppressionRules alertsSuppressionRules() { + if (this.alertsSuppressionRules == null) { + this.alertsSuppressionRules + = new AlertsSuppressionRulesImpl(clientObject.getAlertsSuppressionRules(), this); + } + return alertsSuppressionRules; + } + + /** + * Gets the resource collection API of RegulatoryComplianceStandards. + * + * @return Resource collection API of RegulatoryComplianceStandards. + */ + public RegulatoryComplianceStandards regulatoryComplianceStandards() { + if (this.regulatoryComplianceStandards == null) { + this.regulatoryComplianceStandards + = new RegulatoryComplianceStandardsImpl(clientObject.getRegulatoryComplianceStandards(), this); + } + return regulatoryComplianceStandards; + } + + /** + * Gets the resource collection API of RegulatoryComplianceControls. + * + * @return Resource collection API of RegulatoryComplianceControls. + */ + public RegulatoryComplianceControls regulatoryComplianceControls() { + if (this.regulatoryComplianceControls == null) { + this.regulatoryComplianceControls + = new RegulatoryComplianceControlsImpl(clientObject.getRegulatoryComplianceControls(), this); + } + return regulatoryComplianceControls; + } + + /** + * Gets the resource collection API of RegulatoryComplianceAssessments. + * + * @return Resource collection API of RegulatoryComplianceAssessments. + */ + public RegulatoryComplianceAssessments regulatoryComplianceAssessments() { + if (this.regulatoryComplianceAssessments == null) { + this.regulatoryComplianceAssessments + = new RegulatoryComplianceAssessmentsImpl(clientObject.getRegulatoryComplianceAssessments(), this); + } + return regulatoryComplianceAssessments; + } + + /** + * 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 the resource collection API of Connectors. It manages ConnectorSetting. + * + * @return Resource collection API of Connectors. + */ + public Connectors connectors() { + if (this.connectors == null) { + this.connectors = new ConnectorsImpl(clientObject.getConnectors(), this); + } + return connectors; + } + + /** + * Gets the resource collection API of SoftwareInventories. + * + * @return Resource collection API of SoftwareInventories. + */ + public SoftwareInventories softwareInventories() { + if (this.softwareInventories == null) { + this.softwareInventories = new SoftwareInventoriesImpl(clientObject.getSoftwareInventories(), this); + } + return softwareInventories; + } + + /** + * Gets the resource collection API of CustomAssessmentAutomations. It manages CustomAssessmentAutomation. + * + * @return Resource collection API of CustomAssessmentAutomations. + */ + public CustomAssessmentAutomations customAssessmentAutomations() { + if (this.customAssessmentAutomations == null) { + this.customAssessmentAutomations + = new CustomAssessmentAutomationsImpl(clientObject.getCustomAssessmentAutomations(), this); + } + return customAssessmentAutomations; + } + + /** + * Gets the resource collection API of CustomEntityStoreAssignments. It manages CustomEntityStoreAssignment. + * + * @return Resource collection API of CustomEntityStoreAssignments. + */ + public CustomEntityStoreAssignments customEntityStoreAssignments() { + if (this.customEntityStoreAssignments == null) { + this.customEntityStoreAssignments + = new CustomEntityStoreAssignmentsImpl(clientObject.getCustomEntityStoreAssignments(), this); + } + return customEntityStoreAssignments; + } + + /** + * Gets the resource collection API of MdeOnboardings. + * + * @return Resource collection API of MdeOnboardings. + */ + public MdeOnboardings mdeOnboardings() { + if (this.mdeOnboardings == null) { + this.mdeOnboardings = new MdeOnboardingsImpl(clientObject.getMdeOnboardings(), this); + } + return mdeOnboardings; + } + + /** + * Gets the resource collection API of GovernanceAssignments. It manages GovernanceAssignment. + * + * @return Resource collection API of GovernanceAssignments. + */ + public GovernanceAssignments governanceAssignments() { + if (this.governanceAssignments == null) { + this.governanceAssignments = new GovernanceAssignmentsImpl(clientObject.getGovernanceAssignments(), this); + } + return governanceAssignments; + } + + /** + * Gets the resource collection API of GovernanceRules. It manages GovernanceRule. + * + * @return Resource collection API of GovernanceRules. + */ + public GovernanceRules governanceRules() { + if (this.governanceRules == null) { + this.governanceRules = new GovernanceRulesImpl(clientObject.getGovernanceRules(), this); + } + return governanceRules; + } + + /** + * Gets the resource collection API of Applications. + * + * @return Resource collection API of Applications. + */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); + } + return applications; + } + + /** + * Gets the resource collection API of ApplicationOperations. It manages Application. + * + * @return Resource collection API of ApplicationOperations. + */ + public ApplicationOperations applicationOperations() { + if (this.applicationOperations == null) { + this.applicationOperations = new ApplicationOperationsImpl(clientObject.getApplicationOperations(), this); + } + return applicationOperations; + } + + /** + * 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 SecurityConnectorApplicationOperations. + * + * @return Resource collection API of SecurityConnectorApplicationOperations. + */ + public SecurityConnectorApplicationOperations securityConnectorApplicationOperations() { + if (this.securityConnectorApplicationOperations == null) { + this.securityConnectorApplicationOperations = new SecurityConnectorApplicationOperationsImpl( + clientObject.getSecurityConnectorApplicationOperations(), this); + } + return securityConnectorApplicationOperations; + } + + /** + * 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 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 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 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 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 HealthReports. + * + * @return Resource collection API of HealthReports. + */ + public HealthReports healthReports() { + if (this.healthReports == null) { + this.healthReports = new HealthReportsImpl(clientObject.getHealthReports(), this); + } + return healthReports; + } + + /** + * Gets the resource collection API of Automations. It manages Automation. + * + * @return Resource collection API of Automations. + */ + public Automations automations() { + if (this.automations == null) { + this.automations = new AutomationsImpl(clientObject.getAutomations(), this); + } + return automations; + } + + /** + * Gets the resource collection API of SecurityContacts. It manages SecurityContact. + * + * @return Resource collection API of SecurityContacts. + */ + public SecurityContacts securityContacts() { + if (this.securityContacts == null) { + this.securityContacts = new SecurityContactsImpl(clientObject.getSecurityContacts(), this); + } + return securityContacts; + } + + /** + * Gets the resource collection API of SecurityConnectors. It manages SecurityConnector. + * + * @return Resource collection API of SecurityConnectors. + */ + public SecurityConnectors securityConnectors() { + if (this.securityConnectors == null) { + this.securityConnectors = new SecurityConnectorsImpl(clientObject.getSecurityConnectors(), this); + } + return securityConnectors; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + /** * Gets the resource collection API of ComplianceResults. * @@ -706,6 +1298,139 @@ public CustomRecommendations customRecommendations() { return customRecommendations; } + /** + * 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 AzureDevOpsOrgs. It manages AzureDevOpsOrg. + * + * @return Resource collection API of AzureDevOpsOrgs. + */ + public AzureDevOpsOrgs azureDevOpsOrgs() { + if (this.azureDevOpsOrgs == null) { + this.azureDevOpsOrgs = new AzureDevOpsOrgsImpl(clientObject.getAzureDevOpsOrgs(), this); + } + return azureDevOpsOrgs; + } + + /** + * Gets the resource collection API of AzureDevOpsProjects. It manages AzureDevOpsProject. + * + * @return Resource collection API of AzureDevOpsProjects. + */ + public AzureDevOpsProjects azureDevOpsProjects() { + if (this.azureDevOpsProjects == null) { + this.azureDevOpsProjects = new AzureDevOpsProjectsImpl(clientObject.getAzureDevOpsProjects(), this); + } + return azureDevOpsProjects; + } + + /** + * Gets the resource collection API of AzureDevOpsRepos. It manages AzureDevOpsRepository. + * + * @return Resource collection API of AzureDevOpsRepos. + */ + public AzureDevOpsRepos azureDevOpsRepos() { + if (this.azureDevOpsRepos == null) { + this.azureDevOpsRepos = new AzureDevOpsReposImpl(clientObject.getAzureDevOpsRepos(), this); + } + return azureDevOpsRepos; + } + + /** + * Gets the resource collection API of DevOpsConfigurations. + * + * @return Resource collection API of DevOpsConfigurations. + */ + public DevOpsConfigurations devOpsConfigurations() { + if (this.devOpsConfigurations == null) { + this.devOpsConfigurations = new DevOpsConfigurationsImpl(clientObject.getDevOpsConfigurations(), this); + } + return devOpsConfigurations; + } + + /** + * Gets the resource collection API of GitHubOwners. + * + * @return Resource collection API of GitHubOwners. + */ + public GitHubOwners gitHubOwners() { + if (this.gitHubOwners == null) { + this.gitHubOwners = new GitHubOwnersImpl(clientObject.getGitHubOwners(), this); + } + return gitHubOwners; + } + + /** + * Gets the resource collection API of GitHubRepos. + * + * @return Resource collection API of GitHubRepos. + */ + public GitHubRepos gitHubRepos() { + if (this.gitHubRepos == null) { + this.gitHubRepos = new GitHubReposImpl(clientObject.getGitHubRepos(), this); + } + return gitHubRepos; + } + + /** + * Gets the resource collection API of GitLabGroups. + * + * @return Resource collection API of GitLabGroups. + */ + public GitLabGroups gitLabGroups() { + if (this.gitLabGroups == null) { + this.gitLabGroups = new GitLabGroupsImpl(clientObject.getGitLabGroups(), this); + } + return gitLabGroups; + } + + /** + * Gets the resource collection API of GitLabSubgroups. + * + * @return Resource collection API of GitLabSubgroups. + */ + public GitLabSubgroups gitLabSubgroups() { + if (this.gitLabSubgroups == null) { + this.gitLabSubgroups = new GitLabSubgroupsImpl(clientObject.getGitLabSubgroups(), this); + } + return gitLabSubgroups; + } + + /** + * Gets the resource collection API of GitLabProjects. + * + * @return Resource collection API of GitLabProjects. + */ + public GitLabProjects gitLabProjects() { + if (this.gitLabProjects == null) { + this.gitLabProjects = new GitLabProjectsImpl(clientObject.getGitLabProjects(), this); + } + return gitLabProjects; + } + + /** + * Gets the resource collection API of DevOpsOperationResults. + * + * @return Resource collection API of DevOpsOperationResults. + */ + public DevOpsOperationResults devOpsOperationResults() { + if (this.devOpsOperationResults == null) { + this.devOpsOperationResults + = new DevOpsOperationResultsImpl(clientObject.getDevOpsOperationResults(), this); + } + return devOpsOperationResults; + } + /** * Gets 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/AlertsSuppressionRulesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AlertsSuppressionRulesClient.java new file mode 100644 index 000000000000..4536de8753de --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; + +/** + * An instance of this class provides access to all the operations defined in AlertsSuppressionRulesClient. + */ +public interface AlertsSuppressionRulesClient { + /** + * 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); + + /** + * 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); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApplicationOperationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApplicationOperationsClient.java new file mode 100644 index 000000000000..19482d743f36 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApplicationOperationsClient.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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.ApplicationInner; + +/** + * An instance of this class provides access to all the operations defined in ApplicationOperationsClient. + */ +public interface ApplicationOperationsClient { + /** + * 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); +} 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..a35f403f9bd8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ApplicationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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 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/AutoProvisioningSettingsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutoProvisioningSettingsClient.java new file mode 100644 index 000000000000..385c41b9a00c --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; + +/** + * An instance of this class provides access to all the operations defined in AutoProvisioningSettingsClient. + */ +public interface AutoProvisioningSettingsClient { + /** + * 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); + + /** + * 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); +} 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..7d18996b5d26 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AutomationsClient.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 { + /** + * 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); + + /** + * 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 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 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 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 automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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); + + /** + * 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 within the user's subscription. 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 within the user's subscription. 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..566832c05a50 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.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 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); + + /** + * 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 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 Azure DevOps organization 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 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 Azure DevOps organization 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 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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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); +} 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..8f0c62b56735 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsProjectInner; + +/** + * An instance of this class provides access to all the operations defined in AzureDevOpsProjectsClient. + */ +public interface AzureDevOpsProjectsClient { + /** + * 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 Azure DevOps organization 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, 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 Azure DevOps organization 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, String orgName, + 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 Azure DevOps organization name. + * @param projectName The project 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 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 Azure DevOps organization name. + * @param projectName The project 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 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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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); +} 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..0c8ef8061ae1 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsRepositoryInner; + +/** + * An instance of this class provides access to all the operations defined in AzureDevOpsReposClient. + */ +public interface AzureDevOpsReposClient { + /** + * 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 Azure DevOps organization name. + * @param projectName The project 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, + 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 Azure DevOps organization name. + * @param projectName The project 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, + String orgName, String projectName, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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); +} 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..a592b826901c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CompliancesClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; + +/** + * An instance of this class provides access to all the operations defined in CompliancesClient. + */ +public interface CompliancesClient { + /** + * The Compliance scores of the specific management group. + * + * @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 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 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 list of Compliance objects response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ConnectorsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ConnectorsClient.java new file mode 100644 index 000000000000..7f2e36613828 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ConnectorsClient.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; + +/** + * An instance of this class provides access to all the operations defined in ConnectorsClient. + */ +public interface ConnectorsClient { + /** + * Cloud accounts connectors of a 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 for a subscription, list of all cloud account connectors and their settings as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Cloud accounts connectors of a 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 for a subscription, list of all cloud account connectors and their settings as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String connectorName, Context context); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorSettingInner get(String connectorName); + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String connectorName, + ConnectorSettingInner connectorSetting, Context context); + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorSettingInner createOrUpdate(String connectorName, ConnectorSettingInner connectorSetting); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 connectorName, Context context); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 connectorName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomAssessmentAutomationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomAssessmentAutomationsClient.java new file mode 100644 index 000000000000..d27421608356 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomAssessmentAutomationsClient.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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.CustomAssessmentAutomationInner; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomationRequest; + +/** + * An instance of this class provides access to all the operations defined in CustomAssessmentAutomationsClient. + */ +public interface CustomAssessmentAutomationsClient { + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String customAssessmentAutomationName, Context context); + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomAssessmentAutomationInner getByResourceGroup(String resourceGroupName, String customAssessmentAutomationName); + + /** + * Creates a custom assessment automation + * + * Creates or updates a custom assessment automation for the provided subscription. Please note that providing an + * existing custom assessment automation will replace the existing record. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param customAssessmentAutomationBody Custom Assessment Automation body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Assessment Automation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, + String customAssessmentAutomationName, CustomAssessmentAutomationRequest customAssessmentAutomationBody, + Context context); + + /** + * Creates a custom assessment automation + * + * Creates or updates a custom assessment automation for the provided subscription. Please note that providing an + * existing custom assessment automation will replace the existing record. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param customAssessmentAutomationBody Custom Assessment Automation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Assessment Automation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomAssessmentAutomationInner create(String resourceGroupName, String customAssessmentAutomationName, + CustomAssessmentAutomationRequest customAssessmentAutomationBody); + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 customAssessmentAutomationName, Context context); + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 customAssessmentAutomationName); + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and 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 a list of Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and resource group. + * + * @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 a list of Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations 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/CustomEntityStoreAssignmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomEntityStoreAssignmentsClient.java new file mode 100644 index 000000000000..74a13bec8c99 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomEntityStoreAssignmentsClient.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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.CustomEntityStoreAssignmentInner; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignmentRequest; + +/** + * An instance of this class provides access to all the operations defined in CustomEntityStoreAssignmentsClient. + */ +public interface CustomEntityStoreAssignmentsClient { + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String customEntityStoreAssignmentName, Context context); + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomEntityStoreAssignmentInner getByResourceGroup(String resourceGroupName, + String customEntityStoreAssignmentName); + + /** + * Creates a custom entity store assignment + * + * Creates a custom entity store assignment for the provided subscription, if not already exists. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is GUID. + * @param customEntityStoreAssignmentRequestBody Custom entity store assignment body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom entity store assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, + String customEntityStoreAssignmentName, + CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody, Context context); + + /** + * Creates a custom entity store assignment + * + * Creates a custom entity store assignment for the provided subscription, if not already exists. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is GUID. + * @param customEntityStoreAssignmentRequestBody Custom entity store assignment body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom entity store assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomEntityStoreAssignmentInner create(String resourceGroupName, String customEntityStoreAssignmentName, + CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody); + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String customEntityStoreAssignmentName, + Context context); + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 resourceGroupName, String customEntityStoreAssignmentName); + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and 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 a list of custom entity store assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and resource group. + * + * @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 a list of custom entity store assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments 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/DefenderForStoragesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java new file mode 100644 index 000000000000..99481083dd59 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; +import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; + +/** + * 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 identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage settings for the specified storage account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, SettingNameAutoGenerated settingName, + Context context); + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage settings for the specified storage account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DefenderForStorageSettingInner get(String resourceId, SettingNameAutoGenerated settingName); + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName 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, SettingNameAutoGenerated settingName, + DefenderForStorageSettingInner defenderForStorageSetting, Context context); + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName 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, SettingNameAutoGenerated settingName, + DefenderForStorageSettingInner defenderForStorageSetting); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response startMalwareScanWithResponse(String resourceId, SettingNameAutoGenerated settingName, + Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MalwareScanInner startMalwareScan(String resourceId, SettingNameAutoGenerated settingName); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelMalwareScanWithResponse(String resourceId, SettingNameAutoGenerated settingName, + String scanId, Context context); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MalwareScanInner cancelMalwareScan(String resourceId, SettingNameAutoGenerated settingName, String scanId); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMalwareScanWithResponse(String resourceId, SettingNameAutoGenerated settingName, + String scanId, Context context); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MalwareScanInner getMalwareScan(String resourceId, SettingNameAutoGenerated 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..072a55b3132f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; + +/** + * An instance of this class provides access to all the operations defined in DevOpsConfigurationsClient. + */ +public interface DevOpsConfigurationsClient { + /** + * 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); + + /** + * 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); +} 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..104278955f2d --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 operation result Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops 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 operation result Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops 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/GitHubOwnersClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GitHubOwnersClient.java new file mode 100644 index 000000000000..7a4c2cb6a4a4 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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); + + /** + * 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 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 GitHub owner 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 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 GitHub owner 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 gitHub Owner resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitHubOwnerInner get(String resourceGroupName, String securityConnectorName, String ownerName); +} 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..fc4eb380b972 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.GitHubRepositoryInner; + +/** + * An instance of this class provides access to all the operations defined in GitHubReposClient. + */ +public interface GitHubReposClient { + /** + * 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 GitHub owner 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, 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 GitHub owner 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, String ownerName, + 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 GitHub owner name. + * @param repoName The repository 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 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 GitHub owner name. + * @param repoName The repository 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 gitHub Repository resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitHubRepositoryInner get(String resourceGroupName, String securityConnectorName, String ownerName, + String repoName); +} 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..a20ab3e0215d --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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); + + /** + * 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 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 GitLab group fully-qualified 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 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 GitLab group fully-qualified 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 gitLab Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitLabGroupInner get(String resourceGroupName, String securityConnectorName, String groupFQName); +} 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..9faf6c688bcc --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.GitLabProjectInner; + +/** + * An instance of this class provides access to all the operations defined in GitLabProjectsClient. + */ +public interface GitLabProjectsClient { + /** + * 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 GitLab group fully-qualified 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 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 GitLab group fully-qualified 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 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); + + /** + * 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 GitLab group fully-qualified name. + * @param projectName The project 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 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 GitLab group fully-qualified name. + * @param projectName The project 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 gitLab Project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GitLabProjectInner get(String resourceGroupName, String securityConnectorName, String groupFQName, + String projectName); +} 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..ffcc005c753b --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 GitLab group fully-qualified 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 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 GitLab group fully-qualified 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 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..bb00ad61eea3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceAssignmentsClient.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.GovernanceAssignmentInner; + +/** + * An instance of this class provides access to all the operations defined in GovernanceAssignmentsClient. + */ +public interface GovernanceAssignmentsClient { + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the Governance assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 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); + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the Governance assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required governance assignment. + * @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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required governance assignment. + * @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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String assessmentName, String assignmentKey); +} 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..a75e3e9290b6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/GovernanceRulesClient.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +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.OperationResultAutoGeneratedInner; +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 list of all relevant governance rules over a scope. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 governance rules over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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); + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 rules. 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 ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @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 rules. 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 ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @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) + OperationResultAutoGeneratedInner 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..2db32bbb22aa --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.HealthReportInner; + +/** + * An instance of this class provides access to all the operations defined in HealthReportsClient. + */ +public interface HealthReportsClient { + /** + * 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 scope at which the operation is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 scope at which the operation is performed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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); + + /** + * Get health report of resource. + * + * @param resourceId The identifier of the resource. + * @param healthReportName The health report Key - Unique key for the health report 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 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 identifier of the resource. + * @param healthReportName The health report Key - Unique key for the health report 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 health report of resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthReportInner get(String resourceId, String healthReportName); +} 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..4004e84aa103 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/InformationProtectionPoliciesClient.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 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 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 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 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/LocationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/LocationsClient.java new file mode 100644 index 000000000000..3addbc8dafd4 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AscLocationInner; + +/** + * An instance of this class provides access to all the operations defined in LocationsClient. + */ +public interface LocationsClient { + /** + * 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); + + /** + * 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); +} 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..1326b7d829a9 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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(); + + /** + * 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(); +} 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..3ce1a1869f47 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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/RegulatoryComplianceAssessmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/RegulatoryComplianceAssessmentsClient.java new file mode 100644 index 000000000000..36f7fb66f1ae --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceAssessmentInner; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceAssessmentsClient. + */ +public interface RegulatoryComplianceAssessmentsClient { + /** + * 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); + + /** + * 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); +} 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..d5da21d07924 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceControlInner; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceControlsClient. + */ +public interface RegulatoryComplianceControlsClient { + /** + * 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); + + /** + * 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); +} 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..598e1cdedbd4 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.RegulatoryComplianceStandardInner; + +/** + * An instance of this class provides access to all the operations defined in RegulatoryComplianceStandardsClient. + */ +public interface RegulatoryComplianceStandardsClient { + /** + * 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); + + /** + * 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); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ResourceProvidersClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..e4538423cdaf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/ResourceProvidersClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ScenarioResponseInner; +import com.azure.resourcemanager.security.models.ParametersSchema; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public interface ResourceProvidersClient { + /** + * Fetch Microsoft Defender for Cloud data over a specified view. + * + * @param parameters Additional parameters supplied to the 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 query result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response viewWithResponse(ParametersSchema parameters, Context context); + + /** + * Fetch Microsoft Defender for Cloud data over a specified view. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScenarioResponseInner view(); +} 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..aa8f8a29dbdb 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 @@ -39,6 +39,237 @@ public interface SecurityCenter { */ Duration getDefaultPollInterval(); + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * Gets the TasksClient object to access its operations. + * + * @return the TasksClient object. + */ + TasksClient getTasks(); + + /** + * Gets the AutoProvisioningSettingsClient object to access its operations. + * + * @return the AutoProvisioningSettingsClient object. + */ + AutoProvisioningSettingsClient getAutoProvisioningSettings(); + + /** + * Gets the CompliancesClient object to access its operations. + * + * @return the CompliancesClient object. + */ + CompliancesClient getCompliances(); + + /** + * Gets the InformationProtectionPoliciesClient object to access its operations. + * + * @return the InformationProtectionPoliciesClient object. + */ + InformationProtectionPoliciesClient getInformationProtectionPolicies(); + + /** + * Gets the WorkspaceSettingsClient object to access its operations. + * + * @return the WorkspaceSettingsClient object. + */ + WorkspaceSettingsClient getWorkspaceSettings(); + + /** + * Gets the AlertsSuppressionRulesClient object to access its operations. + * + * @return the AlertsSuppressionRulesClient object. + */ + AlertsSuppressionRulesClient getAlertsSuppressionRules(); + + /** + * 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 SubAssessmentsClient object to access its operations. + * + * @return the SubAssessmentsClient object. + */ + SubAssessmentsClient getSubAssessments(); + + /** + * Gets the ConnectorsClient object to access its operations. + * + * @return the ConnectorsClient object. + */ + ConnectorsClient getConnectors(); + + /** + * Gets the SoftwareInventoriesClient object to access its operations. + * + * @return the SoftwareInventoriesClient object. + */ + SoftwareInventoriesClient getSoftwareInventories(); + + /** + * Gets the CustomAssessmentAutomationsClient object to access its operations. + * + * @return the CustomAssessmentAutomationsClient object. + */ + CustomAssessmentAutomationsClient getCustomAssessmentAutomations(); + + /** + * Gets the CustomEntityStoreAssignmentsClient object to access its operations. + * + * @return the CustomEntityStoreAssignmentsClient object. + */ + CustomEntityStoreAssignmentsClient getCustomEntityStoreAssignments(); + + /** + * Gets the MdeOnboardingsClient object to access its operations. + * + * @return the MdeOnboardingsClient object. + */ + MdeOnboardingsClient getMdeOnboardings(); + + /** + * Gets the GovernanceAssignmentsClient object to access its operations. + * + * @return the GovernanceAssignmentsClient object. + */ + GovernanceAssignmentsClient getGovernanceAssignments(); + + /** + * Gets the GovernanceRulesClient object to access its operations. + * + * @return the GovernanceRulesClient object. + */ + GovernanceRulesClient getGovernanceRules(); + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + ApplicationsClient getApplications(); + + /** + * Gets the ApplicationOperationsClient object to access its operations. + * + * @return the ApplicationOperationsClient object. + */ + ApplicationOperationsClient getApplicationOperations(); + + /** + * Gets the SecurityConnectorApplicationsClient object to access its operations. + * + * @return the SecurityConnectorApplicationsClient object. + */ + SecurityConnectorApplicationsClient getSecurityConnectorApplications(); + + /** + * Gets the SecurityConnectorApplicationOperationsClient object to access its operations. + * + * @return the SecurityConnectorApplicationOperationsClient object. + */ + SecurityConnectorApplicationOperationsClient getSecurityConnectorApplicationOperations(); + + /** + * Gets the SecurityOperatorsClient object to access its operations. + * + * @return the SecurityOperatorsClient object. + */ + SecurityOperatorsClient getSecurityOperators(); + + /** + * Gets the SqlVulnerabilityAssessmentBaselineRulesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselineRulesClient object. + */ + SqlVulnerabilityAssessmentBaselineRulesClient getSqlVulnerabilityAssessmentBaselineRules(); + + /** + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScansClient object. + */ + SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans(); + + /** + * Gets the SqlVulnerabilityAssessmentScanResultsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScanResultsClient object. + */ + SqlVulnerabilityAssessmentScanResultsClient getSqlVulnerabilityAssessmentScanResults(); + + /** + * Gets the SensitivitySettingsClient object to access its operations. + * + * @return the SensitivitySettingsClient object. + */ + SensitivitySettingsClient getSensitivitySettings(); + + /** + * Gets the HealthReportsClient object to access its operations. + * + * @return the HealthReportsClient object. + */ + HealthReportsClient getHealthReports(); + + /** + * 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 SecurityConnectorsClient object to access its operations. + * + * @return the SecurityConnectorsClient object. + */ + SecurityConnectorsClient getSecurityConnectors(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + /** * Gets the ComplianceResultsClient object to access its operations. * @@ -234,4 +465,81 @@ public interface SecurityCenter { * @return the CustomRecommendationsClient object. */ CustomRecommendationsClient getCustomRecommendations(); + + /** + * Gets the DefenderForStoragesClient object to access its operations. + * + * @return the DefenderForStoragesClient object. + */ + DefenderForStoragesClient getDefenderForStorages(); + + /** + * Gets the AzureDevOpsOrgsClient object to access its operations. + * + * @return the AzureDevOpsOrgsClient object. + */ + AzureDevOpsOrgsClient getAzureDevOpsOrgs(); + + /** + * Gets the AzureDevOpsProjectsClient object to access its operations. + * + * @return the AzureDevOpsProjectsClient object. + */ + AzureDevOpsProjectsClient getAzureDevOpsProjects(); + + /** + * Gets the AzureDevOpsReposClient object to access its operations. + * + * @return the AzureDevOpsReposClient object. + */ + AzureDevOpsReposClient getAzureDevOpsRepos(); + + /** + * Gets the DevOpsConfigurationsClient object to access its operations. + * + * @return the DevOpsConfigurationsClient object. + */ + DevOpsConfigurationsClient getDevOpsConfigurations(); + + /** + * Gets the GitHubOwnersClient object to access its operations. + * + * @return the GitHubOwnersClient object. + */ + GitHubOwnersClient getGitHubOwners(); + + /** + * Gets the GitHubReposClient object to access its operations. + * + * @return the GitHubReposClient object. + */ + GitHubReposClient getGitHubRepos(); + + /** + * Gets the GitLabGroupsClient object to access its operations. + * + * @return the GitLabGroupsClient object. + */ + GitLabGroupsClient getGitLabGroups(); + + /** + * Gets the GitLabSubgroupsClient object to access its operations. + * + * @return the GitLabSubgroupsClient object. + */ + GitLabSubgroupsClient getGitLabSubgroups(); + + /** + * Gets the GitLabProjectsClient object to access its operations. + * + * @return the GitLabProjectsClient object. + */ + GitLabProjectsClient getGitLabProjects(); + + /** + * Gets the DevOpsOperationResultsClient object to access its operations. + * + * @return the DevOpsOperationResultsClient object. + */ + DevOpsOperationResultsClient getDevOpsOperationResults(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorApplicationOperationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorApplicationOperationsClient.java new file mode 100644 index 000000000000..8a5151b95281 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorApplicationOperationsClient.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; + +/** + * An instance of this class provides access to all the operations defined in + * SecurityConnectorApplicationOperationsClient. + */ +public interface SecurityConnectorApplicationOperationsClient { + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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); +} 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..fd9ab063f4d8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorApplicationsClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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 list of all relevant applications over a security connector level scope. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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..c213bebdc82b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityConnectorsClient.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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 { + /** + * 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); + + /** + * 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 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 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 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 connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves details of a specific security connector. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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); +} 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..ed6a348f7243 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 { + /** + * 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); + + /** + * 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); +} 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..1971f46dd42e --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorListInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityOperatorsClient. + */ +public interface SecurityOperatorsClient { + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String pricingName, Context 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 com.azure.core.management.exception.ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityOperatorListInner list(String pricingName); + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName name of the pricing configuration. + * @param securityOperatorName name of the securityOperator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 securityOperator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 securityOperator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); +} 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..3a777e018198 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 { + /** + * 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 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(); + + /** + * 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/SoftwareInventoriesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SoftwareInventoriesClient.java new file mode 100644 index 000000000000..44c87aa6b343 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SoftwareInventoriesClient.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; + +/** + * An instance of this class provides access to all the operations defined in SoftwareInventoriesClient. + */ +public interface SoftwareInventoriesClient { + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName); + + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName, Context context); + + /** + * Gets the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a single software data of the virtual machine. + * + * @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 softwareName Name of the installed software. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String resourceNamespace, String resourceType, + String resourceName, String softwareName, Context context); + + /** + * Gets a single software data of the virtual machine. + * + * @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 softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SoftwareInner get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, + String softwareName); +} 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..4ddb2758ac86 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentBaselineRulesClient.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 { + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @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 ruleId, String workspaceId, String resourceId, + RuleResultsInput body, Context context); + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RuleResultsInner createOrUpdate(String ruleId, String workspaceId, String resourceId); + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the results for a given rule in the Baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String ruleId, String workspaceId, String resourceId, Context context); + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RuleResultsInner get(String ruleId, String workspaceId, String resourceId); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String ruleId, String workspaceId, String resourceId, Context context); + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String ruleId, String workspaceId, String resourceId); + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @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 the results for all rules in the Baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String workspaceId, String resourceId, Context context); + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @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 the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RulesResultsInner list(String workspaceId, String resourceId); + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 workspaceId, String resourceId, RulesResultsInput body, + Context context); + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @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 a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RulesResultsInner add(String workspaceId, 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..c669c0462cd7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScanResultsClient.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; + +/** + * 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. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @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 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 workspaceId, String resourceId, + Context context); + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @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 the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanResultInner get(String scanId, String scanResultId, String workspaceId, String resourceId); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @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 a list of scan results for a single scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String scanId, String workspaceId, String resourceId, Context context); + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @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 a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanResultsInner list(String scanId, String workspaceId, String resourceId); +} 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..d87cdc9a5583 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SqlVulnerabilityAssessmentScansClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; + +/** + * An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentScansClient. + */ +public interface SqlVulnerabilityAssessmentScansClient { + /** + * 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 workspaceId The workspace Id. + * @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 the scan details of a single scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scanId, String workspaceId, String resourceId, 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 workspaceId The workspace Id. + * @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 the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScanInner get(String scanId, String workspaceId, String resourceId); + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @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 a list of scan records along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String workspaceId, String resourceId, Context context); + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @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 a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScansInner list(String workspaceId, String resourceId); +} 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..4c3cc7e17d9d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SubAssessmentsClient.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecuritySubAssessmentInner; + +/** + * An instance of this class provides access to all the operations defined in SubAssessmentsClient. + */ +public interface SubAssessmentsClient { + /** + * Get security sub-assessments on all your scanned resources inside a subscription 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 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 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 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); + + /** + * Get security sub-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 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. + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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. + * @throws com.azure.core.management.exception.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 a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The 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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The 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); +} 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..5e45193f7e01 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/TasksClient.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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. + * + * @throws com.azure.core.management.exception.ManagementException thrown 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); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + * @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. + * + * @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 com.azure.core.management.exception.ManagementException thrown 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 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 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 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 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 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 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 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 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 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 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); +} 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..246993e8efde --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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. + * + * @throws com.azure.core.management.exception.ManagementException thrown 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); + + /** + * 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); +} 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..b82361145a2d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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; + + /* + * 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 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 { + 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..b7d82f67d8ea --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.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/ApplicationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationInner.java new file mode 100644 index 000000000000..15d33f5044d4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationInner.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.ApplicationSourceResourceType; +import java.io.IOException; +import java.util.List; + +/** + * Security Application over a given scope. + */ +@Fluent +public final class ApplicationInner extends ProxyResource { + /* + * Properties of a security application + */ + private ApplicationProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ApplicationInner class. + */ + public ApplicationInner() { + } + + /** + * Get the innerProperties property: Properties of a security application. + * + * @return the innerProperties value. + */ + private ApplicationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the displayName property: display name of the application. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: display name of the application. + * + * @param displayName the displayName value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: description of the application. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: description of the application. + * + * @param description the description value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withDescription(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.innerProperties() == null ? null : this.innerProperties().sourceResourceType(); + } + + /** + * Set the sourceResourceType property: The application source, what it affects, e.g. Assessments. + * + * @param sourceResourceType the sourceResourceType value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withSourceResourceType(ApplicationSourceResourceType sourceResourceType) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withSourceResourceType(sourceResourceType); + return this; + } + + /** + * Get the conditionSets property: The application conditionSets - see examples. + * + * @return the conditionSets value. + */ + public List 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 { + 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..1945a5b0e02e --- /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) AutoRest 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..7c76d517f65c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ASC location of the subscription is in the "name" field. + */ +@Fluent +public final class AscLocationInner extends ProxyResource { + /* + * An empty set of properties + */ + private Object properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AscLocationInner class. + */ + public AscLocationInner() { + } + + /** + * Get the properties property: An empty set of properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: An empty set of properties. + * + * @param properties the properties value to set. + * @return the AscLocationInner object itself. + */ + public AscLocationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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 { + reader.skipChildren(); + } + } + + return deserializedAscLocationInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java new file mode 100644 index 000000000000..0b5606d53831 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AutoProvision; +import java.io.IOException; + +/** + * Auto provisioning setting. + */ +@Fluent +public final class AutoProvisioningSettingInner extends ProxyResource { + /* + * Auto provisioning setting data + */ + private AutoProvisioningSettingProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AutoProvisioningSettingInner class. + */ + public AutoProvisioningSettingInner() { + } + + /** + * Get the innerProperties property: Auto provisioning setting data. + * + * @return the innerProperties value. + */ + private AutoProvisioningSettingProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the autoProvision property: Describes what kind of security agent provisioning action to take. + * + * @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 { + 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..8919653efa8c --- /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) AutoRest 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..e34ac40396a3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AutomationAction; +import com.azure.resourcemanager.security.models.AutomationScope; +import com.azure.resourcemanager.security.models.AutomationSource; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The security automation resource. + */ +@Fluent +public final class AutomationInner extends Resource { + /* + * Security automation data + */ + private AutomationProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AutomationInner class. + */ + public AutomationInner() { + } + + /** + * Get the innerProperties property: Security automation data. + * + * @return the innerProperties value. + */ + private AutomationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public AutomationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AutomationInner 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 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.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutomationInner. + */ + public static AutomationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationInner deserializedAutomationInner = new AutomationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAutomationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAutomationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAutomationInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAutomationInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAutomationInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedAutomationInner.innerProperties = AutomationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationProperties.java new file mode 100644 index 000000000000..4fba434b798f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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..8d5aaeebcd88 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The security automation model state property bag. + */ +@Fluent +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. + */ + public AutomationValidationStatusInner() { + } + + /** + * Get the isValid property: Indicates whether the model is valid or not. + * + * @return the isValid value. + */ + public Boolean isValid() { + return this.isValid; + } + + /** + * Set the isValid property: Indicates whether the model is valid or not. + * + * @param isValid the isValid value to set. + * @return the AutomationValidationStatusInner object itself. + */ + public AutomationValidationStatusInner withIsValid(Boolean isValid) { + this.isValid = isValid; + return this; + } + + /** + * Get the message property: The validation message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The validation message. + * + * @param message the message value to set. + * @return the AutomationValidationStatusInner object itself. + */ + public AutomationValidationStatusInner withMessage(String message) { + this.message = message; + 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("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..3e1809971204 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AzureDevOpsOrgProperties; +import java.io.IOException; + +/** + * Azure DevOps Organization resource. + */ +@Fluent +public final class AzureDevOpsOrgInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * Azure DevOps Organization properties. + */ + private AzureDevOpsOrgProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzureDevOpsOrgInner class. + */ + public AzureDevOpsOrgInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: 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 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 ("systemData".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.properties = AzureDevOpsOrgProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsOrgInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java new file mode 100644 index 000000000000..d1108a13c731 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class AzureDevOpsOrgListResponseInner implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of AzureDevOpsOrgListResponseInner class. + */ + public AzureDevOpsOrgListResponseInner() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the AzureDevOpsOrgListResponseInner object itself. + */ + public AzureDevOpsOrgListResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the AzureDevOpsOrgListResponseInner object itself. + */ + public AzureDevOpsOrgListResponseInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of 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..0bb3e8f5dfc5 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AzureDevOpsProjectProperties; +import java.io.IOException; + +/** + * Azure DevOps Project resource. + */ +@Fluent +public final class AzureDevOpsProjectInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * Azure DevOps Project properties. + */ + private AzureDevOpsProjectProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzureDevOpsProjectInner class. + */ + public AzureDevOpsProjectInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: 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 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 ("systemData".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.properties = AzureDevOpsProjectProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsProjectInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsRepositoryInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsRepositoryInner.java new file mode 100644 index 000000000000..9af9eb9f0ce4 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AzureDevOpsRepositoryProperties; +import java.io.IOException; + +/** + * Azure DevOps Repository resource. + */ +@Fluent +public final class AzureDevOpsRepositoryInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * Azure DevOps Repository properties. + */ + private AzureDevOpsRepositoryProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzureDevOpsRepositoryInner class. + */ + public AzureDevOpsRepositoryInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: 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 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 ("systemData".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.properties + = AzureDevOpsRepositoryProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsRepositoryInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java new file mode 100644 index 000000000000..4a7e8c4e1d19 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.ComplianceSegment; +import 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; + + /* + * 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. + */ + public ComplianceInner() { + } + + /** + * Get the innerProperties property: Compliance data. + * + * @return the innerProperties value. + */ + private ComplianceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted. + * + * @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 { + 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..3e0378f14669 --- /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) AutoRest 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. + */ + public 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/ConnectorSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java new file mode 100644 index 000000000000..3f6bb6260ff7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; +import java.io.IOException; + +/** + * The connector setting. + */ +@Fluent +public final class ConnectorSettingInner extends ProxyResource { + /* + * Connector setting data + */ + private ConnectorSettingProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ConnectorSettingInner class. + */ + public ConnectorSettingInner() { + } + + /** + * Get the innerProperties property: Connector setting data. + * + * @return the innerProperties value. + */ + private ConnectorSettingProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @return the hybridComputeSettings value. + */ + public HybridComputeSettingsProperties hybridComputeSettings() { + return this.innerProperties() == null ? null : this.innerProperties().hybridComputeSettings(); + } + + /** + * Set the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @param hybridComputeSettings the hybridComputeSettings value to set. + * @return the ConnectorSettingInner object itself. + */ + public ConnectorSettingInner withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new ConnectorSettingProperties(); + } + this.innerProperties().withHybridComputeSettings(hybridComputeSettings); + return this; + } + + /** + * Get the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @return the authenticationDetails value. + */ + public AuthenticationDetailsProperties authenticationDetails() { + return this.innerProperties() == null ? null : this.innerProperties().authenticationDetails(); + } + + /** + * Set the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @param authenticationDetails the authenticationDetails value to set. + * @return the ConnectorSettingInner object itself. + */ + public ConnectorSettingInner withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails) { + if (this.innerProperties() == null) { + this.innerProperties = new ConnectorSettingProperties(); + } + this.innerProperties().withAuthenticationDetails(authenticationDetails); + 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 ConnectorSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorSettingInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectorSettingInner. + */ + public static ConnectorSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorSettingInner deserializedConnectorSettingInner = new ConnectorSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConnectorSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedConnectorSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedConnectorSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedConnectorSettingInner.innerProperties = ConnectorSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorSettingInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingProperties.java new file mode 100644 index 000000000000..82e8a6921385 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingProperties.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; +import java.io.IOException; + +/** + * Describes properties of a connector setting. + */ +@Fluent +public final class ConnectorSettingProperties implements JsonSerializable { + /* + * Settings for hybrid compute management. These settings are relevant only for Arc autoProvision (Hybrid Compute). + */ + private HybridComputeSettingsProperties hybridComputeSettings; + + /* + * Settings for authentication management, these settings are relevant only for the cloud connector. + */ + private AuthenticationDetailsProperties authenticationDetails; + + /** + * Creates an instance of ConnectorSettingProperties class. + */ + public ConnectorSettingProperties() { + } + + /** + * Get the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @return the hybridComputeSettings value. + */ + public HybridComputeSettingsProperties hybridComputeSettings() { + return this.hybridComputeSettings; + } + + /** + * Set the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @param hybridComputeSettings the hybridComputeSettings value to set. + * @return the ConnectorSettingProperties object itself. + */ + public ConnectorSettingProperties withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings) { + this.hybridComputeSettings = hybridComputeSettings; + return this; + } + + /** + * Get the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @return the authenticationDetails value. + */ + public AuthenticationDetailsProperties authenticationDetails() { + return this.authenticationDetails; + } + + /** + * Set the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @param authenticationDetails the authenticationDetails value to set. + * @return the ConnectorSettingProperties object itself. + */ + public ConnectorSettingProperties withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails) { + this.authenticationDetails = authenticationDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hybridComputeSettings() != null) { + hybridComputeSettings().validate(); + } + if (authenticationDetails() != null) { + authenticationDetails().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("hybridComputeSettings", this.hybridComputeSettings); + jsonWriter.writeJsonField("authenticationDetails", this.authenticationDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorSettingProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectorSettingProperties. + */ + public static ConnectorSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorSettingProperties deserializedConnectorSettingProperties = new ConnectorSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hybridComputeSettings".equals(fieldName)) { + deserializedConnectorSettingProperties.hybridComputeSettings + = HybridComputeSettingsProperties.fromJson(reader); + } else if ("authenticationDetails".equals(fieldName)) { + deserializedConnectorSettingProperties.authenticationDetails + = AuthenticationDetailsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorSettingProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationInner.java new file mode 100644 index 000000000000..ee2f035c6a23 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationInner.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.SeverityEnum; +import com.azure.resourcemanager.security.models.SupportedCloudEnum; +import java.io.IOException; + +/** + * Custom Assessment Automation. + */ +@Fluent +public final class CustomAssessmentAutomationInner extends ProxyResource { + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * describes Custom Assessment Automation properties. + */ + private CustomAssessmentAutomationProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CustomAssessmentAutomationInner class. + */ + public CustomAssessmentAutomationInner() { + } + + /** + * 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 innerProperties property: describes Custom Assessment Automation properties. + * + * @return the innerProperties value. + */ + private CustomAssessmentAutomationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the compressedQuery property: GZip encoded KQL query representing the assessment automation results required. + * + * @return the compressedQuery value. + */ + public String compressedQuery() { + return this.innerProperties() == null ? null : this.innerProperties().compressedQuery(); + } + + /** + * Set the compressedQuery property: GZip encoded KQL query representing the assessment automation results required. + * + * @param compressedQuery the compressedQuery value to set. + * @return the CustomAssessmentAutomationInner object itself. + */ + public CustomAssessmentAutomationInner withCompressedQuery(String compressedQuery) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationProperties(); + } + this.innerProperties().withCompressedQuery(compressedQuery); + return this; + } + + /** + * Get the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @return the supportedCloud value. + */ + public SupportedCloudEnum supportedCloud() { + return this.innerProperties() == null ? null : this.innerProperties().supportedCloud(); + } + + /** + * Set the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @param supportedCloud the supportedCloud value to set. + * @return the CustomAssessmentAutomationInner object itself. + */ + public CustomAssessmentAutomationInner withSupportedCloud(SupportedCloudEnum supportedCloud) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationProperties(); + } + this.innerProperties().withSupportedCloud(supportedCloud); + return this; + } + + /** + * Get the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @return the severity value. + */ + public SeverityEnum severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @param severity the severity value to set. + * @return the CustomAssessmentAutomationInner object itself. + */ + public CustomAssessmentAutomationInner withSeverity(SeverityEnum severity) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the displayName property: The display name of the assessments generated by this assessment automation. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the assessments generated by this assessment automation. + * + * @param displayName the displayName value to set. + * @return the CustomAssessmentAutomationInner object itself. + */ + public CustomAssessmentAutomationInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @param description the description value to set. + * @return the CustomAssessmentAutomationInner object itself. + */ + public CustomAssessmentAutomationInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.innerProperties() == null ? null : this.innerProperties().remediationDescription(); + } + + /** + * Set the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @param remediationDescription the remediationDescription value to set. + * @return the CustomAssessmentAutomationInner object itself. + */ + public CustomAssessmentAutomationInner withRemediationDescription(String remediationDescription) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationProperties(); + } + this.innerProperties().withRemediationDescription(remediationDescription); + return this; + } + + /** + * Get the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * assessment automation. + * + * @return the assessmentKey value. + */ + public String assessmentKey() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentKey(); + } + + /** + * Set the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * assessment automation. + * + * @param assessmentKey the assessmentKey value to set. + * @return the CustomAssessmentAutomationInner object itself. + */ + public CustomAssessmentAutomationInner withAssessmentKey(String assessmentKey) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationProperties(); + } + this.innerProperties().withAssessmentKey(assessmentKey); + 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 CustomAssessmentAutomationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationInner. + */ + public static CustomAssessmentAutomationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationInner deserializedCustomAssessmentAutomationInner + = new CustomAssessmentAutomationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.innerProperties + = CustomAssessmentAutomationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationProperties.java new file mode 100644 index 000000000000..b4b88b60b16b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationProperties.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.SeverityEnum; +import com.azure.resourcemanager.security.models.SupportedCloudEnum; +import java.io.IOException; + +/** + * describes the Custom Assessment Automation properties. + */ +@Fluent +public final class CustomAssessmentAutomationProperties + implements JsonSerializable { + /* + * GZip encoded KQL query representing the assessment automation results required. + */ + private String compressedQuery; + + /* + * Relevant cloud for the custom assessment automation. + */ + private SupportedCloudEnum supportedCloud = SupportedCloudEnum.AWS; + + /* + * The severity to relate to the assessments generated by this assessment automation. + */ + private SeverityEnum severity = SeverityEnum.LOW; + + /* + * The display name of the assessments generated by this assessment automation. + */ + private String displayName; + + /* + * The description to relate to the assessments generated by this assessment automation. + */ + private String description; + + /* + * The remediation description to relate to the assessments generated by this assessment automation. + */ + private String remediationDescription; + + /* + * The assessment metadata key used when an assessment is generated for this assessment automation. + */ + private String assessmentKey; + + /** + * Creates an instance of CustomAssessmentAutomationProperties class. + */ + public CustomAssessmentAutomationProperties() { + } + + /** + * Get the compressedQuery property: GZip encoded KQL query representing the assessment automation results required. + * + * @return the compressedQuery value. + */ + public String compressedQuery() { + return this.compressedQuery; + } + + /** + * Set the compressedQuery property: GZip encoded KQL query representing the assessment automation results required. + * + * @param compressedQuery the compressedQuery value to set. + * @return the CustomAssessmentAutomationProperties object itself. + */ + public CustomAssessmentAutomationProperties withCompressedQuery(String compressedQuery) { + this.compressedQuery = compressedQuery; + return this; + } + + /** + * Get the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @return the supportedCloud value. + */ + public SupportedCloudEnum supportedCloud() { + return this.supportedCloud; + } + + /** + * Set the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @param supportedCloud the supportedCloud value to set. + * @return the CustomAssessmentAutomationProperties object itself. + */ + public CustomAssessmentAutomationProperties withSupportedCloud(SupportedCloudEnum supportedCloud) { + this.supportedCloud = supportedCloud; + return this; + } + + /** + * Get the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @return the severity value. + */ + public SeverityEnum severity() { + return this.severity; + } + + /** + * Set the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @param severity the severity value to set. + * @return the CustomAssessmentAutomationProperties object itself. + */ + public CustomAssessmentAutomationProperties withSeverity(SeverityEnum severity) { + this.severity = severity; + return this; + } + + /** + * Get the displayName property: The display name of the assessments generated by this assessment automation. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the assessments generated by this assessment automation. + * + * @param displayName the displayName value to set. + * @return the CustomAssessmentAutomationProperties object itself. + */ + public CustomAssessmentAutomationProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @param description the description value to set. + * @return the CustomAssessmentAutomationProperties object itself. + */ + public CustomAssessmentAutomationProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.remediationDescription; + } + + /** + * Set the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @param remediationDescription the remediationDescription value to set. + * @return the CustomAssessmentAutomationProperties object itself. + */ + public CustomAssessmentAutomationProperties withRemediationDescription(String remediationDescription) { + this.remediationDescription = remediationDescription; + return this; + } + + /** + * Get the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * assessment automation. + * + * @return the assessmentKey value. + */ + public String assessmentKey() { + return this.assessmentKey; + } + + /** + * Set the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * assessment automation. + * + * @param assessmentKey the assessmentKey value to set. + * @return the CustomAssessmentAutomationProperties object itself. + */ + public CustomAssessmentAutomationProperties withAssessmentKey(String assessmentKey) { + this.assessmentKey = assessmentKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("compressedQuery", this.compressedQuery); + jsonWriter.writeStringField("supportedCloud", + this.supportedCloud == null ? null : this.supportedCloud.toString()); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("remediationDescription", this.remediationDescription); + jsonWriter.writeStringField("assessmentKey", this.assessmentKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationProperties. + */ + public static CustomAssessmentAutomationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationProperties deserializedCustomAssessmentAutomationProperties + = new CustomAssessmentAutomationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("compressedQuery".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.compressedQuery = reader.getString(); + } else if ("supportedCloud".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.supportedCloud + = SupportedCloudEnum.fromString(reader.getString()); + } else if ("severity".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.severity + = SeverityEnum.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.description = reader.getString(); + } else if ("remediationDescription".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.remediationDescription = reader.getString(); + } else if ("assessmentKey".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.assessmentKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationRequestProperties.java new file mode 100644 index 000000000000..e718ed78ee26 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationRequestProperties.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.SeverityEnum; +import com.azure.resourcemanager.security.models.SupportedCloudEnum; +import java.io.IOException; + +/** + * describes the Custom Assessment Automation properties. + */ +@Fluent +public final class CustomAssessmentAutomationRequestProperties + implements JsonSerializable { + /* + * Base 64 encoded KQL query representing the assessment automation results required. + */ + private String compressedQuery; + + /* + * Relevant cloud for the custom assessment automation. + */ + private SupportedCloudEnum supportedCloud = SupportedCloudEnum.AWS; + + /* + * The severity to relate to the assessments generated by this assessment automation. + */ + private SeverityEnum severity = SeverityEnum.LOW; + + /* + * The display name of the assessments generated by this assessment automation. + */ + private String displayName; + + /* + * The description to relate to the assessments generated by this assessment automation. + */ + private String description; + + /* + * The remediation description to relate to the assessments generated by this assessment automation. + */ + private String remediationDescription; + + /** + * Creates an instance of CustomAssessmentAutomationRequestProperties class. + */ + public CustomAssessmentAutomationRequestProperties() { + } + + /** + * Get the compressedQuery property: Base 64 encoded KQL query representing the assessment automation results + * required. + * + * @return the compressedQuery value. + */ + public String compressedQuery() { + return this.compressedQuery; + } + + /** + * Set the compressedQuery property: Base 64 encoded KQL query representing the assessment automation results + * required. + * + * @param compressedQuery the compressedQuery value to set. + * @return the CustomAssessmentAutomationRequestProperties object itself. + */ + public CustomAssessmentAutomationRequestProperties withCompressedQuery(String compressedQuery) { + this.compressedQuery = compressedQuery; + return this; + } + + /** + * Get the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @return the supportedCloud value. + */ + public SupportedCloudEnum supportedCloud() { + return this.supportedCloud; + } + + /** + * Set the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @param supportedCloud the supportedCloud value to set. + * @return the CustomAssessmentAutomationRequestProperties object itself. + */ + public CustomAssessmentAutomationRequestProperties withSupportedCloud(SupportedCloudEnum supportedCloud) { + this.supportedCloud = supportedCloud; + return this; + } + + /** + * Get the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @return the severity value. + */ + public SeverityEnum severity() { + return this.severity; + } + + /** + * Set the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @param severity the severity value to set. + * @return the CustomAssessmentAutomationRequestProperties object itself. + */ + public CustomAssessmentAutomationRequestProperties withSeverity(SeverityEnum severity) { + this.severity = severity; + return this; + } + + /** + * Get the displayName property: The display name of the assessments generated by this assessment automation. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the assessments generated by this assessment automation. + * + * @param displayName the displayName value to set. + * @return the CustomAssessmentAutomationRequestProperties object itself. + */ + public CustomAssessmentAutomationRequestProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @param description the description value to set. + * @return the CustomAssessmentAutomationRequestProperties object itself. + */ + public CustomAssessmentAutomationRequestProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.remediationDescription; + } + + /** + * Set the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @param remediationDescription the remediationDescription value to set. + * @return the CustomAssessmentAutomationRequestProperties object itself. + */ + public CustomAssessmentAutomationRequestProperties withRemediationDescription(String remediationDescription) { + this.remediationDescription = remediationDescription; + 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("compressedQuery", this.compressedQuery); + jsonWriter.writeStringField("supportedCloud", + this.supportedCloud == null ? null : this.supportedCloud.toString()); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("remediationDescription", this.remediationDescription); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationRequestProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationRequestProperties. + */ + public static CustomAssessmentAutomationRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationRequestProperties deserializedCustomAssessmentAutomationRequestProperties + = new CustomAssessmentAutomationRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("compressedQuery".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.compressedQuery = reader.getString(); + } else if ("supportedCloud".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.supportedCloud + = SupportedCloudEnum.fromString(reader.getString()); + } else if ("severity".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.severity + = SeverityEnum.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.description = reader.getString(); + } else if ("remediationDescription".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.remediationDescription = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationRequestProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentInner.java new file mode 100644 index 000000000000..2cc3ca2fa5bc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentInner.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Custom entity store assignment. + */ +@Fluent +public final class CustomEntityStoreAssignmentInner extends ProxyResource { + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * describes custom entity store assignment properties. + */ + private CustomEntityStoreAssignmentProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CustomEntityStoreAssignmentInner class. + */ + public CustomEntityStoreAssignmentInner() { + } + + /** + * 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 innerProperties property: describes custom entity store assignment properties. + * + * @return the innerProperties value. + */ + private CustomEntityStoreAssignmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the principal property: The principal assigned with entity store. Format of principal is: [AAD + * type]=[PrincipalObjectId];[TenantId]. + * + * @return the principal value. + */ + public String principal() { + return this.innerProperties() == null ? null : this.innerProperties().principal(); + } + + /** + * Set the principal property: The principal assigned with entity store. Format of principal is: [AAD + * type]=[PrincipalObjectId];[TenantId]. + * + * @param principal the principal value to set. + * @return the CustomEntityStoreAssignmentInner object itself. + */ + public CustomEntityStoreAssignmentInner withPrincipal(String principal) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomEntityStoreAssignmentProperties(); + } + this.innerProperties().withPrincipal(principal); + return this; + } + + /** + * Get the entityStoreDatabaseLink property: The link to entity store database. + * + * @return the entityStoreDatabaseLink value. + */ + public String entityStoreDatabaseLink() { + return this.innerProperties() == null ? null : this.innerProperties().entityStoreDatabaseLink(); + } + + /** + * Set the entityStoreDatabaseLink property: The link to entity store database. + * + * @param entityStoreDatabaseLink the entityStoreDatabaseLink value to set. + * @return the CustomEntityStoreAssignmentInner object itself. + */ + public CustomEntityStoreAssignmentInner withEntityStoreDatabaseLink(String entityStoreDatabaseLink) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomEntityStoreAssignmentProperties(); + } + this.innerProperties().withEntityStoreDatabaseLink(entityStoreDatabaseLink); + 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 CustomEntityStoreAssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentInner. + */ + public static CustomEntityStoreAssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentInner deserializedCustomEntityStoreAssignmentInner + = new CustomEntityStoreAssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.innerProperties + = CustomEntityStoreAssignmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentProperties.java new file mode 100644 index 000000000000..c45fd7b558e5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * describes the custom entity store assignment properties. + */ +@Fluent +public final class CustomEntityStoreAssignmentProperties + implements JsonSerializable { + /* + * The principal assigned with entity store. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId] + */ + private String principal; + + /* + * The link to entity store database. + */ + private String entityStoreDatabaseLink; + + /** + * Creates an instance of CustomEntityStoreAssignmentProperties class. + */ + public CustomEntityStoreAssignmentProperties() { + } + + /** + * Get the principal property: The principal assigned with entity store. Format of principal is: [AAD + * type]=[PrincipalObjectId];[TenantId]. + * + * @return the principal value. + */ + public String principal() { + return this.principal; + } + + /** + * Set the principal property: The principal assigned with entity store. Format of principal is: [AAD + * type]=[PrincipalObjectId];[TenantId]. + * + * @param principal the principal value to set. + * @return the CustomEntityStoreAssignmentProperties object itself. + */ + public CustomEntityStoreAssignmentProperties withPrincipal(String principal) { + this.principal = principal; + return this; + } + + /** + * Get the entityStoreDatabaseLink property: The link to entity store database. + * + * @return the entityStoreDatabaseLink value. + */ + public String entityStoreDatabaseLink() { + return this.entityStoreDatabaseLink; + } + + /** + * Set the entityStoreDatabaseLink property: The link to entity store database. + * + * @param entityStoreDatabaseLink the entityStoreDatabaseLink value to set. + * @return the CustomEntityStoreAssignmentProperties object itself. + */ + public CustomEntityStoreAssignmentProperties withEntityStoreDatabaseLink(String entityStoreDatabaseLink) { + this.entityStoreDatabaseLink = entityStoreDatabaseLink; + 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("principal", this.principal); + jsonWriter.writeStringField("entityStoreDatabaseLink", this.entityStoreDatabaseLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentProperties. + */ + public static CustomEntityStoreAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentProperties deserializedCustomEntityStoreAssignmentProperties + = new CustomEntityStoreAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principal".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentProperties.principal = reader.getString(); + } else if ("entityStoreDatabaseLink".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentProperties.entityStoreDatabaseLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentRequestProperties.java new file mode 100644 index 000000000000..9941030ada8b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentRequestProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * describes properties of custom entity store assignment request. + */ +@Fluent +public final class CustomEntityStoreAssignmentRequestProperties + implements JsonSerializable { + /* + * The principal assigned with entity store. If not provided, will use caller principal. Format of principal is: + * [AAD type]=[PrincipalObjectId];[TenantId] + */ + private String principal; + + /** + * Creates an instance of CustomEntityStoreAssignmentRequestProperties class. + */ + public CustomEntityStoreAssignmentRequestProperties() { + } + + /** + * Get the principal property: The principal assigned with entity store. If not provided, will use caller principal. + * Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + * + * @return the principal value. + */ + public String principal() { + return this.principal; + } + + /** + * Set the principal property: The principal assigned with entity store. If not provided, will use caller principal. + * Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + * + * @param principal the principal value to set. + * @return the CustomEntityStoreAssignmentRequestProperties object itself. + */ + public CustomEntityStoreAssignmentRequestProperties withPrincipal(String principal) { + this.principal = principal; + 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("principal", this.principal); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentRequestProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentRequestProperties. + */ + public static CustomEntityStoreAssignmentRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentRequestProperties deserializedCustomEntityStoreAssignmentRequestProperties + = new CustomEntityStoreAssignmentRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principal".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentRequestProperties.principal = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentRequestProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingInner.java new file mode 100644 index 000000000000..f3ea0dc65e55 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingInner.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.DefenderForStorageSettingProperties; +import java.io.IOException; + +/** + * The Defender for Storage resource. + */ +@Fluent +public final class DefenderForStorageSettingInner extends ProxyResource { + /* + * Defender for Storage resource properties. + */ + private DefenderForStorageSettingProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DefenderForStorageSettingInner class. + */ + public DefenderForStorageSettingInner() { + } + + /** + * Get the properties property: Defender for Storage resource properties. + * + * @return the properties value. + */ + public DefenderForStorageSettingProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Defender for Storage resource properties. + * + * @param properties the properties value to set. + * @return the DefenderForStorageSettingInner object itself. + */ + public DefenderForStorageSettingInner withProperties(DefenderForStorageSettingProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForStorageSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForStorageSettingInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DefenderForStorageSettingInner. + */ + public static DefenderForStorageSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForStorageSettingInner deserializedDefenderForStorageSettingInner + = new DefenderForStorageSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.properties + = DefenderForStorageSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + 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..52ea044b0ae6 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.DevOpsConfigurationProperties; +import java.io.IOException; + +/** + * DevOps Configuration resource. + */ +@Fluent +public final class DevOpsConfigurationInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * DevOps Configuration properties. + */ + private DevOpsConfigurationProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DevOpsConfigurationInner class. + */ + public DevOpsConfigurationInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: 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 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 ("systemData".equals(fieldName)) { + deserializedDevOpsConfigurationInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDevOpsConfigurationInner.properties = DevOpsConfigurationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsConfigurationInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/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..f73e8e04eb85 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsListResponseInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list with a single sensitivity settings resource. + */ +@Fluent +public final class GetSensitivitySettingsListResponseInner + implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /** + * Creates an instance of GetSensitivitySettingsListResponseInner class. + */ + public GetSensitivitySettingsListResponseInner() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the GetSensitivitySettingsListResponseInner object itself. + */ + public GetSensitivitySettingsListResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@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..4ce68181ff8c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsResponseInner.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.GetSensitivitySettingsResponseProperties; +import java.io.IOException; + +/** + * Data sensitivity settings for sensitive data discovery. + */ +@Fluent +public final class GetSensitivitySettingsResponseInner extends ProxyResource { + /* + * The sensitivity settings properties + */ + private GetSensitivitySettingsResponseProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GetSensitivitySettingsResponseInner class. + */ + public GetSensitivitySettingsResponseInner() { + } + + /** + * Get the properties property: The sensitivity settings properties. + * + * @return the properties value. + */ + public GetSensitivitySettingsResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The sensitivity settings properties. + * + * @param properties the properties value to set. + * @return the GetSensitivitySettingsResponseInner object itself. + */ + public GetSensitivitySettingsResponseInner withProperties(GetSensitivitySettingsResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetSensitivitySettingsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetSensitivitySettingsResponseInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetSensitivitySettingsResponseInner. + */ + public static GetSensitivitySettingsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetSensitivitySettingsResponseInner deserializedGetSensitivitySettingsResponseInner + = new GetSensitivitySettingsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.properties + = GetSensitivitySettingsResponseProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGetSensitivitySettingsResponseInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java new file mode 100644 index 000000000000..5f2159ddd6ef --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.GitHubOwnerProperties; +import java.io.IOException; + +/** + * GitHub Owner resource. + */ +@Fluent +public final class GitHubOwnerInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * GitHub Owner properties. + */ + private GitHubOwnerProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GitHubOwnerInner class. + */ + public GitHubOwnerInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: GitHub Owner properties. + * + * @return the properties value. + */ + public GitHubOwnerProperties properties() { + return this.properties; + } + + /** + * Set the properties property: GitHub Owner properties. + * + * @param properties the properties value to set. + * @return the GitHubOwnerInner object itself. + */ + public GitHubOwnerInner withProperties(GitHubOwnerProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitHubOwnerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubOwnerInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitHubOwnerInner. + */ + public static GitHubOwnerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubOwnerInner deserializedGitHubOwnerInner = new GitHubOwnerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitHubOwnerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitHubOwnerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitHubOwnerInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitHubOwnerInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitHubOwnerInner.properties = GitHubOwnerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubOwnerInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java new file mode 100644 index 000000000000..7c7806276ba8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class GitHubOwnerListResponseInner implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of GitHubOwnerListResponseInner class. + */ + public GitHubOwnerListResponseInner() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the GitHubOwnerListResponseInner object itself. + */ + public GitHubOwnerListResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the GitHubOwnerListResponseInner object itself. + */ + public GitHubOwnerListResponseInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of 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..3b6dd50b10d0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubRepositoryInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.GitHubRepositoryProperties; +import java.io.IOException; + +/** + * GitHub Repository resource. + */ +@Fluent +public final class GitHubRepositoryInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * GitHub Repository properties. + */ + private GitHubRepositoryProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GitHubRepositoryInner class. + */ + public GitHubRepositoryInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: GitHub Repository properties. + * + * @return the properties value. + */ + public GitHubRepositoryProperties properties() { + return this.properties; + } + + /** + * Set the properties property: GitHub Repository properties. + * + * @param properties the properties value to set. + * @return the GitHubRepositoryInner object itself. + */ + public GitHubRepositoryInner withProperties(GitHubRepositoryProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitHubRepositoryInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubRepositoryInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitHubRepositoryInner. + */ + public static GitHubRepositoryInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubRepositoryInner deserializedGitHubRepositoryInner = new GitHubRepositoryInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitHubRepositoryInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitHubRepositoryInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitHubRepositoryInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitHubRepositoryInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitHubRepositoryInner.properties = GitHubRepositoryProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubRepositoryInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java new file mode 100644 index 000000000000..b20100ceff50 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.GitLabGroupProperties; +import java.io.IOException; + +/** + * GitLab Group resource. + */ +@Fluent +public final class GitLabGroupInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * GitLab Group properties. + */ + private GitLabGroupProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GitLabGroupInner class. + */ + public GitLabGroupInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: GitLab Group properties. + * + * @return the properties value. + */ + public GitLabGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: GitLab Group properties. + * + * @param properties the properties value to set. + * @return the GitLabGroupInner object itself. + */ + public GitLabGroupInner withProperties(GitLabGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitLabGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitLabGroupInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitLabGroupInner. + */ + public static GitLabGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitLabGroupInner deserializedGitLabGroupInner = new GitLabGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitLabGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitLabGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitLabGroupInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitLabGroupInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitLabGroupInner.properties = GitLabGroupProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitLabGroupInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java new file mode 100644 index 000000000000..ada280020092 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class GitLabGroupListResponseInner implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of GitLabGroupListResponseInner class. + */ + public GitLabGroupListResponseInner() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the GitLabGroupListResponseInner object itself. + */ + public GitLabGroupListResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the GitLabGroupListResponseInner object itself. + */ + public GitLabGroupListResponseInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of 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..8156d2a40269 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabProjectInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.GitLabProjectProperties; +import java.io.IOException; + +/** + * GitLab Project resource. + */ +@Fluent +public final class GitLabProjectInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * GitLab Project properties. + */ + private GitLabProjectProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GitLabProjectInner class. + */ + public GitLabProjectInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: GitLab Project properties. + * + * @return the properties value. + */ + public GitLabProjectProperties properties() { + return this.properties; + } + + /** + * Set the properties property: GitLab Project properties. + * + * @param properties the properties value to set. + * @return the GitLabProjectInner object itself. + */ + public GitLabProjectInner withProperties(GitLabProjectProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitLabProjectInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitLabProjectInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitLabProjectInner. + */ + public static GitLabProjectInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitLabProjectInner deserializedGitLabProjectInner = new GitLabProjectInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitLabProjectInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitLabProjectInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitLabProjectInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitLabProjectInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitLabProjectInner.properties = GitLabProjectProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitLabProjectInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java new file mode 100644 index 000000000000..fbae260e678f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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; + + /* + * 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 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 { + 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..152a28ae3469 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.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..e109f4846fe7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleInner.java @@ -0,0 +1,485 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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; + + /* + * 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 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 { + 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..6921d2b80050 --- /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) AutoRest 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..0b1dc8f30ce3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportInner.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.EnvironmentDetails; +import com.azure.resourcemanager.security.models.HealthDataClassification; +import com.azure.resourcemanager.security.models.Issue; +import com.azure.resourcemanager.security.models.ResourceDetailsAutoGenerated; +import com.azure.resourcemanager.security.models.StatusAutoGenerated; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The health report resource. + */ +@Fluent +public final class HealthReportInner extends ProxyResource { + /* + * Properties of a health report + */ + private HealthReportProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of HealthReportInner class. + */ + public HealthReportInner() { + } + + /** + * Get the innerProperties property: Properties of a health report. + * + * @return the innerProperties value. + */ + private HealthReportProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the resourceDetails property: The resource details of the health report. + * + * @return the resourceDetails value. + */ + public ResourceDetailsAutoGenerated resourceDetails() { + return this.innerProperties() == null ? null : this.innerProperties().resourceDetails(); + } + + /** + * Set the resourceDetails property: The resource details of the health report. + * + * @param resourceDetails the resourceDetails value to set. + * @return the HealthReportInner object itself. + */ + public HealthReportInner withResourceDetails(ResourceDetailsAutoGenerated resourceDetails) { + if (this.innerProperties() == null) { + this.innerProperties = new HealthReportProperties(); + } + this.innerProperties().withResourceDetails(resourceDetails); + return this; + } + + /** + * 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(); + } + + /** + * Set the environmentDetails property: The environment details of the resource. + * + * @param environmentDetails the environmentDetails value to set. + * @return the HealthReportInner object itself. + */ + public HealthReportInner withEnvironmentDetails(EnvironmentDetails environmentDetails) { + if (this.innerProperties() == null) { + this.innerProperties = new HealthReportProperties(); + } + this.innerProperties().withEnvironmentDetails(environmentDetails); + return this; + } + + /** + * 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(); + } + + /** + * Set the healthDataClassification property: The classification of the health report. + * + * @param healthDataClassification the healthDataClassification value to set. + * @return the HealthReportInner object itself. + */ + public HealthReportInner withHealthDataClassification(HealthDataClassification healthDataClassification) { + if (this.innerProperties() == null) { + this.innerProperties = new HealthReportProperties(); + } + this.innerProperties().withHealthDataClassification(healthDataClassification); + return this; + } + + /** + * Get the status property: The status of the health report. + * + * @return the status value. + */ + public StatusAutoGenerated status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The status of the health report. + * + * @param status the status value to set. + * @return the HealthReportInner object itself. + */ + public HealthReportInner withStatus(StatusAutoGenerated status) { + if (this.innerProperties() == null) { + this.innerProperties = new HealthReportProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * 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(); + } + + /** + * Set the affectedDefendersPlans property: The affected defenders plans by unhealthy report. + * + * @param affectedDefendersPlans the affectedDefendersPlans value to set. + * @return the HealthReportInner object itself. + */ + public HealthReportInner withAffectedDefendersPlans(List affectedDefendersPlans) { + if (this.innerProperties() == null) { + this.innerProperties = new HealthReportProperties(); + } + this.innerProperties().withAffectedDefendersPlans(affectedDefendersPlans); + return this; + } + + /** + * 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(); + } + + /** + * Set the affectedDefendersSubPlans property: The affected defenders sub plans by unhealthy report. + * + * @param affectedDefendersSubPlans the affectedDefendersSubPlans value to set. + * @return the HealthReportInner object itself. + */ + public HealthReportInner withAffectedDefendersSubPlans(List affectedDefendersSubPlans) { + if (this.innerProperties() == null) { + this.innerProperties = new HealthReportProperties(); + } + this.innerProperties().withAffectedDefendersSubPlans(affectedDefendersSubPlans); + return this; + } + + /** + * 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(); + } + + /** + * Set the issues property: A collection of the issues in the report. + * + * @param issues the issues value to set. + * @return the HealthReportInner object itself. + */ + public HealthReportInner withIssues(List issues) { + if (this.innerProperties() == null) { + this.innerProperties = new HealthReportProperties(); + } + this.innerProperties().withIssues(issues); + 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 HealthReportInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HealthReportInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HealthReportInner. + */ + public static HealthReportInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HealthReportInner deserializedHealthReportInner = new HealthReportInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedHealthReportInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedHealthReportInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedHealthReportInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedHealthReportInner.innerProperties = HealthReportProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHealthReportInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java new file mode 100644 index 000000000000..3c3cf5c1fbd5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.EnvironmentDetails; +import com.azure.resourcemanager.security.models.HealthDataClassification; +import com.azure.resourcemanager.security.models.Issue; +import com.azure.resourcemanager.security.models.ResourceDetailsAutoGenerated; +import com.azure.resourcemanager.security.models.StatusAutoGenerated; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Describes properties of the health report. + */ +@Fluent +public final class HealthReportProperties implements JsonSerializable { + /* + * The resource details of the health report + */ + private ResourceDetailsAutoGenerated 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 StatusAutoGenerated 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. + */ + public HealthReportProperties() { + } + + /** + * Get the resourceDetails property: The resource details of the health report. + * + * @return the resourceDetails value. + */ + public ResourceDetailsAutoGenerated resourceDetails() { + return this.resourceDetails; + } + + /** + * Set the resourceDetails property: The resource details of the health report. + * + * @param resourceDetails the resourceDetails value to set. + * @return the HealthReportProperties object itself. + */ + public HealthReportProperties withResourceDetails(ResourceDetailsAutoGenerated resourceDetails) { + this.resourceDetails = resourceDetails; + return this; + } + + /** + * Get the environmentDetails property: The environment details of the resource. + * + * @return the environmentDetails value. + */ + public EnvironmentDetails environmentDetails() { + return this.environmentDetails; + } + + /** + * Set the environmentDetails property: The environment details of the resource. + * + * @param environmentDetails the environmentDetails value to set. + * @return the HealthReportProperties object itself. + */ + public HealthReportProperties withEnvironmentDetails(EnvironmentDetails environmentDetails) { + this.environmentDetails = environmentDetails; + return this; + } + + /** + * Get the healthDataClassification property: The classification of the health report. + * + * @return the healthDataClassification value. + */ + public HealthDataClassification healthDataClassification() { + return this.healthDataClassification; + } + + /** + * Set the healthDataClassification property: The classification of the health report. + * + * @param healthDataClassification the healthDataClassification value to set. + * @return the HealthReportProperties object itself. + */ + public HealthReportProperties withHealthDataClassification(HealthDataClassification healthDataClassification) { + this.healthDataClassification = healthDataClassification; + return this; + } + + /** + * Get the status property: The status of the health report. + * + * @return the status value. + */ + public StatusAutoGenerated status() { + return this.status; + } + + /** + * Set the status property: The status of the health report. + * + * @param status the status value to set. + * @return the HealthReportProperties object itself. + */ + public HealthReportProperties withStatus(StatusAutoGenerated status) { + this.status = status; + return this; + } + + /** + * Get the affectedDefendersPlans property: The affected defenders plans by unhealthy report. + * + * @return the affectedDefendersPlans value. + */ + public List affectedDefendersPlans() { + return this.affectedDefendersPlans; + } + + /** + * Set the affectedDefendersPlans property: The affected defenders plans by unhealthy report. + * + * @param affectedDefendersPlans the affectedDefendersPlans value to set. + * @return the HealthReportProperties object itself. + */ + public HealthReportProperties withAffectedDefendersPlans(List affectedDefendersPlans) { + this.affectedDefendersPlans = affectedDefendersPlans; + return this; + } + + /** + * Get the affectedDefendersSubPlans property: The affected defenders sub plans by unhealthy report. + * + * @return the affectedDefendersSubPlans value. + */ + public List affectedDefendersSubPlans() { + return this.affectedDefendersSubPlans; + } + + /** + * Set the affectedDefendersSubPlans property: The affected defenders sub plans by unhealthy report. + * + * @param affectedDefendersSubPlans the affectedDefendersSubPlans value to set. + * @return the HealthReportProperties object itself. + */ + public HealthReportProperties withAffectedDefendersSubPlans(List affectedDefendersSubPlans) { + this.affectedDefendersSubPlans = affectedDefendersSubPlans; + return this; + } + + /** + * 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; + } + + /** + * Set the issues property: A collection of the issues in the report. + * + * @param issues the issues value to set. + * @return the HealthReportProperties object itself. + */ + public HealthReportProperties withIssues(List issues) { + this.issues = issues; + return this; + } + + /** + * 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 = ResourceDetailsAutoGenerated.fromJson(reader); + } else if ("environmentDetails".equals(fieldName)) { + deserializedHealthReportProperties.environmentDetails = EnvironmentDetails.fromJson(reader); + } else if ("healthDataClassification".equals(fieldName)) { + deserializedHealthReportProperties.healthDataClassification + = HealthDataClassification.fromJson(reader); + } else if ("status".equals(fieldName)) { + deserializedHealthReportProperties.status = StatusAutoGenerated.fromJson(reader); + } else if ("affectedDefendersPlans".equals(fieldName)) { + List affectedDefendersPlans = reader.readArray(reader1 -> reader1.getString()); + deserializedHealthReportProperties.affectedDefendersPlans = affectedDefendersPlans; + } else if ("affectedDefendersSubPlans".equals(fieldName)) { + List affectedDefendersSubPlans = reader.readArray(reader1 -> reader1.getString()); + deserializedHealthReportProperties.affectedDefendersSubPlans = affectedDefendersSubPlans; + } else if ("reportAdditionalData".equals(fieldName)) { + Map reportAdditionalData = reader.readMap(reader1 -> reader1.getString()); + deserializedHealthReportProperties.reportAdditionalData = reportAdditionalData; + } else if ("issues".equals(fieldName)) { + List issues = reader.readArray(reader1 -> Issue.fromJson(reader1)); + deserializedHealthReportProperties.issues = issues; + } else { + reader.skipChildren(); + } + } + + return deserializedHealthReportProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java new file mode 100644 index 000000000000..1a8fc7aaed20 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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; + + /* + * 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 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 { + 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..a7cfe8602c72 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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/MalwareScanInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanInner.java new file mode 100644 index 000000000000..90b0339e3e3c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.MalwareScanProperties; +import java.io.IOException; + +/** + * Describes the state of a malware scan operation. + */ +@Fluent +public final class MalwareScanInner implements JsonSerializable { + /* + * The properties property. + */ + private MalwareScanProperties properties; + + /** + * Creates an instance of MalwareScanInner class. + */ + public MalwareScanInner() { + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public MalwareScanProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the MalwareScanInner object itself. + */ + public MalwareScanInner withProperties(MalwareScanProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MalwareScanInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MalwareScanInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MalwareScanInner. + */ + public static MalwareScanInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MalwareScanInner deserializedMalwareScanInner = new MalwareScanInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedMalwareScanInner.properties = MalwareScanProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMalwareScanInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/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..08ee0644c6a9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataInner.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource of the configuration or data needed to onboard the machine to MDE. + */ +@Fluent +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; + + /* + * 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. + */ + public 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 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(); + } + + /** + * Set 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. + * + * @param onboardingPackageWindows the onboardingPackageWindows value to set. + * @return the MdeOnboardingDataInner object itself. + */ + public MdeOnboardingDataInner withOnboardingPackageWindows(byte[] onboardingPackageWindows) { + if (this.innerProperties() == null) { + this.innerProperties = new MdeOnboardingDataProperties(); + } + this.innerProperties().withOnboardingPackageWindows(onboardingPackageWindows); + return this; + } + + /** + * 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(); + } + + /** + * Set 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. + * + * @param onboardingPackageLinux the onboardingPackageLinux value to set. + * @return the MdeOnboardingDataInner object itself. + */ + public MdeOnboardingDataInner withOnboardingPackageLinux(byte[] onboardingPackageLinux) { + if (this.innerProperties() == null) { + this.innerProperties = new MdeOnboardingDataProperties(); + } + this.innerProperties().withOnboardingPackageLinux(onboardingPackageLinux); + 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 MdeOnboardingDataInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MdeOnboardingDataInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MdeOnboardingDataInner. + */ + public static MdeOnboardingDataInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MdeOnboardingDataInner deserializedMdeOnboardingDataInner = new MdeOnboardingDataInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMdeOnboardingDataInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMdeOnboardingDataInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMdeOnboardingDataInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedMdeOnboardingDataInner.innerProperties = MdeOnboardingDataProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMdeOnboardingDataInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java new file mode 100644 index 000000000000..b52fa027c861 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * List of all MDE onboarding data resources. + */ +@Fluent +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. + */ + public 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; + } + + /** + * Set the value property: List of the resources of the configuration or data needed to onboard the machine to MDE. + * + * @param value the value value to set. + * @return the MdeOnboardingDataListInner object itself. + */ + public MdeOnboardingDataListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@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..be730349ba3e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of the MDE configuration or data parameter needed to onboard the machine to MDE. + */ +@Fluent +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. + */ + public 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); + } + + /** + * Set 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. + * + * @param onboardingPackageWindows the onboardingPackageWindows value to set. + * @return the MdeOnboardingDataProperties object itself. + */ + public MdeOnboardingDataProperties withOnboardingPackageWindows(byte[] onboardingPackageWindows) { + this.onboardingPackageWindows = CoreUtils.clone(onboardingPackageWindows); + return this; + } + + /** + * 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); + } + + /** + * Set 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. + * + * @param onboardingPackageLinux the onboardingPackageLinux value to set. + * @return the MdeOnboardingDataProperties object itself. + */ + public MdeOnboardingDataProperties withOnboardingPackageLinux(byte[] onboardingPackageLinux) { + this.onboardingPackageLinux = CoreUtils.clone(onboardingPackageLinux); + 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.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..1e17d36a44e4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.ActionType; +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. + */ +@Fluent +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 + * ARM/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; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public 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 ARM/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; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @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 = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultAutoGeneratedInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultAutoGeneratedInner.java new file mode 100644 index 000000000000..f6e0d792b6de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultAutoGeneratedInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.OperationResult; +import java.io.IOException; + +/** + * Long run operation status of governance rule over a given scope. + */ +@Immutable +public final class OperationResultAutoGeneratedInner implements JsonSerializable { + /* + * The status of the long run operation result of governance rule + */ + private OperationResult status; + + /** + * Creates an instance of OperationResultAutoGeneratedInner class. + */ + public OperationResultAutoGeneratedInner() { + } + + /** + * Get the status property: The status of the long run operation result of governance rule. + * + * @return the status value. + */ + public OperationResult 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 OperationResultAutoGeneratedInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationResultAutoGeneratedInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationResultAutoGeneratedInner. + */ + public static OperationResultAutoGeneratedInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationResultAutoGeneratedInner deserializedOperationResultAutoGeneratedInner + = new OperationResultAutoGeneratedInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedOperationResultAutoGeneratedInner.status + = OperationResult.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationResultAutoGeneratedInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java new file mode 100644 index 000000000000..c1afb3a124be --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.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. + */ +@Fluent +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 Float 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; + + /** + * Creates an instance of OperationStatusResultInner class. + */ + public OperationStatusResultInner() { + } + + /** + * Get the id property: Fully qualified ID for the async operation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Fully qualified ID for the async operation. + * + * @param id the id value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Name of the async operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the async operation. + * + * @param name the name value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Operation status. + * + * @param status the status value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + public Float percentComplete() { + return this.percentComplete; + } + + /** + * Set the percentComplete property: Percent of the operation that is complete. + * + * @param percentComplete the percentComplete value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withPercentComplete(Float percentComplete) { + this.percentComplete = percentComplete; + return this; + } + + /** + * Get the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the operation. + * + * @param startTime the startTime value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time of the operation. + * + * @param endTime the endTime value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the operations property: The operations list. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: The operations list. + * + * @param operations the operations value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Get the error property: If present, details of the operation error. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: If present, details of the operation error. + * + * @param error the error value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * 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::getFloat); + } else if ("startTime".equals(fieldName)) { + deserializedOperationStatusResultInner.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedOperationStatusResultInner.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("operations".equals(fieldName)) { + List operations + = reader.readArray(reader1 -> OperationStatusResultInner.fromJson(reader1)); + deserializedOperationStatusResultInner.operations = operations; + } else if ("error".equals(fieldName)) { + deserializedOperationStatusResultInner.error = ManagementError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusResultInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/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..db1ceabcf8cb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.State; +import java.io.IOException; + +/** + * Regulatory compliance assessment details and state. + */ +@Fluent +public final class RegulatoryComplianceAssessmentInner extends ProxyResource { + /* + * Regulatory compliance assessment data + */ + private RegulatoryComplianceAssessmentProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RegulatoryComplianceAssessmentInner class. + */ + public RegulatoryComplianceAssessmentInner() { + } + + /** + * Get the innerProperties property: Regulatory compliance assessment data. + * + * @return the innerProperties value. + */ + private RegulatoryComplianceAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the description property: The description of the regulatory compliance assessment. + * + * @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(); + } + + /** + * Set the state property: Aggregative state based on the assessment's scanned resources states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceAssessmentInner object itself. + */ + public RegulatoryComplianceAssessmentInner withState(State state) { + if (this.innerProperties() == null) { + this.innerProperties = new RegulatoryComplianceAssessmentProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * 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 { + 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..fe1aae6b2b07 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentProperties.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.State; +import java.io.IOException; + +/** + * Regulatory compliance assessment data. + */ +@Fluent +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. + */ + public 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; + } + + /** + * Set the state property: Aggregative state based on the assessment's scanned resources states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceAssessmentProperties object itself. + */ + public RegulatoryComplianceAssessmentProperties withState(State state) { + this.state = state; + return this; + } + + /** + * 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..7d016a07c7e9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.State; +import java.io.IOException; + +/** + * Regulatory compliance control details and state. + */ +@Fluent +public final class RegulatoryComplianceControlInner extends ProxyResource { + /* + * Regulatory compliance control data + */ + private RegulatoryComplianceControlProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RegulatoryComplianceControlInner class. + */ + public RegulatoryComplianceControlInner() { + } + + /** + * Get the innerProperties property: Regulatory compliance control data. + * + * @return the innerProperties value. + */ + private RegulatoryComplianceControlProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the description property: The description of the regulatory compliance control. + * + * @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(); + } + + /** + * Set the state property: Aggregative state based on the control's supported assessments states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceControlInner object itself. + */ + public RegulatoryComplianceControlInner withState(State state) { + if (this.innerProperties() == null) { + this.innerProperties = new RegulatoryComplianceControlProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * 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 { + 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..57f20f4c41b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlProperties.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.State; +import java.io.IOException; + +/** + * Regulatory compliance control data. + */ +@Fluent +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. + */ + public 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; + } + + /** + * Set the state property: Aggregative state based on the control's supported assessments states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceControlProperties object itself. + */ + public RegulatoryComplianceControlProperties withState(State state) { + this.state = state; + return this; + } + + /** + * 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..7614a7dc7c31 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.State; +import java.io.IOException; + +/** + * Regulatory compliance standard details and state. + */ +@Fluent +public final class RegulatoryComplianceStandardInner extends ProxyResource { + /* + * Regulatory compliance standard data + */ + private RegulatoryComplianceStandardProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RegulatoryComplianceStandardInner class. + */ + public RegulatoryComplianceStandardInner() { + } + + /** + * Get the innerProperties property: Regulatory compliance standard data. + * + * @return the innerProperties value. + */ + private RegulatoryComplianceStandardProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the state property: Aggregative state based on the standard's supported controls states. + * + * @return the state value. + */ + public State state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Aggregative state based on the standard's supported controls states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceStandardInner object itself. + */ + public RegulatoryComplianceStandardInner withState(State state) { + if (this.innerProperties() == null) { + this.innerProperties = new RegulatoryComplianceStandardProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * 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 { + 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..ec8c16ee114d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.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. + */ +@Fluent +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. + */ + public 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; + } + + /** + * Set the state property: Aggregative state based on the standard's supported controls states. + * + * @param state the state value to set. + * @return the RegulatoryComplianceStandardProperties object itself. + */ + public RegulatoryComplianceStandardProperties withState(State state) { + this.state = state; + return this; + } + + /** + * 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..78fa700f2ab2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.RuleResultsProperties; +import java.io.IOException; + +/** + * Rule results. + */ +@Fluent +public final class RuleResultsInner extends ProxyResource { + /* + * Rule results properties. + */ + private RuleResultsProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RuleResultsInner class. + */ + public RuleResultsInner() { + } + + /** + * Get the properties property: Rule results properties. + * + * @return the properties value. + */ + public RuleResultsProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Rule results properties. + * + * @param properties the properties value to set. + * @return the RuleResultsInner object itself. + */ + public RuleResultsInner withProperties(RuleResultsProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RuleResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RuleResultsInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RuleResultsInner. + */ + public static RuleResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RuleResultsInner deserializedRuleResultsInner = new RuleResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRuleResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRuleResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRuleResultsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRuleResultsInner.properties = RuleResultsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRuleResultsInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java new file mode 100644 index 000000000000..648fbdef0bf0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of rules results. + */ +@Fluent +public final class RulesResultsInner implements JsonSerializable { + /* + * List of rule results. + */ + private List value; + + /** + * Creates an instance of RulesResultsInner class. + */ + public RulesResultsInner() { + } + + /** + * Get the value property: List of rule results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of rule results. + * + * @param value the value value to set. + * @return the RulesResultsInner object itself. + */ + public RulesResultsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RulesResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RulesResultsInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RulesResultsInner. + */ + public static RulesResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RulesResultsInner deserializedRulesResultsInner = new RulesResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RuleResultsInner.fromJson(reader1)); + deserializedRulesResultsInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRulesResultsInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java new file mode 100644 index 000000000000..230b3172f5a9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.ScanProperties; +import java.io.IOException; + +/** + * A vulnerability assessment scan record. + */ +@Fluent +public final class ScanInner extends ProxyResource { + /* + * A vulnerability assessment scan record properties. + */ + private ScanProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ScanInner class. + */ + public ScanInner() { + } + + /** + * Get the properties property: A vulnerability assessment scan record properties. + * + * @return the properties value. + */ + public ScanProperties properties() { + return this.properties; + } + + /** + * Set the properties property: A vulnerability assessment scan record properties. + * + * @param properties the properties value to set. + * @return the ScanInner object itself. + */ + public ScanInner withProperties(ScanProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScanInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ScanInner. + */ + public static ScanInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanInner deserializedScanInner = new ScanInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedScanInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedScanInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedScanInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedScanInner.properties = ScanProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScanInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java new file mode 100644 index 000000000000..321a1461e182 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.ScanResultProperties; +import java.io.IOException; + +/** + * A vulnerability assessment scan result for a single rule. + */ +@Fluent +public final class ScanResultInner extends ProxyResource { + /* + * A vulnerability assessment scan result properties for a single rule. + */ + private ScanResultProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ScanResultInner class. + */ + public 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; + } + + /** + * Set the properties property: A vulnerability assessment scan result properties for a single rule. + * + * @param properties the properties value to set. + * @return the ScanResultInner object itself. + */ + public ScanResultInner withProperties(ScanResultProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScanResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ScanResultInner. + */ + public static ScanResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanResultInner deserializedScanResultInner = new ScanResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedScanResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedScanResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedScanResultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedScanResultInner.properties = ScanResultProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScanResultInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java new file mode 100644 index 000000000000..708e4f7ce8b8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of vulnerability assessment scan results. + */ +@Fluent +public final class ScanResultsInner implements JsonSerializable { + /* + * List of vulnerability assessment scan results. + */ + private List value; + + /** + * Creates an instance of ScanResultsInner class. + */ + public ScanResultsInner() { + } + + /** + * Get the value property: List of vulnerability assessment scan results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of vulnerability assessment scan results. + * + * @param value the value value to set. + * @return the ScanResultsInner object itself. + */ + public ScanResultsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScanResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanResultsInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ScanResultsInner. + */ + public static ScanResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanResultsInner deserializedScanResultsInner = new ScanResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ScanResultInner.fromJson(reader1)); + deserializedScanResultsInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedScanResultsInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java new file mode 100644 index 000000000000..4d49a998e3a9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of vulnerability assessment scan records. + */ +@Fluent +public final class ScansInner implements JsonSerializable { + /* + * List of vulnerability assessment scan records. + */ + private List value; + + /** + * Creates an instance of ScansInner class. + */ + public ScansInner() { + } + + /** + * Get the value property: List of vulnerability assessment scan records. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of vulnerability assessment scan records. + * + * @param value the value value to set. + * @return the ScansInner object itself. + */ + public ScansInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScansInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScansInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the ScansInner. + */ + public static ScansInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScansInner deserializedScansInner = new ScansInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ScanInner.fromJson(reader1)); + deserializedScansInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedScansInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScenarioResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScenarioResponseInner.java new file mode 100644 index 000000000000..874a9e2388f6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScenarioResponseInner.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Query result. + */ +@Fluent +public final class ScenarioResponseInner implements JsonSerializable { + /* + * The result of the query operation. + */ + private Object scenarioResult; + + /** + * Creates an instance of ScenarioResponseInner class. + */ + public ScenarioResponseInner() { + } + + /** + * Get the scenarioResult property: The result of the query operation. + * + * @return the scenarioResult value. + */ + public Object scenarioResult() { + return this.scenarioResult; + } + + /** + * Set the scenarioResult property: The result of the query operation. + * + * @param scenarioResult the scenarioResult value to set. + * @return the ScenarioResponseInner object itself. + */ + public ScenarioResponseInner withScenarioResult(Object scenarioResult) { + this.scenarioResult = scenarioResult; + 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(); + if (this.scenarioResult != null) { + jsonWriter.writeUntypedField("scenarioResult", this.scenarioResult); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScenarioResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScenarioResponseInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ScenarioResponseInner. + */ + public static ScenarioResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScenarioResponseInner deserializedScenarioResponseInner = new ScenarioResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("scenarioResult".equals(fieldName)) { + deserializedScenarioResponseInner.scenarioResult = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedScenarioResponseInner; + }); + } +} 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..1478b56eeb65 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorInner.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.CloudName; +import com.azure.resourcemanager.security.models.CloudOffering; +import com.azure.resourcemanager.security.models.EnvironmentData; +import 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 Resource { + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Security connector data + */ + private SecurityConnectorProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SecurityConnectorInner class. + */ + public SecurityConnectorInner() { + } + + /** + * 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 innerProperties property: Security connector data. + * + * @return the innerProperties value. + */ + private SecurityConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SecurityConnectorInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SecurityConnectorInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * 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.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityConnectorInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityConnectorInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityConnectorInner. + */ + public static SecurityConnectorInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityConnectorInner deserializedSecurityConnectorInner = new SecurityConnectorInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityConnectorInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityConnectorInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityConnectorInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSecurityConnectorInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSecurityConnectorInner.withTags(tags); + } else if ("systemData".equals(fieldName)) { + deserializedSecurityConnectorInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedSecurityConnectorInner.innerProperties = SecurityConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityConnectorInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorProperties.java new file mode 100644 index 000000000000..2b7129557a4a --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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..54c610dd3394 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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; + + /* + * 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 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 { + 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..0aad3efbe046 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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..da7865a572e5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorInner.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.Identity; +import java.io.IOException; + +/** + * Security operator under a given subscription and pricing. + */ +@Fluent +public final class SecurityOperatorInner extends ProxyResource { + /* + * Identity for the resource. + */ + private Identity identity; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SecurityOperatorInner class. + */ + public SecurityOperatorInner() { + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the SecurityOperatorInner object itself. + */ + public SecurityOperatorInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @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 { + reader.skipChildren(); + } + } + + return deserializedSecurityOperatorInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorListInner.java new file mode 100644 index 000000000000..139626de7dd7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorListInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.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.util.List; + +/** + * List of SecurityOperator response. + */ +@Fluent +public final class SecurityOperatorListInner implements JsonSerializable { + /* + * List of SecurityOperator configurations + */ + private List value; + + /** + * Creates an instance of SecurityOperatorListInner class. + */ + public SecurityOperatorListInner() { + } + + /** + * Get the value property: List of SecurityOperator configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of SecurityOperator configurations. + * + * @param value the value value to set. + * @return the SecurityOperatorListInner object itself. + */ + public SecurityOperatorListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property value in model SecurityOperatorListInner")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityOperatorListInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityOperatorListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityOperatorListInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityOperatorListInner. + */ + public static SecurityOperatorListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityOperatorListInner deserializedSecurityOperatorListInner = new SecurityOperatorListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SecurityOperatorInner.fromJson(reader1)); + deserializedSecurityOperatorListInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityOperatorListInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/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..bb81440fefe9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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. + */ +@Fluent +public final class SecuritySubAssessmentInner extends ProxyResource { + /* + * Describes properties of an sub-assessment. + */ + private SecuritySubAssessmentProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SecuritySubAssessmentInner class. + */ + public SecuritySubAssessmentInner() { + } + + /** + * Get the innerProperties property: Describes properties of an sub-assessment. + * + * @return the innerProperties value. + */ + private SecuritySubAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the id property: Vulnerability ID. + * + * @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(); + } + + /** + * Set the status property: Status of the sub-assessment. + * + * @param status the status value to set. + * @return the SecuritySubAssessmentInner object itself. + */ + public SecuritySubAssessmentInner withStatus(SubAssessmentStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new SecuritySubAssessmentProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * 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(); + } + + /** + * Set the resourceDetails property: Details of the resource that was assessed. + * + * @param resourceDetails the resourceDetails value to set. + * @return the SecuritySubAssessmentInner object itself. + */ + public SecuritySubAssessmentInner withResourceDetails(ResourceDetails resourceDetails) { + if (this.innerProperties() == null) { + this.innerProperties = new SecuritySubAssessmentProperties(); + } + this.innerProperties().withResourceDetails(resourceDetails); + return this; + } + + /** + * Get the additionalData property: Details of the sub-assessment. + * + * @return the additionalData value. + */ + public AdditionalData additionalData() { + return this.innerProperties() == null ? null : this.innerProperties().additionalData(); + } + + /** + * Set the additionalData property: Details of the sub-assessment. + * + * @param additionalData the additionalData value to set. + * @return the SecuritySubAssessmentInner object itself. + */ + public SecuritySubAssessmentInner withAdditionalData(AdditionalData additionalData) { + if (this.innerProperties() == null) { + this.innerProperties = new SecuritySubAssessmentProperties(); + } + 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 SecuritySubAssessmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySubAssessmentInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecuritySubAssessmentInner. + */ + public static SecuritySubAssessmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySubAssessmentInner deserializedSecuritySubAssessmentInner = new SecuritySubAssessmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.innerProperties + = SecuritySubAssessmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySubAssessmentInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java new file mode 100644 index 000000000000..91117c88d7a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.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. + */ +@Fluent +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. + */ + public 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; + } + + /** + * Set the status property: Status of the sub-assessment. + * + * @param status the status value to set. + * @return the SecuritySubAssessmentProperties object itself. + */ + public SecuritySubAssessmentProperties withStatus(SubAssessmentStatus status) { + this.status = status; + return this; + } + + /** + * 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; + } + + /** + * Set the resourceDetails property: Details of the resource that was assessed. + * + * @param resourceDetails the resourceDetails value to set. + * @return the SecuritySubAssessmentProperties object itself. + */ + public SecuritySubAssessmentProperties withResourceDetails(ResourceDetails resourceDetails) { + this.resourceDetails = resourceDetails; + return this; + } + + /** + * Get the additionalData property: Details of the sub-assessment. + * + * @return the additionalData value. + */ + public AdditionalData additionalData() { + return this.additionalData; + } + + /** + * Set the additionalData property: Details of the sub-assessment. + * + * @param additionalData the additionalData value to set. + * @return the SecuritySubAssessmentProperties object itself. + */ + public SecuritySubAssessmentProperties withAdditionalData(AdditionalData additionalData) { + this.additionalData = additionalData; + return this; + } + + /** + * 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..4fc28dc4a262 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.SecurityTaskParameters; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Security task that we recommend to do in order to strengthen security. + */ +@Fluent +public final class SecurityTaskInner extends ProxyResource { + /* + * Describes properties of a task. + */ + private SecurityTaskProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SecurityTaskInner class. + */ + public SecurityTaskInner() { + } + + /** + * Get the innerProperties property: Describes properties of a task. + * + * @return the innerProperties value. + */ + private SecurityTaskProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the state property: State of the task (Active, Resolved etc.). + * + * @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(); + } + + /** + * Set the securityTaskParameters property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @param securityTaskParameters the securityTaskParameters value to set. + * @return the SecurityTaskInner object itself. + */ + public SecurityTaskInner withSecurityTaskParameters(SecurityTaskParameters securityTaskParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityTaskProperties(); + } + this.innerProperties().withSecurityTaskParameters(securityTaskParameters); + return this; + } + + /** + * 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 { + 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..304fcb6ef724 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskProperties.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.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. + */ +@Fluent +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. + */ + public 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; + } + + /** + * Set the securityTaskParameters property: Changing set of properties, depending on the task type that is derived + * from the name field. + * + * @param securityTaskParameters the securityTaskParameters value to set. + * @return the SecurityTaskProperties object itself. + */ + public SecurityTaskProperties withSecurityTaskParameters(SecurityTaskParameters securityTaskParameters) { + this.securityTaskParameters = securityTaskParameters; + return this; + } + + /** + * 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/SoftwareInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java new file mode 100644 index 000000000000..4efd7f5a975c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.EndOfSupportStatus; +import java.io.IOException; + +/** + * Represents a software data. + */ +@Fluent +public final class SoftwareInner extends ProxyResource { + /* + * Properties of the Software Inventory resource + */ + private SoftwareProperties innerProperties = new SoftwareProperties(); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SoftwareInner class. + */ + public SoftwareInner() { + } + + /** + * Get the innerProperties property: Properties of the Software Inventory resource. + * + * @return the innerProperties value. + */ + private SoftwareProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the deviceId property: Unique identifier for the virtual machine in the service. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.innerProperties() == null ? null : this.innerProperties().deviceId(); + } + + /** + * Set the deviceId property: Unique identifier for the virtual machine in the service. + * + * @param deviceId the deviceId value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withDeviceId(String deviceId) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withDeviceId(deviceId); + return this; + } + + /** + * Get the osPlatform property: Platform of the operating system running on the device. + * + * @return the osPlatform value. + */ + public String osPlatform() { + return this.innerProperties() == null ? null : this.innerProperties().osPlatform(); + } + + /** + * Set the osPlatform property: Platform of the operating system running on the device. + * + * @param osPlatform the osPlatform value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withOsPlatform(String osPlatform) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withOsPlatform(osPlatform); + return this; + } + + /** + * Get the vendor property: Name of the software vendor. + * + * @return the vendor value. + */ + public String vendor() { + return this.innerProperties() == null ? null : this.innerProperties().vendor(); + } + + /** + * Set the vendor property: Name of the software vendor. + * + * @param vendor the vendor value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withVendor(String vendor) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withVendor(vendor); + return this; + } + + /** + * Get the softwareName property: Name of the software product. + * + * @return the softwareName value. + */ + public String softwareName() { + return this.innerProperties() == null ? null : this.innerProperties().softwareName(); + } + + /** + * Set the softwareName property: Name of the software product. + * + * @param softwareName the softwareName value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withSoftwareName(String softwareName) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withSoftwareName(softwareName); + return this; + } + + /** + * Get the version property: Version number of the software product. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Version number of the software product. + * + * @param version the version value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the endOfSupportStatus property: End of support status. + * + * @return the endOfSupportStatus value. + */ + public EndOfSupportStatus endOfSupportStatus() { + return this.innerProperties() == null ? null : this.innerProperties().endOfSupportStatus(); + } + + /** + * Set the endOfSupportStatus property: End of support status. + * + * @param endOfSupportStatus the endOfSupportStatus value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withEndOfSupportStatus(EndOfSupportStatus endOfSupportStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withEndOfSupportStatus(endOfSupportStatus); + return this; + } + + /** + * Get the endOfSupportDate property: The end of support date in case the product is upcoming end of support. + * + * @return the endOfSupportDate value. + */ + public String endOfSupportDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfSupportDate(); + } + + /** + * Set the endOfSupportDate property: The end of support date in case the product is upcoming end of support. + * + * @param endOfSupportDate the endOfSupportDate value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withEndOfSupportDate(String endOfSupportDate) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withEndOfSupportDate(endOfSupportDate); + return this; + } + + /** + * Get the numberOfKnownVulnerabilities property: Number of weaknesses. + * + * @return the numberOfKnownVulnerabilities value. + */ + public Integer numberOfKnownVulnerabilities() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfKnownVulnerabilities(); + } + + /** + * Set the numberOfKnownVulnerabilities property: Number of weaknesses. + * + * @param numberOfKnownVulnerabilities the numberOfKnownVulnerabilities value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withNumberOfKnownVulnerabilities(Integer numberOfKnownVulnerabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withNumberOfKnownVulnerabilities(numberOfKnownVulnerabilities); + return this; + } + + /** + * Get the firstSeenAt property: First time that the software was seen in the device. + * + * @return the firstSeenAt value. + */ + public String firstSeenAt() { + return this.innerProperties() == null ? null : this.innerProperties().firstSeenAt(); + } + + /** + * Set the firstSeenAt property: First time that the software was seen in the device. + * + * @param firstSeenAt the firstSeenAt value to set. + * @return the SoftwareInner object itself. + */ + public SoftwareInner withFirstSeenAt(String firstSeenAt) { + if (this.innerProperties() == null) { + this.innerProperties = new SoftwareProperties(); + } + this.innerProperties().withFirstSeenAt(firstSeenAt); + 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 SoftwareInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SoftwareInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SoftwareInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SoftwareInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SoftwareInner. + */ + public static SoftwareInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SoftwareInner deserializedSoftwareInner = new SoftwareInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSoftwareInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSoftwareInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSoftwareInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSoftwareInner.innerProperties = SoftwareProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSoftwareInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareProperties.java new file mode 100644 index 000000000000..523cb90edb9b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareProperties.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.EndOfSupportStatus; +import java.io.IOException; + +/** + * Software Inventory resource properties. + */ +@Fluent +public final class SoftwareProperties implements JsonSerializable { + /* + * Unique identifier for the virtual machine in the service. + */ + private String deviceId; + + /* + * Platform of the operating system running on the device. + */ + private String osPlatform; + + /* + * Name of the software vendor. + */ + private String vendor; + + /* + * Name of the software product. + */ + private String softwareName; + + /* + * Version number of the software product. + */ + private String version; + + /* + * End of support status. + */ + private EndOfSupportStatus endOfSupportStatus; + + /* + * The end of support date in case the product is upcoming end of support. + */ + private String endOfSupportDate; + + /* + * Number of weaknesses. + */ + private Integer numberOfKnownVulnerabilities; + + /* + * First time that the software was seen in the device. + */ + private String firstSeenAt; + + /** + * Creates an instance of SoftwareProperties class. + */ + public SoftwareProperties() { + } + + /** + * Get the deviceId property: Unique identifier for the virtual machine in the service. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.deviceId; + } + + /** + * Set the deviceId property: Unique identifier for the virtual machine in the service. + * + * @param deviceId the deviceId value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withDeviceId(String deviceId) { + this.deviceId = deviceId; + return this; + } + + /** + * Get the osPlatform property: Platform of the operating system running on the device. + * + * @return the osPlatform value. + */ + public String osPlatform() { + return this.osPlatform; + } + + /** + * Set the osPlatform property: Platform of the operating system running on the device. + * + * @param osPlatform the osPlatform value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withOsPlatform(String osPlatform) { + this.osPlatform = osPlatform; + return this; + } + + /** + * Get the vendor property: Name of the software vendor. + * + * @return the vendor value. + */ + public String vendor() { + return this.vendor; + } + + /** + * Set the vendor property: Name of the software vendor. + * + * @param vendor the vendor value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withVendor(String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get the softwareName property: Name of the software product. + * + * @return the softwareName value. + */ + public String softwareName() { + return this.softwareName; + } + + /** + * Set the softwareName property: Name of the software product. + * + * @param softwareName the softwareName value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withSoftwareName(String softwareName) { + this.softwareName = softwareName; + return this; + } + + /** + * Get the version property: Version number of the software product. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version number of the software product. + * + * @param version the version value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the endOfSupportStatus property: End of support status. + * + * @return the endOfSupportStatus value. + */ + public EndOfSupportStatus endOfSupportStatus() { + return this.endOfSupportStatus; + } + + /** + * Set the endOfSupportStatus property: End of support status. + * + * @param endOfSupportStatus the endOfSupportStatus value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withEndOfSupportStatus(EndOfSupportStatus endOfSupportStatus) { + this.endOfSupportStatus = endOfSupportStatus; + return this; + } + + /** + * Get the endOfSupportDate property: The end of support date in case the product is upcoming end of support. + * + * @return the endOfSupportDate value. + */ + public String endOfSupportDate() { + return this.endOfSupportDate; + } + + /** + * Set the endOfSupportDate property: The end of support date in case the product is upcoming end of support. + * + * @param endOfSupportDate the endOfSupportDate value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withEndOfSupportDate(String endOfSupportDate) { + this.endOfSupportDate = endOfSupportDate; + return this; + } + + /** + * Get the numberOfKnownVulnerabilities property: Number of weaknesses. + * + * @return the numberOfKnownVulnerabilities value. + */ + public Integer numberOfKnownVulnerabilities() { + return this.numberOfKnownVulnerabilities; + } + + /** + * Set the numberOfKnownVulnerabilities property: Number of weaknesses. + * + * @param numberOfKnownVulnerabilities the numberOfKnownVulnerabilities value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withNumberOfKnownVulnerabilities(Integer numberOfKnownVulnerabilities) { + this.numberOfKnownVulnerabilities = numberOfKnownVulnerabilities; + return this; + } + + /** + * Get the firstSeenAt property: First time that the software was seen in the device. + * + * @return the firstSeenAt value. + */ + public String firstSeenAt() { + return this.firstSeenAt; + } + + /** + * Set the firstSeenAt property: First time that the software was seen in the device. + * + * @param firstSeenAt the firstSeenAt value to set. + * @return the SoftwareProperties object itself. + */ + public SoftwareProperties withFirstSeenAt(String firstSeenAt) { + this.firstSeenAt = firstSeenAt; + 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("deviceId", this.deviceId); + jsonWriter.writeStringField("osPlatform", this.osPlatform); + jsonWriter.writeStringField("vendor", this.vendor); + jsonWriter.writeStringField("softwareName", this.softwareName); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("endOfSupportStatus", + this.endOfSupportStatus == null ? null : this.endOfSupportStatus.toString()); + jsonWriter.writeStringField("endOfSupportDate", this.endOfSupportDate); + jsonWriter.writeNumberField("numberOfKnownVulnerabilities", this.numberOfKnownVulnerabilities); + jsonWriter.writeStringField("firstSeenAt", this.firstSeenAt); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SoftwareProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SoftwareProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SoftwareProperties. + */ + public static SoftwareProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SoftwareProperties deserializedSoftwareProperties = new SoftwareProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceId".equals(fieldName)) { + deserializedSoftwareProperties.deviceId = reader.getString(); + } else if ("osPlatform".equals(fieldName)) { + deserializedSoftwareProperties.osPlatform = reader.getString(); + } else if ("vendor".equals(fieldName)) { + deserializedSoftwareProperties.vendor = reader.getString(); + } else if ("softwareName".equals(fieldName)) { + deserializedSoftwareProperties.softwareName = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedSoftwareProperties.version = reader.getString(); + } else if ("endOfSupportStatus".equals(fieldName)) { + deserializedSoftwareProperties.endOfSupportStatus + = EndOfSupportStatus.fromString(reader.getString()); + } else if ("endOfSupportDate".equals(fieldName)) { + deserializedSoftwareProperties.endOfSupportDate = reader.getString(); + } else if ("numberOfKnownVulnerabilities".equals(fieldName)) { + deserializedSoftwareProperties.numberOfKnownVulnerabilities + = reader.getNullable(JsonReader::getInt); + } else if ("firstSeenAt".equals(fieldName)) { + deserializedSoftwareProperties.firstSeenAt = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSoftwareProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java new file mode 100644 index 000000000000..403dcdbd58a0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configures where to store the OMS agent data for workspaces under a scope. + */ +@Fluent +public final class WorkspaceSettingInner extends ProxyResource { + /* + * Workspace setting data + */ + private WorkspaceSettingProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspaceSettingInner class. + */ + public WorkspaceSettingInner() { + } + + /** + * Get the innerProperties property: Workspace setting data. + * + * @return the innerProperties value. + */ + private WorkspaceSettingProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the workspaceId property: The full Azure ID of the workspace to save the data in. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.innerProperties() == null ? null : this.innerProperties().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 WorkspaceSettingInner object itself. + */ + public WorkspaceSettingInner withWorkspaceId(String workspaceId) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceSettingProperties(); + } + this.innerProperties().withWorkspaceId(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.innerProperties() == null ? null : this.innerProperties().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 WorkspaceSettingInner object itself. + */ + public WorkspaceSettingInner withScope(String scope) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceSettingProperties(); + } + this.innerProperties().withScope(scope); + 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 WorkspaceSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceSettingInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceSettingInner. + */ + public static WorkspaceSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceSettingInner deserializedWorkspaceSettingInner = new WorkspaceSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceSettingInner.innerProperties = WorkspaceSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceSettingInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingProperties.java new file mode 100644 index 000000000000..706f12a15eab --- /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) AutoRest 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/implementation/AdvancedThreatProtectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsClientImpl.java index d9251b4a7474..9631bed42b6a 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 @@ -23,6 +23,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.AdvancedThreatProtectionsClient; import com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner; import reactor.core.publisher.Mono; @@ -68,6 +69,15 @@ Mono> get(@HostParam("$host") Str @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("settingName") String settingName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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 }) @@ -78,6 +88,17 @@ Mono> create(@HostParam("$host") @PathParam("settingName") String settingName, @BodyParam("application/json") AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") String settingName, + @BodyParam("application/json") AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, + @HeaderParam("Accept") String accept, Context context); } /** @@ -108,34 +129,6 @@ private Mono> getWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the Advanced Threat Protection settings for the specified 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 the Advanced Threat Protection settings for the specified resource 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 = "2019-01-01"; - final String settingName = "current"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context); - } - /** * Gets the Advanced Threat Protection settings for the specified resource. * @@ -163,7 +156,19 @@ private Mono getAsync(String resourceId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceId, Context context) { - return getWithResponseAsync(resourceId, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-01-01"; + final String settingName = "current"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context); } /** @@ -216,42 +221,6 @@ private Mono> createWithResponseA .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 advancedThreatProtectionSetting Advanced Threat Protection 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 Advanced Threat Protection resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createWithResponseAsync(String resourceId, - AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, 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 (advancedThreatProtectionSetting == null) { - return Mono.error(new IllegalArgumentException( - "Parameter advancedThreatProtectionSetting is required and cannot be null.")); - } else { - advancedThreatProtectionSetting.validate(); - } - final String apiVersion = "2019-01-01"; - final String settingName = "current"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, - advancedThreatProtectionSetting, accept, context); - } - /** * Creates or updates the Advanced Threat Protection settings on a specified resource. * @@ -283,7 +252,27 @@ private Mono createAsync(String resourceId @ServiceMethod(returns = ReturnType.SINGLE) public Response createWithResponse(String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting, Context context) { - return createWithResponseAsync(resourceId, advancedThreatProtectionSetting, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (advancedThreatProtectionSetting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter advancedThreatProtectionSetting is required and cannot be null.")); + } else { + advancedThreatProtectionSetting.validate(); + } + final String apiVersion = "2019-01-01"; + final String settingName = "current"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), apiVersion, resourceId, settingName, + advancedThreatProtectionSetting, accept, context); } /** @@ -301,4 +290,6 @@ public AdvancedThreatProtectionSettingInner create(String resourceId, AdvancedThreatProtectionSettingInner advancedThreatProtectionSetting) { return createWithResponse(resourceId, advancedThreatProtectionSetting, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(AdvancedThreatProtectionsClientImpl.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java index e0df17af14ba..227488551dd7 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 @@ -26,8 +26,10 @@ 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.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.security.fluent.AlertsClient; @@ -77,6 +79,13 @@ 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/alerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts") @ExpectedResponses({ 200 }) @@ -86,6 +95,15 @@ Mono> listByResourceGroup(@HostParam("$host") String endpoin @PathParam("resourceGroupName") String resourceGroupName, @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) + Response listByResourceGroupSync(@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 }) @@ -94,6 +112,14 @@ Mono> listSubscriptionLevelByRegion(@HostParam("$host") Stri @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/{ascLocation}/alerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSubscriptionLevelByRegionSync(@HostParam("$host") 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 }) @@ -103,6 +129,15 @@ Mono> listResourceGroupLevelByRegion(@HostParam("$host") Str @PathParam("ascLocation") String ascLocation, @PathParam("resourceGroupName") String resourceGroupName, @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) + Response listResourceGroupLevelByRegionSync(@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 }) @@ -112,6 +147,15 @@ Mono> getSubscriptionLevel(@HostParam("$host") String endpo @PathParam("ascLocation") String ascLocation, @PathParam("alertName") String alertName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSubscriptionLevelSync(@HostParam("$host") 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/locations/{ascLocation}/alerts/{alertName}") @ExpectedResponses({ 200 }) @@ -121,6 +165,15 @@ Mono> getResourceGroupLevel(@HostParam("$host") String endp @PathParam("resourceGroupName") String resourceGroupName, @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/locations/{ascLocation}/alerts/{alertName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getResourceGroupLevelSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss") @ExpectedResponses({ 204 }) @@ -130,6 +183,15 @@ Mono> updateSubscriptionLevelStateToDismiss(@HostParam("$host") S @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}/dismiss") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSubscriptionLevelStateToDismissSync(@HostParam("$host") 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" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve") @ExpectedResponses({ 204 }) @@ -139,6 +201,15 @@ Mono> updateSubscriptionLevelStateToResolve(@HostParam("$host") S @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}/resolve") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSubscriptionLevelStateToResolveSync(@HostParam("$host") 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" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate") @ExpectedResponses({ 204 }) @@ -148,6 +219,15 @@ Mono> updateSubscriptionLevelStateToActivate(@HostParam("$host") @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}/activate") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSubscriptionLevelStateToActivateSync(@HostParam("$host") 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" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress") @ExpectedResponses({ 204 }) @@ -157,6 +237,15 @@ Mono> updateSubscriptionLevelStateToInProgress(@HostParam("$host" @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 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSubscriptionLevelStateToInProgressSync(@HostParam("$host") 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" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve") @ExpectedResponses({ 204 }) @@ -166,6 +255,15 @@ Mono> updateResourceGroupLevelStateToResolve(@HostParam("$host") @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateResourceGroupLevelStateToResolveSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss") @ExpectedResponses({ 204 }) @@ -175,6 +273,15 @@ Mono> updateResourceGroupLevelStateToDismiss(@HostParam("$host") @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateResourceGroupLevelStateToDismissSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate") @ExpectedResponses({ 204 }) @@ -184,6 +291,15 @@ Mono> updateResourceGroupLevelStateToActivate(@HostParam("$host") @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateResourceGroupLevelStateToActivateSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress") @ExpectedResponses({ 204 }) @@ -193,6 +309,15 @@ Mono> updateResourceGroupLevelStateToInProgress(@HostParam("$host @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateResourceGroupLevelStateToInProgressSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate") @ExpectedResponses({ 202 }) @@ -203,6 +328,16 @@ Mono>> simulate(@HostParam("$host") String endpoint, @BodyParam("application/json") AlertSimulatorRequestBody alertSimulatorRequestBody, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response simulateSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -210,6 +345,13 @@ Mono>> simulate(@HostParam("$host") String endpoint, Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -218,6 +360,13 @@ Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -226,6 +375,14 @@ Mono> listSubscriptionLevelByRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSubscriptionLevelByRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -233,6 +390,14 @@ Mono> listSubscriptionLevelByRegionNext( Mono> listResourceGroupLevelByRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listResourceGroupLevelByRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -265,28 +430,13 @@ private Mono> listSinglePageAsync() { /** * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @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-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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -294,11 +444,26 @@ private Mono> listSinglePageAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of security alerts as paginated response with {@link PagedFlux}. + * @return list of security alerts along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -308,12 +473,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of security alerts as paginated response with {@link PagedFlux}. + * @return list of security alerts along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -325,7 +504,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -339,7 +518,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -381,35 +560,15 @@ private Mono> listByResourceGroupSinglePageAsync(Strin * * @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 ManagementException thrown 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 list of security alerts as paginated response with {@link PagedFlux}. */ - @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 = "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) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -420,12 +579,30 @@ private Mono> listByResourceGroupSinglePageAsync(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 list of security alerts as paginated response with {@link PagedFlux}. + * @return list of security alerts along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -437,12 +614,30 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupName) * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -457,7 +652,8 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupName, */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -473,7 +669,8 @@ public PagedIterable listByResourceGroup(String resourceGroupName) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -514,34 +711,15 @@ private Mono> listSubscriptionLevelByRegionSinglePageA * * @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 list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSubscriptionLevelByRegionSinglePageAsync(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 = "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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation), + nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink)); } /** @@ -552,12 +730,30 @@ private Mono> listSubscriptionLevelByRegionSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation), - nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSubscriptionLevelByRegionSinglePage(String ascLocation) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res = service.listSubscriptionLevelByRegionSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -569,12 +765,30 @@ private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocat * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocation, Context context) { - return new PagedFlux<>(() -> listSubscriptionLevelByRegionSinglePageAsync(ascLocation, context), - nextLink -> listSubscriptionLevelByRegionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSubscriptionLevelByRegionSinglePage(String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res = service.listSubscriptionLevelByRegionSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -589,7 +803,8 @@ private PagedFlux listSubscriptionLevelByRegionAsync(String ascLocat */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listSubscriptionLevelByRegion(String ascLocation) { - return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation)); + return new PagedIterable<>(() -> listSubscriptionLevelByRegionSinglePage(ascLocation), + nextLink -> listSubscriptionLevelByRegionNextSinglePage(nextLink)); } /** @@ -605,7 +820,8 @@ public PagedIterable listSubscriptionLevelByRegion(String ascLocatio */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listSubscriptionLevelByRegion(String ascLocation, Context context) { - return new PagedIterable<>(listSubscriptionLevelByRegionAsync(ascLocation, context)); + return new PagedIterable<>(() -> listSubscriptionLevelByRegionSinglePage(ascLocation, context), + nextLink -> listSubscriptionLevelByRegionNextSinglePage(nextLink, context)); } /** @@ -655,38 +871,15 @@ private Mono> listResourceGroupLevelByRegionSinglePage * 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 ManagementException thrown 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 list of security alerts as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listResourceGroupLevelByRegionSinglePageAsync(String ascLocation, - 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 (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.")); - } - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listResourceGroupLevelByRegionAsync(String ascLocation, String resourceGroupName) { + return new PagedFlux<>(() -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName), + nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink)); } /** @@ -699,12 +892,35 @@ private Mono> listResourceGroupLevelByRegionSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ - @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 PagedResponse listResourceGroupLevelByRegionSinglePage(String ascLocation, + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res = service.listResourceGroupLevelByRegionSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -718,14 +934,35 @@ private PagedFlux listResourceGroupLevelByRegionAsync(String ascLoca * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listResourceGroupLevelByRegionAsync(String ascLocation, String resourceGroupName, - Context context) { - return new PagedFlux<>( - () -> listResourceGroupLevelByRegionSinglePageAsync(ascLocation, resourceGroupName, context), - nextLink -> listResourceGroupLevelByRegionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listResourceGroupLevelByRegionSinglePage(String ascLocation, + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + Response res = service.listResourceGroupLevelByRegionSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -742,7 +979,8 @@ private PagedFlux listResourceGroupLevelByRegionAsync(String ascLoca */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName) { - return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName)); + return new PagedIterable<>(() -> listResourceGroupLevelByRegionSinglePage(ascLocation, resourceGroupName), + nextLink -> listResourceGroupLevelByRegionNextSinglePage(nextLink)); } /** @@ -761,7 +999,9 @@ public PagedIterable listResourceGroupLevelByRegion(String ascLocati @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listResourceGroupLevelByRegion(String ascLocation, String resourceGroupName, Context context) { - return new PagedIterable<>(listResourceGroupLevelByRegionAsync(ascLocation, resourceGroupName, context)); + return new PagedIterable<>( + () -> listResourceGroupLevelByRegionSinglePage(ascLocation, resourceGroupName, context), + nextLink -> listResourceGroupLevelByRegionNextSinglePage(nextLink, context)); } /** @@ -800,43 +1040,6 @@ private Mono> getSubscriptionLevelWithResponseAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 an alert that is associated with a subscription along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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.getSubscriptionLevel(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - ascLocation, alertName, accept, context); - } - /** * Get an alert that is associated with a subscription. * @@ -869,7 +1072,28 @@ private Mono getSubscriptionLevelAsync(String ascLocation, String al @ServiceMethod(returns = ReturnType.SINGLE) public Response getSubscriptionLevelWithResponse(String ascLocation, String alertName, Context context) { - return getSubscriptionLevelWithResponseAsync(ascLocation, alertName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.getSubscriptionLevelSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + ascLocation, alertName, accept, context); } /** @@ -931,49 +1155,6 @@ private Mono> getResourceGroupLevelWithResponseAsync(String .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. - * - * @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 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> 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.")); - } - 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 (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.getResourceGroupLevel(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, ascLocation, alertName, accept, context); - } - /** * Get an alert that is associated a resource group or a resource in a resource group. * @@ -1013,7 +1194,32 @@ private Mono getResourceGroupLevelAsync(String resourceGroupName, St @ServiceMethod(returns = ReturnType.SINGLE) public Response getResourceGroupLevelWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context) { - return getResourceGroupLevelWithResponseAsync(resourceGroupName, ascLocation, alertName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.getResourceGroupLevelSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, ascLocation, alertName, accept, context); } /** @@ -1070,42 +1276,6 @@ private Mono> updateSubscriptionLevelStateToDismissWithResponseAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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.updateSubscriptionLevelStateToDismiss(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context); - } - /** * Update the alert's state. * @@ -1138,58 +1308,43 @@ private Mono updateSubscriptionLevelStateToDismissAsync(String ascLocation @ServiceMethod(returns = ReturnType.SINGLE) public Response updateSubscriptionLevelStateToDismissWithResponse(String ascLocation, String alertName, Context context) { - return updateSubscriptionLevelStateToDismissWithResponseAsync(ascLocation, alertName, context).block(); - } - - /** - * 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName) { - updateSubscriptionLevelStateToDismissWithResponse(ascLocation, alertName, Context.NONE); - } - - /** - * 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 the {@link Response} 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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.updateSubscriptionLevelStateToResolve(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + return service.updateSubscriptionLevelStateToDismissSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, accept, context); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSubscriptionLevelStateToDismiss(String ascLocation, String alertName) { + updateSubscriptionLevelStateToDismissWithResponse(ascLocation, alertName, Context.NONE); } /** @@ -1198,7 +1353,6 @@ private Mono> updateSubscriptionLevelStateToResolveWithResponseAs * @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. @@ -1206,7 +1360,7 @@ private Mono> updateSubscriptionLevelStateToResolveWithResponseAs */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateSubscriptionLevelStateToResolveWithResponseAsync(String ascLocation, - String alertName, Context context) { + String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1223,9 +1377,10 @@ private Mono> updateSubscriptionLevelStateToResolveWithResponseAs } 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 FluxUtil + .withContext(context -> service.updateSubscriptionLevelStateToResolve(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1260,7 +1415,28 @@ private Mono updateSubscriptionLevelStateToResolveAsync(String ascLocation @ServiceMethod(returns = ReturnType.SINGLE) public Response updateSubscriptionLevelStateToResolveWithResponse(String ascLocation, String alertName, Context context) { - return updateSubscriptionLevelStateToResolveWithResponseAsync(ascLocation, alertName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.updateSubscriptionLevelStateToResolveSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, accept, context); } /** @@ -1314,42 +1490,6 @@ private Mono> updateSubscriptionLevelStateToActivateWithResponseA .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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.updateSubscriptionLevelStateToActivate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context); - } - /** * Update the alert's state. * @@ -1382,7 +1522,28 @@ private Mono updateSubscriptionLevelStateToActivateAsync(String ascLocatio @ServiceMethod(returns = ReturnType.SINGLE) public Response updateSubscriptionLevelStateToActivateWithResponse(String ascLocation, String alertName, Context context) { - return updateSubscriptionLevelStateToActivateWithResponseAsync(ascLocation, alertName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.updateSubscriptionLevelStateToActivateSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, accept, context); } /** @@ -1436,42 +1597,6 @@ private Mono> updateSubscriptionLevelStateToInProgressWithRespons .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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.updateSubscriptionLevelStateToInProgress(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), ascLocation, alertName, accept, context); - } - /** * Update the alert's state. * @@ -1504,7 +1629,28 @@ private Mono updateSubscriptionLevelStateToInProgressAsync(String ascLocat @ServiceMethod(returns = ReturnType.SINGLE) public Response updateSubscriptionLevelStateToInProgressWithResponse(String ascLocation, String alertName, Context context) { - return updateSubscriptionLevelStateToInProgressWithResponseAsync(ascLocation, alertName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.updateSubscriptionLevelStateToInProgressSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, alertName, accept, context); } /** @@ -1565,48 +1711,6 @@ private Mono> updateResourceGroupLevelStateToResolveWithResponseA .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 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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.updateResourceGroupLevelStateToResolve(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); - } - /** * Update the alert's state. * @@ -1644,8 +1748,32 @@ private Mono updateResourceGroupLevelStateToResolveAsync(String resourceGr @ServiceMethod(returns = ReturnType.SINGLE) public Response updateResourceGroupLevelStateToResolveWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context) { - return updateResourceGroupLevelStateToResolveWithResponseAsync(resourceGroupName, ascLocation, alertName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.updateResourceGroupLevelStateToResolveSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); } /** @@ -1708,48 +1836,6 @@ private Mono> updateResourceGroupLevelStateToDismissWithResponseA .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 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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.updateResourceGroupLevelStateToDismiss(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); - } - /** * Update the alert's state. * @@ -1766,46 +1852,8 @@ private Mono> updateResourceGroupLevelStateToDismissWithResponseA @ServiceMethod(returns = ReturnType.SINGLE) 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 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void updateResourceGroupLevelStateToDismiss(String resourceGroupName, String ascLocation, String alertName) { - updateResourceGroupLevelStateToDismissWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); + return updateResourceGroupLevelStateToDismissWithResponseAsync(resourceGroupName, ascLocation, alertName) + .flatMap(ignored -> Mono.empty()); } /** @@ -1816,39 +1864,58 @@ public void updateResourceGroupLevelStateToDismiss(String resourceGroupName, Str * @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 the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName) { + public Response updateResourceGroupLevelStateToDismissWithResponse(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + return service.updateResourceGroupLevelStateToDismissSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, 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 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateResourceGroupLevelStateToDismiss(String resourceGroupName, String ascLocation, String alertName) { + updateResourceGroupLevelStateToDismissWithResponse(resourceGroupName, ascLocation, alertName, Context.NONE); } /** @@ -1859,7 +1926,6 @@ private Mono> updateResourceGroupLevelStateToActivateWithResponse * @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. @@ -1867,7 +1933,7 @@ private Mono> updateResourceGroupLevelStateToActivateWithResponse */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateResourceGroupLevelStateToActivateWithResponseAsync(String resourceGroupName, - String ascLocation, String alertName, Context context) { + String ascLocation, String alertName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1888,9 +1954,11 @@ private Mono> updateResourceGroupLevelStateToActivateWithResponse } 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 FluxUtil + .withContext( + context -> service.updateResourceGroupLevelStateToActivate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1930,8 +1998,32 @@ private Mono updateResourceGroupLevelStateToActivateAsync(String resourceG @ServiceMethod(returns = ReturnType.SINGLE) public Response updateResourceGroupLevelStateToActivateWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context) { - return updateResourceGroupLevelStateToActivateWithResponseAsync(resourceGroupName, ascLocation, alertName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.updateResourceGroupLevelStateToActivateSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); } /** @@ -1995,48 +2087,6 @@ private Mono> updateResourceGroupLevelStateToInProgressWithRespon .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 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateResourceGroupLevelStateToInProgressWithResponseAsync(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.")); - } - 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 (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); - } - /** * Update the alert's state. * @@ -2074,8 +2124,32 @@ private Mono updateResourceGroupLevelStateToInProgressAsync(String resourc @ServiceMethod(returns = ReturnType.SINGLE) public Response updateResourceGroupLevelStateToInProgressWithResponse(String resourceGroupName, String ascLocation, String alertName, Context context) { - return updateResourceGroupLevelStateToInProgressWithResponseAsync(resourceGroupName, ascLocation, alertName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.updateResourceGroupLevelStateToInProgressSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, alertName, accept, context); } /** @@ -2141,37 +2215,39 @@ 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 context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> simulateWithResponseAsync(String ascLocation, - AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + private Response simulateWithResponse(String ascLocation, + AlertSimulatorRequestBody alertSimulatorRequestBody) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); } if (alertSimulatorRequestBody == null) { - return Mono.error( - new IllegalArgumentException("Parameter alertSimulatorRequestBody is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter alertSimulatorRequestBody is required and cannot be null.")); } else { alertSimulatorRequestBody.validate(); } final String apiVersion = "2022-01-01"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.simulate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, - alertSimulatorRequestBody, accept, context); + return service.simulateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, + alertSimulatorRequestBody, accept, Context.NONE); } /** @@ -2180,17 +2256,40 @@ 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 context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginSimulateAsync(String ascLocation, - AlertSimulatorRequestBody alertSimulatorRequestBody) { - Mono>> mono = simulateWithResponseAsync(ascLocation, alertSimulatorRequestBody); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response simulateWithResponse(String ascLocation, + AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (alertSimulatorRequestBody == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter alertSimulatorRequestBody is required and cannot be null.")); + } else { + alertSimulatorRequestBody.validate(); + } + final String apiVersion = "2022-01-01"; + final String accept = "application/json"; + return service.simulateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, + alertSimulatorRequestBody, accept, context); } /** @@ -2199,7 +2298,6 @@ 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 context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2207,12 +2305,10 @@ private PollerFlux, Void> beginSimulateAsync(String ascLocation */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginSimulateAsync(String ascLocation, - AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = simulateWithResponseAsync(ascLocation, alertSimulatorRequestBody, context); + AlertSimulatorRequestBody alertSimulatorRequestBody) { + Mono>> mono = simulateWithResponseAsync(ascLocation, alertSimulatorRequestBody); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -2229,7 +2325,8 @@ private PollerFlux, Void> beginSimulateAsync(String ascLocation @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginSimulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { - return this.beginSimulateAsync(ascLocation, alertSimulatorRequestBody).getSyncPoller(); + Response response = simulateWithResponse(ascLocation, alertSimulatorRequestBody); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -2247,7 +2344,8 @@ public SyncPoller, Void> beginSimulate(String ascLocation, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginSimulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { - return this.beginSimulateAsync(ascLocation, alertSimulatorRequestBody, context).getSyncPoller(); + Response response = simulateWithResponse(ascLocation, alertSimulatorRequestBody, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -2267,25 +2365,6 @@ private Mono simulateAsync(String ascLocation, AlertSimulatorRequestBody a .flatMap(this.client::getLroFinalResultOrError); } - /** - * 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 context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 simulateAsync(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, - Context context) { - return beginSimulateAsync(ascLocation, alertSimulatorRequestBody, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Simulate security alerts. * @@ -2298,7 +2377,7 @@ private Mono simulateAsync(String ascLocation, AlertSimulatorRequestBody a */ @ServiceMethod(returns = ReturnType.SINGLE) public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody) { - simulateAsync(ascLocation, alertSimulatorRequestBody).block(); + beginSimulate(ascLocation, alertSimulatorRequestBody).getFinalResult(); } /** @@ -2314,7 +2393,7 @@ public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulato */ @ServiceMethod(returns = ReturnType.SINGLE) public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulatorRequestBody, Context context) { - simulateAsync(ascLocation, alertSimulatorRequestBody, context).block(); + beginSimulate(ascLocation, alertSimulatorRequestBody, context).getFinalResult(); } /** @@ -2342,6 +2421,32 @@ private Mono> listNextSinglePageAsync(String nextLink) .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2350,22 +2455,23 @@ private Mono> listNextSinglePageAsync(String nextLink) * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2395,6 +2501,33 @@ private Mono> listByResourceGroupNextSinglePageAsync(S .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2403,22 +2536,24 @@ private Mono> listByResourceGroupNextSinglePageAsync(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 list of security alerts along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of security alerts along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2447,6 +2582,33 @@ private Mono> listSubscriptionLevelByRegionNextSingleP .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSubscriptionLevelByRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSubscriptionLevelByRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2455,23 +2617,24 @@ private Mono> listSubscriptionLevelByRegionNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSubscriptionLevelByRegionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listSubscriptionLevelByRegionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(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)); + Response res + = service.listSubscriptionLevelByRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2500,6 +2663,33 @@ private Mono> listResourceGroupLevelByRegionNextSingle .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listResourceGroupLevelByRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listResourceGroupLevelByRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2508,22 +2698,25 @@ private Mono> listResourceGroupLevelByRegionNextSingle * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of security alerts along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listResourceGroupLevelByRegionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listResourceGroupLevelByRegionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(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)); + Response res + = service.listResourceGroupLevelByRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(AlertsClientImpl.class); } 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..5fbf105426f5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRuleImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..c36fd8cdab8a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java @@ -0,0 +1,684 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterAlerts") + public interface AlertsSuppressionRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @BodyParam("application/json") AlertsSuppressionRuleInner alertsSuppressionRule, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @BodyParam("application/json") AlertsSuppressionRuleInner alertsSuppressionRule, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("alertsSuppressionRuleName") String alertsSuppressionRuleName, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String alertType) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), alertType, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String alertType, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), alertType, accept, context); + return 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. + * + * @throws 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<>(() -> listSinglePage(alertType), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String alertType, Context context) { + return new PagedIterable<>(() -> listSinglePage(alertType, context), + nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), alertsSuppressionRuleName, alertsSuppressionRule, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + if (alertsSuppressionRule == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter alertsSuppressionRule is required and cannot be null.")); + } else { + alertsSuppressionRule.validate(); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertsSuppressionRuleName, alertsSuppressionRule, accept, 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. + */ + @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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), alertsSuppressionRuleName, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (alertsSuppressionRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter alertsSuppressionRuleName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + alertsSuppressionRuleName, accept, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String alertsSuppressionRuleName) { + deleteWithResponse(alertsSuppressionRuleName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(AlertsSuppressionRulesClientImpl.class); +} 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..353fe376e1f6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String alertsSuppressionRuleName, Context context) { + Response inner + = this.serviceClient().getWithResponse(alertsSuppressionRuleName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AlertsSuppressionRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AlertsSuppressionRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + } + + 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..247f47db343c 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.AllowedConnectionsClient; import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; import com.azure.resourcemanager.security.models.AllowedConnectionsList; @@ -71,6 +72,14 @@ Mono> list(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections") @ExpectedResponses({ 200 }) @@ -79,6 +88,14 @@ Mono> listByHomeRegion(@HostParam("$host") Stri @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, @QueryParam("api-version") String apiVersion, @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) + Response listByHomeRegionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}") @ExpectedResponses({ 200 }) @@ -89,6 +106,16 @@ Mono> get(@HostParam("$host") String e @PathParam("connectionType") ConnectionType connectionType, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -96,6 +123,13 @@ Mono> get(@HostParam("$host") String e Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -103,6 +137,14 @@ Mono> listNext(@PathParam(value = "nextLink", e Mono> listByHomeRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByHomeRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -136,29 +178,14 @@ private Mono> listSinglePageAsync /** * 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 along with {@link PagedResponse} - * 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> 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -166,12 +193,26 @@ private Mono> listSinglePageAsync * * @throws ManagementException 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 along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -181,13 +222,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return 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 along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -200,7 +254,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -215,7 +269,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -257,35 +311,16 @@ private Mono> listByHomeRegionSin * * @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 list of all possible traffic between resources for the subscription and location along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return the list of all possible traffic between resources for the subscription and location as paginated + * response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionSinglePageAsync(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 = "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) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); } /** @@ -296,13 +331,31 @@ private Mono> listByHomeRegionSin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 as paginated - * response with {@link PagedFlux}. + * @return the list of all possible traffic between resources for the subscription and location along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -314,13 +367,32 @@ private PagedFlux listByHomeRegionAsync(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 the list of all possible traffic between resources for the subscription and location as paginated - * response with {@link PagedFlux}. + * @return the list of all possible traffic between resources for the subscription and location along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation, context), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -336,7 +408,8 @@ private PagedFlux listByHomeRegionAsync(String */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation), + nextLink -> listByHomeRegionNextSinglePage(nextLink)); } /** @@ -353,7 +426,8 @@ public PagedIterable listByHomeRegion(String as */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation, Context context) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePage(nextLink, context)); } /** @@ -400,50 +474,6 @@ private Mono> getWithResponseAsync(Str .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. - * - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Gets the list of all possible traffic between resources for the subscription and location, based on connection * type. @@ -485,7 +515,32 @@ private Mono getAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String ascLocation, ConnectionType connectionType, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, connectionType, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (connectionType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter connectionType is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, connectionType, apiVersion, accept, context); } /** @@ -535,6 +590,33 @@ private Mono> listNextSinglePageA .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -543,24 +625,24 @@ 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 list of all possible traffic between Azure resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -590,6 +672,33 @@ private Mono> listByHomeRegionNex .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -598,23 +707,26 @@ 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 list of all possible traffic between Azure resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, + private PagedResponse listByHomeRegionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(AllowedConnectionsClientImpl.class); } 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..d346e5d71ac3 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 @@ -26,8 +26,10 @@ 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.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.security.fluent.ApiCollectionsClient; @@ -77,6 +79,14 @@ Mono> list(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections") @ExpectedResponses({ 200 }) @@ -86,6 +96,15 @@ Mono> listByResourceGroup(@HostParam("$host") String @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @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 }) @@ -95,6 +114,15 @@ Mono> listByAzureApiManagementService(@HostParam("$h @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, @QueryParam("api-version") String apiVersion, @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 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByAzureApiManagementServiceSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, @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/{apiId}") @ExpectedResponses({ 200 }) @@ -105,6 +133,16 @@ Mono> getByAzureApiManagementService(@HostParam("$h @PathParam("apiId") String apiId, @QueryParam("api-version") String apiVersion, @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/{apiId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByAzureApiManagementServiceSync(@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); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") @ExpectedResponses({ 200, 201 }) @@ -115,6 +153,16 @@ Mono>> onboardAzureApiManagementApi(@HostParam("$host" @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 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response onboardAzureApiManagementApiSync(@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); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}") @ExpectedResponses({ 200, 204 }) @@ -125,6 +173,16 @@ Mono> offboardAzureApiManagementApi(@HostParam("$host") String en @PathParam("apiId") String apiId, @QueryParam("api-version") String apiVersion, @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 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response offboardAzureApiManagementApiSync(@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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -133,6 +191,14 @@ Mono> listBySubscriptionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -141,6 +207,14 @@ Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -148,6 +222,14 @@ Mono> listByResourceGroupNext( Mono> listByAzureApiManagementServiceNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByAzureApiManagementServiceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -185,29 +267,15 @@ private Mono> listSinglePageAsync() { * * 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 that have been onboarded to Microsoft Defender for APIs - * along with {@link PagedResponse} on successful completion of {@link Mono}. + * as paginated response with {@link PagedFlux}. */ - @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(), this.client.getSubscriptionId(), apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -218,12 +286,26 @@ private Mono> listSinglePageAsync(Context cont * @throws ManagementException thrown if 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}. + * along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -236,12 +318,26 @@ private PagedFlux listAsync() { * @throws ManagementException thrown if 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}. + * along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -256,7 +352,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -273,7 +369,8 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -318,36 +415,16 @@ private Mono> listByResourceGroupSinglePageAsy * 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 - * along with {@link PagedResponse} on successful completion of {@link Mono}. + * as paginated response with {@link PagedFlux}. */ - @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-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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -360,12 +437,30 @@ private Mono> listByResourceGroupSinglePageAsy * @throws ManagementException thrown if 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}. + * along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -379,12 +474,30 @@ private PagedFlux listByResourceGroupAsync(String resourceGr * @throws ManagementException thrown if 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}. + * along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -401,7 +514,8 @@ private PagedFlux listByResourceGroupAsync(String resourceGr */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -419,7 +533,8 @@ public PagedIterable listByResourceGroup(String resourceGrou */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -474,39 +589,17 @@ public PagedIterable listByResourceGroup(String resourceGrou * * @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 ManagementException thrown if 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 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.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.COLLECTION) + private PagedFlux listByAzureApiManagementServiceAsync(String resourceGroupName, + String serviceName) { + return new PagedFlux<>(() -> listByAzureApiManagementServiceSinglePageAsync(resourceGroupName, serviceName), + nextLink -> listByAzureApiManagementServiceNextSinglePageAsync(nextLink)); } /** @@ -521,14 +614,36 @@ public PagedIterable listByResourceGroup(String resourceGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByAzureApiManagementServiceAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByAzureApiManagementServiceSinglePage(String resourceGroupName, String serviceName) { - return new PagedFlux<>(() -> listByAzureApiManagementServiceSinglePageAsync(resourceGroupName, serviceName), - nextLink -> listByAzureApiManagementServiceNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + Response res = service.listByAzureApiManagementServiceSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -544,15 +659,36 @@ private PagedFlux listByAzureApiManagementServiceAsync(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 a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs as paginated - * response with {@link PagedFlux}. + * @return a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByAzureApiManagementServiceAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByAzureApiManagementServiceSinglePage(String resourceGroupName, String serviceName, Context context) { - return new PagedFlux<>( - () -> listByAzureApiManagementServiceSinglePageAsync(resourceGroupName, serviceName, context), - nextLink -> listByAzureApiManagementServiceNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + Response res = service.listByAzureApiManagementServiceSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -573,7 +709,8 @@ private PagedFlux listByAzureApiManagementServiceAsync(Strin @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName) { - return new PagedIterable<>(listByAzureApiManagementServiceAsync(resourceGroupName, serviceName)); + return new PagedIterable<>(() -> listByAzureApiManagementServiceSinglePage(resourceGroupName, serviceName), + nextLink -> listByAzureApiManagementServiceNextSinglePage(nextLink)); } /** @@ -595,7 +732,9 @@ public PagedIterable listByAzureApiManagementService(String @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByAzureApiManagementService(String resourceGroupName, String serviceName, Context context) { - return new PagedIterable<>(listByAzureApiManagementServiceAsync(resourceGroupName, serviceName, context)); + return new PagedIterable<>( + () -> listByAzureApiManagementServiceSinglePage(resourceGroupName, serviceName, context), + nextLink -> listByAzureApiManagementServiceNextSinglePage(nextLink, context)); } /** @@ -644,52 +783,6 @@ private Mono> getByAzureApiManagementServiceWithRes .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets an onboarded Azure API Management API - * - * 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 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> 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.")); - } - 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.")); - } - 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.getByAzureApiManagementService(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, serviceName, apiId, apiVersion, accept, context); - } - /** * Gets an onboarded Azure API Management API * @@ -735,7 +828,31 @@ private Mono getByAzureApiManagementServiceAsync(String reso @ServiceMethod(returns = ReturnType.SINGLE) public Response getByAzureApiManagementServiceWithResponse(String resourceGroupName, String serviceName, String apiId, Context context) { - return getByAzureApiManagementServiceWithResponseAsync(resourceGroupName, serviceName, apiId, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (apiId == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + return service.getByAzureApiManagementServiceSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, apiId, apiVersion, accept, context); } /** @@ -818,39 +935,39 @@ private Mono>> onboardAzureApiManagementApiWithRespons * @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 an API collection as represented by Microsoft Defender for APIs along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> onboardAzureApiManagementApiWithResponseAsync(String resourceGroupName, - String serviceName, String apiId, Context context) { + private Response onboardAzureApiManagementApiWithResponse(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError().log(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.onboardAzureApiManagementApiSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, apiId, apiVersion, accept, Context.NONE); } /** @@ -864,18 +981,40 @@ private Mono>> onboardAzureApiManagementApiWithRespons * @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 an API collection as represented by Microsoft Defender for APIs along with {@link Response}. */ - @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.SINGLE) + private Response onboardAzureApiManagementApiWithResponse(String resourceGroupName, String serviceName, + String apiId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (apiId == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + return service.onboardAzureApiManagementApiSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, apiId, apiVersion, accept, context); } /** @@ -889,20 +1028,18 @@ private Mono>> onboardAzureApiManagementApiWithRespons * @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. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ApiCollectionInner> beginOnboardAzureApiManagementApiAsync( - String resourceGroupName, String serviceName, String apiId, Context context) { - context = this.client.mergeContext(context); + private PollerFlux, ApiCollectionInner> + beginOnboardAzureApiManagementApiAsync(String resourceGroupName, String serviceName, String apiId) { Mono>> mono - = onboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId, context); + = onboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ApiCollectionInner.class, ApiCollectionInner.class, context); + ApiCollectionInner.class, ApiCollectionInner.class, this.client.getContext()); } /** @@ -924,7 +1061,9 @@ private PollerFlux, ApiCollectionInner> beginOnbo @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ApiCollectionInner> beginOnboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { - return this.beginOnboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).getSyncPoller(); + Response response = onboardAzureApiManagementApiWithResponse(resourceGroupName, serviceName, apiId); + return this.client.getLroResult(response, ApiCollectionInner.class, + ApiCollectionInner.class, Context.NONE); } /** @@ -947,8 +1086,10 @@ private PollerFlux, ApiCollectionInner> beginOnbo @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(); + Response response + = onboardAzureApiManagementApiWithResponse(resourceGroupName, serviceName, apiId, context); + return this.client.getLroResult(response, ApiCollectionInner.class, + ApiCollectionInner.class, context); } /** @@ -974,30 +1115,6 @@ private Mono onboardAzureApiManagementApiAsync(String resour .flatMap(this.client::getLroFinalResultOrError); } - /** - * Onboard an Azure API Management API 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 an API collection as represented by Microsoft Defender for APIs on successful completion of {@link Mono}. - */ - @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); - } - /** * Onboard an Azure API Management API to Microsoft Defender for APIs * @@ -1016,7 +1133,7 @@ private Mono onboardAzureApiManagementApiAsync(String resour */ @ServiceMethod(returns = ReturnType.SINGLE) public ApiCollectionInner onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId) { - return onboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId).block(); + return beginOnboardAzureApiManagementApi(resourceGroupName, serviceName, apiId).getFinalResult(); } /** @@ -1039,7 +1156,7 @@ public ApiCollectionInner onboardAzureApiManagementApi(String resourceGroupName, @ServiceMethod(returns = ReturnType.SINGLE) public ApiCollectionInner onboardAzureApiManagementApi(String resourceGroupName, String serviceName, String apiId, Context context) { - return onboardAzureApiManagementApiAsync(resourceGroupName, serviceName, apiId, context).block(); + return beginOnboardAzureApiManagementApi(resourceGroupName, serviceName, apiId, context).getFinalResult(); } /** @@ -1086,50 +1203,6 @@ private Mono> offboardAzureApiManagementApiWithResponseAsync(Stri .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Offboard an Azure API Management API from Microsoft Defender for APIs - * - * 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 ManagementException thrown 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> offboardAzureApiManagementApiWithResponseAsync(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.")); - } - 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.")); - } - 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); - } - /** * Offboard an Azure API Management API from Microsoft Defender for APIs * @@ -1170,7 +1243,31 @@ private Mono offboardAzureApiManagementApiAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.SINGLE) public Response offboardAzureApiManagementApiWithResponse(String resourceGroupName, String serviceName, String apiId, Context context) { - return offboardAzureApiManagementApiWithResponseAsync(resourceGroupName, serviceName, apiId, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (apiId == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter apiId is required and cannot be null.")); + } + final String apiVersion = "2023-11-15"; + final String accept = "application/json"; + return service.offboardAzureApiManagementApiSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, apiId, apiVersion, accept, context); } /** @@ -1220,6 +1317,34 @@ private Mono> listBySubscriptionNextSinglePage .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1229,23 +1354,24 @@ private Mono> listBySubscriptionNextSinglePage * @throws 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}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1276,6 +1402,34 @@ private Mono> listByResourceGroupNextSinglePag .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1285,23 +1439,24 @@ private Mono> listByResourceGroupNextSinglePag * @throws 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}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1333,6 +1488,34 @@ private Mono> listByResourceGroupNextSinglePag .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByAzureApiManagementServiceNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByAzureApiManagementServiceNextSync(nextLink, + this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1342,22 +1525,26 @@ private Mono> listByResourceGroupNextSinglePag * @throws 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}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByAzureApiManagementServiceNextSinglePageAsync(String nextLink, + private PagedResponse listByAzureApiManagementServiceNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(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)); + Response res + = service.listByAzureApiManagementServiceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ApiCollectionsClientImpl.class); } 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..ccd43af051f8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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() + .getApplicationOperations() + .createOrUpdateWithResponse(applicationId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Application create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApplicationOperations() + .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() + .getApplicationOperations() + .createOrUpdateWithResponse(applicationId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Application apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApplicationOperations() + .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() + .getApplicationOperations() + .getWithResponse(applicationId, Context.NONE) + .getValue(); + return this; + } + + public Application refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApplicationOperations() + .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/ApplicationOperationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationOperationsClientImpl.java new file mode 100644 index 000000000000..43f3c9779733 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationOperationsClientImpl.java @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ApplicationOperationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ApplicationOperationsClient. + */ +public final class ApplicationOperationsClientImpl implements ApplicationOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ApplicationOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ApplicationOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationOperationsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(ApplicationOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterApplicationOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterApplic") + public interface ApplicationOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationId") String applicationId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationId") String applicationId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationId") String applicationId, + @BodyParam("application/json") ApplicationInner application, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationId") String applicationId, + @BodyParam("application/json") ApplicationInner application, @HeaderParam("Accept") String accept, + 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("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("applicationId") String applicationId, + 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) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("applicationId") 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 ManagementException 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (applicationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), applicationId, application, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (applicationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + if (application == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + applicationId, application, accept, 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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (applicationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + return service.deleteSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String applicationId) { + deleteWithResponse(applicationId, Context.NONE); + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationOperationsClientImpl.class); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationOperationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationOperationsImpl.java new file mode 100644 index 000000000000..fb1cc5d536bb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationOperationsImpl.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ApplicationOperationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import com.azure.resourcemanager.security.models.Application; +import com.azure.resourcemanager.security.models.ApplicationOperations; + +public final class ApplicationOperationsImpl implements ApplicationOperations { + private static final ClientLogger LOGGER = new ClientLogger(ApplicationOperationsImpl.class); + + private final ApplicationOperationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ApplicationOperationsImpl(ApplicationOperationsClient 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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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 ApplicationOperationsClient 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/ApplicationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsClientImpl.java new file mode 100644 index 000000000000..10d3f83ac05f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsClientImpl.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterApplic") + public interface ApplicationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications") + @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/applications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context 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 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. + * + * @throws ManagementException thrown if 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. + * + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a security applications list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 applications list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 applications list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationsClientImpl.class); +} 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..94842779359e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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 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())); + } + + private ApplicationsClient 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/AscLocationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java new file mode 100644 index 000000000000..557b0b5b19e0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AscLocationImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..819befa6a6cd 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 @@ -28,6 +28,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.AssessmentsClient; import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentResponseInner; import com.azure.resourcemanager.security.models.ExpandEnum; @@ -75,6 +76,14 @@ 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("/{scope}/providers/Microsoft.Security/assessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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 }) @@ -85,6 +94,16 @@ Mono> get(@HostParam("$host") String e @PathParam("assessmentName") String assessmentName, @QueryParam("$expand") ExpandEnum expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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 }) @@ -96,6 +115,17 @@ Mono> createOrUpdate(@HostParam("$host @BodyParam("application/json") SecurityAssessment assessment, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") 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, + Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") @ExpectedResponses({ 200, 204 }) @@ -104,12 +134,27 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam(value = "resourceId", encoded = true) String resourceId, @PathParam("assessmentName") String assessmentName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @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("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -146,28 +191,15 @@ private Mono> listSinglePageAsync * * @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}. + * @return security assessments on all your scanned resources inside a scope as paginated response with + * {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -178,12 +210,24 @@ private Mono> listSinglePageAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return security assessments on all your scanned resources inside a scope as paginated response with - * {@link PagedFlux}. + * @return security assessments on all your scanned resources inside a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String scope) { - return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -195,13 +239,24 @@ private PagedFlux listAsync(String 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 assessments on all your scanned resources inside a scope as paginated response with - * {@link PagedFlux}. + * @return security assessments on all your scanned resources inside a scope along with {@link PagedResponse}. */ - @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) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -217,7 +272,7 @@ private PagedFlux listAsync(String scope, Conte */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope) { - return new PagedIterable<>(listAsync(scope)); + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); } /** @@ -234,7 +289,8 @@ public PagedIterable list(String scope) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope, Context context) { - return new PagedIterable<>(listAsync(scope, context)); + return new PagedIterable<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -270,38 +326,6 @@ private Mono> getWithResponseAsync(Str .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get a security assessment on your scanned resource. - * - * @param resourceId The 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 assessment on your scanned resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceId, - String assessmentName, ExpandEnum expand, 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 (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"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, expand, accept, context); - } - /** * Get a security assessment on your scanned resource. * @@ -334,7 +358,23 @@ private Mono getAsync(String resourceId, String @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceId, String assessmentName, ExpandEnum expand, Context context) { - return getWithResponseAsync(resourceId, assessmentName, expand, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, expand, accept, + context); } /** @@ -392,45 +432,6 @@ private Mono> createOrUpdateWithRespon .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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 on a resource - response format along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceId, - String assessmentName, SecurityAssessment assessment, 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 (assessmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); - } - if (assessment == null) { - return Mono.error(new IllegalArgumentException("Parameter assessment is required and cannot be null.")); - } else { - assessment.validate(); - } - final String apiVersion = "2021-06-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, assessment, - accept, 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. @@ -466,7 +467,29 @@ private Mono createOrUpdateAsync(String resourc @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceId, String assessmentName, SecurityAssessment assessment, Context context) { - return createOrUpdateWithResponseAsync(resourceId, assessmentName, assessment, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assessment == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessment is required and cannot be null.")); + } else { + assessment.validate(); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, assessment, + accept, context); } /** @@ -518,36 +541,6 @@ private Mono> deleteWithResponseAsync(String resourceId, String a .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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. - * @throws ManagementException thrown 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 assessmentName, 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 (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"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, accept, 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. @@ -578,7 +571,22 @@ private Mono deleteAsync(String resourceId, String assessmentName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceId, String assessmentName, Context context) { - return deleteWithResponseAsync(resourceId, assessmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, resourceId, assessmentName, accept, context); } /** @@ -622,6 +630,33 @@ private Mono> listNextSinglePageA .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -630,23 +665,25 @@ 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 page of a security assessments list along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(AssessmentsClientImpl.class); } 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..c20a2366c2cb 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 @@ -28,6 +28,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.AssessmentsMetadatasClient; import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataResponseInner; import com.azure.resourcemanager.security.models.SecurityAssessmentMetadataResponseList; @@ -72,6 +73,13 @@ public interface AssessmentsMetadatasService { Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/assessmentMetadata") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @@ -81,6 +89,15 @@ Mono> get(@HostParam("$host") @PathParam("assessmentMetadataName") String assessmentMetadataName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata") @ExpectedResponses({ 200 }) @@ -89,6 +106,14 @@ Mono> listBySubscription(@HostP @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/assessmentMetadata") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@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/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @@ -98,6 +123,15 @@ Mono> getInSubscription(@HostP @PathParam("assessmentMetadataName") String assessmentMetadataName, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getInSubscriptionSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @@ -109,6 +143,17 @@ Mono> createInSubscription( @BodyParam("application/json") SecurityAssessmentMetadataResponseInner assessmentMetadata, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createInSubscriptionSync(@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); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") @ExpectedResponses({ 200 }) @@ -118,6 +163,15 @@ Mono> deleteInSubscription(@HostParam("$host") String endpoint, @PathParam("assessmentMetadataName") String assessmentMetadataName, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteInSubscriptionSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("assessmentMetadataName") String assessmentMetadataName, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -126,6 +180,14 @@ Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -133,6 +195,14 @@ Mono> listNext( Mono> listBySubscriptionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -161,25 +231,13 @@ private Mono> listSingleP /** * 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 along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return metadata information on all assessment types as paginated response with {@link PagedFlux}. */ - @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 = "2021-06-01"; - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -187,11 +245,21 @@ private Mono> listSingleP * * @throws 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 all assessment types along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -201,12 +269,21 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return metadata information on all assessment types as paginated response with {@link PagedFlux}. + * @return metadata information on all assessment types along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -218,7 +295,7 @@ private PagedFlux listAsync(Context con */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -232,7 +309,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -264,34 +341,6 @@ public PagedIterable list(Context conte .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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 - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - if (assessmentMetadataName == null) { - return Mono.error( - new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); - } - final String apiVersion = "2021-06-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context); - } - /** * Get metadata information on an assessment type. * @@ -319,7 +368,18 @@ private Mono getAsync(String assessment @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String assessmentMetadataName, Context context) { - return getWithResponseAsync(assessmentMetadataName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, assessmentMetadataName, accept, context); } /** @@ -368,31 +428,15 @@ private Mono> listBySubsc /** * Get metadata information on all assessment types in a specific 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 metadata information on all assessment types in a specific subscription along with {@link PagedResponse} - * 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> - listBySubscriptionSinglePageAsync(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-06-01"; - final String accept = "application/json"; - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -400,13 +444,26 @@ private Mono> listBySubsc * * @throws 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 metadata information on all assessment types in a specific subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySubscriptionAsync() { - return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -416,13 +473,26 @@ private PagedFlux listBySubscriptionAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 metadata information on all assessment types in a specific subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySubscriptionAsync(Context context) { - return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -435,7 +505,8 @@ private PagedFlux listBySubscriptionAsy */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySubscription() { - return new PagedIterable<>(listBySubscriptionAsync()); + return new PagedIterable<>(() -> listBySubscriptionSinglePage(), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -450,7 +521,8 @@ public PagedIterable listBySubscription */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySubscription(Context context) { - return new PagedIterable<>(listBySubscriptionAsync(context)); + return new PagedIterable<>(() -> listBySubscriptionSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -486,39 +558,6 @@ public PagedIterable listBySubscription .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 an assessment type in a specific subscription along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getInSubscription(this.client.getEndpoint(), apiVersion, assessmentMetadataName, - this.client.getSubscriptionId(), accept, context); - } - /** * Get metadata information on an assessment type in a specific subscription. * @@ -548,7 +587,24 @@ private Mono getInSubscriptionAsync(Str @ServiceMethod(returns = ReturnType.SINGLE) public Response getInSubscriptionWithResponse(String assessmentMetadataName, Context context) { - return getInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return service.getInSubscriptionSync(this.client.getEndpoint(), apiVersion, assessmentMetadataName, + this.client.getSubscriptionId(), accept, context); } /** @@ -605,46 +661,6 @@ private Mono> createInSubscrip .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 security assessment metadata response along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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 (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.")); - } - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.createInSubscription(this.client.getEndpoint(), apiVersion, assessmentMetadataName, - this.client.getSubscriptionId(), assessmentMetadata, accept, context); - } - /** * Create metadata information on an assessment type in a specific subscription. * @@ -676,7 +692,30 @@ private Mono createInSubscriptionAsync( @ServiceMethod(returns = ReturnType.SINGLE) public Response createInSubscriptionWithResponse( String assessmentMetadataName, SecurityAssessmentMetadataResponseInner assessmentMetadata, Context context) { - return createInSubscriptionWithResponseAsync(assessmentMetadataName, assessmentMetadata, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (assessmentMetadata == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentMetadata is required and cannot be null.")); + } else { + assessmentMetadata.validate(); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return service.createInSubscriptionSync(this.client.getEndpoint(), apiVersion, assessmentMetadataName, + this.client.getSubscriptionId(), assessmentMetadata, accept, context); } /** @@ -727,38 +766,6 @@ private Mono> deleteInSubscriptionWithResponseAsync(String assess .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. - * - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteInSubscription(this.client.getEndpoint(), apiVersion, assessmentMetadataName, - this.client.getSubscriptionId(), accept, 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. @@ -787,7 +794,24 @@ private Mono deleteInSubscriptionAsync(String assessmentMetadataName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteInSubscriptionWithResponse(String assessmentMetadataName, Context context) { - return deleteInSubscriptionWithResponseAsync(assessmentMetadataName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (assessmentMetadataName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentMetadataName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-01"; + final String accept = "application/json"; + return service.deleteInSubscriptionSync(this.client.getEndpoint(), apiVersion, assessmentMetadataName, + this.client.getSubscriptionId(), accept, context); } /** @@ -831,6 +855,33 @@ private Mono> listNextSin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -839,24 +890,25 @@ 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 list of security assessment metadata along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -889,6 +941,33 @@ private Mono> listNextSin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -897,23 +976,26 @@ 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 list of security assessment metadata along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(AssessmentsMetadatasClientImpl.class); } 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..772b0a9b0fde --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingImpl.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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..382a821e171b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterAutoPr") + public interface AutoProvisioningSettingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings") + @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/autoProvisioningSettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/autoProvisioningSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, + @BodyParam("application/json") AutoProvisioningSettingInner setting, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") String settingName, + @BodyParam("application/json") AutoProvisioningSettingInner setting, @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context 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 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. + * + * @throws ManagementException thrown 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. + * + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), settingName, setting, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, + setting, accept, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoProvisioningSettingInner create(String settingName, AutoProvisioningSettingInner setting) { + return createWithResponse(settingName, setting, 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(AutoProvisioningSettingsClientImpl.class); +} 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..6f422238d33e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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 Response getWithResponse(String settingName, Context context) { + Response inner = this.serviceClient().getWithResponse(settingName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AutoProvisioningSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AutoProvisioningSetting get(String settingName) { + AutoProvisioningSettingInner inner = this.serviceClient().get(settingName); + if (inner != null) { + return new AutoProvisioningSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + 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..d3ff240c3785 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationImpl.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +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 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 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 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().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..62257fd6317d --- /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) AutoRest 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..6793ea5b104c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java @@ -0,0 +1,1289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterAutoma") + public interface AutomationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations") + @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/automations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") 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); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") 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); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationInner automation, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationInner automation, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationUpdateModel automation, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationUpdateModel automation, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") 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); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") 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); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationInner automation, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("automationName") String automationName, + @BodyParam("application/json") AutomationInner automation, @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") 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, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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. + * + * @throws ManagementException thrown 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. + * + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(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 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 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 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 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 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 automations response along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return 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 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 ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, accept, context); + return 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 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 automations response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(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 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 ManagementException thrown 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<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.getByResourceGroupSync(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 within the user's subscription. 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 within the user's subscription. 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, automationName, automation, accept, 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, automation, accept, 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 within the user's subscription. 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 within the user's subscription. 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, automationName, automation, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, automation, accept, context); + } + + /** + * Updates a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, automationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, accept, context); + } + + /** + * Deletes a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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); + } + + /** + * 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 within the user's subscription. 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.validate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, automationName, automation, accept, 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (automationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automationName is required and cannot be null.")); + } + if (automation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter automation is required and cannot be null.")); + } else { + automation.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.validateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, automationName, automation, accept, 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 within the user's subscription. 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> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(AutomationsClientImpl.class); +} 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..e76dfb3dd1cb --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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 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 Response getByResourceGroupWithResponse(String resourceGroupName, String automationName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, automationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AutomationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 Response validateWithResponse(String resourceGroupName, String automationName, + AutomationInner automation, Context context) { + Response inner + = this.serviceClient().validateWithResponse(resourceGroupName, automationName, automation, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AutomationValidationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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..3a03fd4e6f7c --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public AzureDevOpsOrgProperties properties() { + return this.innerModel().properties(); + } + + 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..5c34831e7124 --- /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) AutoRest 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..2ab94b801cb6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsClientImpl.java @@ -0,0 +1,1211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.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.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +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("{$host}") + @ServiceInterface(name = "SecurityCenterAzureD") + public interface AzureDevOpsOrgsService { + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @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) + Response listAvailableSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsOrgInner azureDevOpsOrg, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsOrgInner azureDevOpsOrg, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsOrgInner azureDevOpsOrg, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsOrgInner azureDevOpsOrg, @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.listAvailableSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, 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. + */ + @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. + * + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, apiVersion, accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePage(nextLink, 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 Azure DevOps organization 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, apiVersion, 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 Azure DevOps organization 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 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 Azure DevOps organization 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 azure DevOps Organization resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, apiVersion, 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 Azure DevOps organization 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 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 Azure DevOps organization name. + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, apiVersion, azureDevOpsOrg, accept, 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 Azure DevOps organization name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, apiVersion, azureDevOpsOrg, accept, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, apiVersion, azureDevOpsOrg, accept, 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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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) { + Response response + = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg); + return this.client.getLroResult(response, AzureDevOpsOrgInner.class, + AzureDevOpsOrgInner.class, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @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) { + Response response + = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context); + return this.client.getLroResult(response, 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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg).getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context) + .getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, apiVersion, azureDevOpsOrg, accept, 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 Azure DevOps organization name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, apiVersion, azureDevOpsOrg, accept, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, AzureDevOpsOrgInner azureDevOpsOrg, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (azureDevOpsOrg == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsOrg is required and cannot be null.")); + } else { + azureDevOpsOrg.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, apiVersion, azureDevOpsOrg, accept, 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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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) { + Response response + = updateWithResponse(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg); + return this.client.getLroResult(response, AzureDevOpsOrgInner.class, + AzureDevOpsOrgInner.class, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @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) { + Response response + = updateWithResponse(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context); + return this.client.getLroResult(response, 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 Azure DevOps organization name. + * @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 Azure DevOps organization name. + * @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 beginUpdate(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg).getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @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 beginUpdate(resourceGroupName, securityConnectorName, orgName, azureDevOpsOrg, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureDevOpsOrgsClientImpl.class); +} 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..a51d49dabb6e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsImpl.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().listAvailableWithResponse(resourceGroupName, securityConnectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsOrgListResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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 getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, orgName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsOrgImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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..ea3919c3f628 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public AzureDevOpsProjectProperties properties() { + return this.innerModel().properties(); + } + + 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..6f619b5024a5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsClientImpl.java @@ -0,0 +1,1173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.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.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +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.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("{$host}") + @ServiceInterface(name = "SecurityCenterAzureD") + public interface AzureDevOpsProjectsService { + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsProjectInner azureDevOpsProject, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsProjectInner azureDevOpsProject, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsProjectInner azureDevOpsProject, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsProjectInner azureDevOpsProject, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 Azure DevOps organization 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, 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of 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 Azure DevOps organization 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, + 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 Azure DevOps organization 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String securityConnectorName, String orgName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, apiVersion, accept, Context.NONE); + return 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 Azure DevOps organization 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String securityConnectorName, String orgName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, apiVersion, accept, context); + return 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 Azure DevOps organization 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, + String orgName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, orgName), + nextLink -> listNextSinglePage(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 Azure DevOps organization 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, + String orgName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, orgName, context), + nextLink -> listNextSinglePage(nextLink, 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 Azure DevOps organization name. + * @param projectName The project 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, apiVersion, 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 Azure DevOps organization name. + * @param projectName The project 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 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 Azure DevOps organization name. + * @param projectName The project 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, 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 Azure DevOps organization name. + * @param projectName The project 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 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 Azure DevOps organization name. + * @param projectName The project name. + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, apiVersion, azureDevOpsProject, accept, + 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 Azure DevOps organization name. + * @param projectName The project name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, azureDevOpsProject, accept, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, azureDevOpsProject, accept, 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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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) { + Response response = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, orgName, + projectName, azureDevOpsProject); + return this.client.getLroResult(response, + AzureDevOpsProjectInner.class, AzureDevOpsProjectInner.class, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @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) { + Response response = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, orgName, + projectName, azureDevOpsProject, context); + return this.client.getLroResult(response, + 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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject) + .getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, + context).getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, azureDevOpsProject, accept, 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 Azure DevOps organization name. + * @param projectName The project name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, azureDevOpsProject, accept, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, AzureDevOpsProjectInner azureDevOpsProject, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (azureDevOpsProject == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsProject is required and cannot be null.")); + } else { + azureDevOpsProject.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, azureDevOpsProject, accept, 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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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) { + Response response + = updateWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject); + return this.client.getLroResult(response, + AzureDevOpsProjectInner.class, AzureDevOpsProjectInner.class, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @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) { + Response response = updateWithResponse(resourceGroupName, securityConnectorName, orgName, + projectName, azureDevOpsProject, context); + return this.client.getLroResult(response, + 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 Azure DevOps organization name. + * @param projectName The project name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @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 beginUpdate(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject) + .getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @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 beginUpdate(resourceGroupName, securityConnectorName, orgName, projectName, azureDevOpsProject, context) + .getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureDevOpsProjectsClientImpl.class); +} 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..1979a1eb0764 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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 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 Response getWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, orgName, projectName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsProjectImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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..e589fa7b782c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposClientImpl.java @@ -0,0 +1,1256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.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.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +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.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("{$host}") + @ServiceInterface(name = "SecurityCenterAzureD") + 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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsRepositoryInner azureDevOpsRepository, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsRepositoryInner azureDevOpsRepository, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsRepositoryInner azureDevOpsRepository, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("orgName") String orgName, + @PathParam("projectName") String projectName, @PathParam("repoName") String repoName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureDevOpsRepositoryInner azureDevOpsRepository, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 Azure DevOps organization name. + * @param projectName The project 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, 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of 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 Azure DevOps organization name. + * @param projectName The project 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, + 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 Azure DevOps organization name. + * @param projectName The project 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String securityConnectorName, String orgName, String projectName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, accept, Context.NONE); + return 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 Azure DevOps organization name. + * @param projectName The project 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String securityConnectorName, String orgName, String projectName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, apiVersion, accept, context); + return 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 Azure DevOps organization name. + * @param projectName The project 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, + String orgName, String projectName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, orgName, projectName), + nextLink -> listNextSinglePage(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 Azure DevOps organization name. + * @param projectName The project 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, + String orgName, String projectName, Context context) { + return new PagedIterable<>( + () -> listSinglePage(resourceGroupName, securityConnectorName, orgName, projectName, context), + nextLink -> listNextSinglePage(nextLink, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, repoName, apiVersion, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, repoName, apiVersion, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, repoName, apiVersion, + azureDevOpsRepository, accept, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, repoName, apiVersion, azureDevOpsRepository, accept, + Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, repoName, apiVersion, azureDevOpsRepository, accept, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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) { + Response response = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, orgName, + projectName, repoName, azureDevOpsRepository); + return this.client.getLroResult(response, + AzureDevOpsRepositoryInner.class, AzureDevOpsRepositoryInner.class, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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) { + Response response = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, orgName, + projectName, repoName, azureDevOpsRepository, context); + return this.client.getLroResult(response, + 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository).getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context).getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, orgName, projectName, repoName, apiVersion, + azureDevOpsRepository, accept, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, repoName, apiVersion, azureDevOpsRepository, accept, + Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + String orgName, String projectName, String repoName, AzureDevOpsRepositoryInner azureDevOpsRepository, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (orgName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (repoName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + if (azureDevOpsRepository == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter azureDevOpsRepository is required and cannot be null.")); + } else { + azureDevOpsRepository.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, orgName, projectName, repoName, apiVersion, azureDevOpsRepository, accept, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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) { + Response response = updateWithResponse(resourceGroupName, securityConnectorName, orgName, + projectName, repoName, azureDevOpsRepository); + return this.client.getLroResult(response, + AzureDevOpsRepositoryInner.class, AzureDevOpsRepositoryInner.class, Context.NONE); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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) { + Response response = updateWithResponse(resourceGroupName, securityConnectorName, orgName, + projectName, repoName, azureDevOpsRepository, context); + return this.client.getLroResult(response, + 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 beginUpdate(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository).getFinalResult(); + } + + /** + * 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository name. + * @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 beginUpdate(resourceGroupName, securityConnectorName, orgName, projectName, repoName, + azureDevOpsRepository, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureDevOpsReposClientImpl.class); +} 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..06dbf86e5b74 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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 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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureDevOpsRepositoryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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..81f33dc76ad8 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public AzureDevOpsRepositoryProperties properties() { + return this.innerModel().properties(); + } + + 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..852c490b819c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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/ComplianceResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java index 1409b6b9ba75..b50f2d386761 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.ComplianceResultsClient; import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; import com.azure.resourcemanager.security.models.ComplianceResultList; @@ -70,6 +71,14 @@ 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("/{scope}/providers/Microsoft.Security/complianceResults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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 }) @@ -80,12 +89,29 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("complianceResultName") String complianceResultName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -122,28 +148,14 @@ private Mono> listSinglePageAsync(String sc * * @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 along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of compliance results response as paginated response with {@link PagedFlux}. */ - @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"; - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -154,11 +166,24 @@ private Mono> listSinglePageAsync(String sc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of compliance results response along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String scope) { - return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -170,12 +195,24 @@ private PagedFlux listAsync(String 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 list of compliance results response as paginated response with {@link PagedFlux}. + * @return list of compliance results response along with {@link PagedResponse}. */ - @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) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -190,7 +227,7 @@ private PagedFlux listAsync(String scope, Context context */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope) { - return new PagedIterable<>(listAsync(scope)); + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); } /** @@ -206,7 +243,8 @@ public PagedIterable list(String scope) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope, Context context) { - return new PagedIterable<>(listAsync(scope, context)); + return new PagedIterable<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -240,37 +278,6 @@ private Mono> getWithResponseAsync(String resour .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Security Compliance Result. - * - * @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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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 (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.get(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, accept, context); - } - /** * Security Compliance Result. * @@ -300,7 +307,23 @@ private Mono getAsync(String resourceId, String complianc @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceId, String complianceResultName, Context context) { - return getWithResponseAsync(resourceId, complianceResultName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (complianceResultName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter complianceResultName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, resourceId, complianceResultName, accept, + context); } /** @@ -344,6 +367,33 @@ private Mono> listNextSinglePageAsync(Strin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -352,22 +402,24 @@ 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 list of compliance results response along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of compliance results response along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ComplianceResultsClientImpl.class); } 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..701287705abd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterCompli") + public interface CompliancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/compliances") + @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("/{scope}/providers/Microsoft.Security/compliances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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("/{scope}/providers/Microsoft.Security/compliances/{complianceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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/{complianceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * The Compliance scores of the specific management group. + * + * @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 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 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 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 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 list of Compliance objects response along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return 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 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 objects response along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return 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 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 list of Compliance objects response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * The Compliance scores of the specific management group. + * + * @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 objects response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (complianceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter complianceName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, scope, complianceName, accept, context); + } + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(CompliancesClientImpl.class); +} 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..e66593bba785 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String scope, String complianceName, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, complianceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ComplianceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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/ConnectorSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorSettingImpl.java new file mode 100644 index 000000000000..d8e7f49b53cf --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorSettingImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import com.azure.resourcemanager.security.models.AuthenticationDetailsProperties; +import com.azure.resourcemanager.security.models.ConnectorSetting; +import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; + +public final class ConnectorSettingImpl + implements ConnectorSetting, ConnectorSetting.Definition, ConnectorSetting.Update { + private ConnectorSettingInner 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 HybridComputeSettingsProperties hybridComputeSettings() { + return this.innerModel().hybridComputeSettings(); + } + + public AuthenticationDetailsProperties authenticationDetails() { + return this.innerModel().authenticationDetails(); + } + + public ConnectorSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String connectorName; + + public ConnectorSetting create() { + this.innerObject = serviceManager.serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ConnectorSetting create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), context) + .getValue(); + return this; + } + + ConnectorSettingImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new ConnectorSettingInner(); + this.serviceManager = serviceManager; + this.connectorName = name; + } + + public ConnectorSettingImpl update() { + return this; + } + + public ConnectorSetting apply() { + this.innerObject = serviceManager.serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ConnectorSetting apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getConnectors() + .createOrUpdateWithResponse(connectorName, this.innerModel(), context) + .getValue(); + return this; + } + + ConnectorSettingImpl(ConnectorSettingInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.connectorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "connectors"); + } + + public ConnectorSetting refresh() { + this.innerObject + = serviceManager.serviceClient().getConnectors().getWithResponse(connectorName, Context.NONE).getValue(); + return this; + } + + public ConnectorSetting refresh(Context context) { + this.innerObject + = serviceManager.serviceClient().getConnectors().getWithResponse(connectorName, context).getValue(); + return this; + } + + public ConnectorSettingImpl withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings) { + this.innerModel().withHybridComputeSettings(hybridComputeSettings); + return this; + } + + public ConnectorSettingImpl withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails) { + this.innerModel().withAuthenticationDetails(authenticationDetails); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java new file mode 100644 index 000000000000..7d000d619d8c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java @@ -0,0 +1,655 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ConnectorsClient; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import com.azure.resourcemanager.security.models.ConnectorSettingList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ConnectorsClient. + */ +public final class ConnectorsClientImpl implements ConnectorsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ConnectorsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConnectorsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(ConnectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterConnectors to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterConnec") + public interface ConnectorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors") + @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/connectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/connectors/{connectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, + @BodyParam("application/json") ConnectorSettingInner connectorSetting, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, + @BodyParam("application/json") ConnectorSettingInner connectorSetting, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("connectorName") String connectorName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("connectorName") String connectorName, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Cloud accounts connectors 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 for a subscription, list of all cloud account connectors and their settings 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-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())); + } + + /** + * Cloud accounts connectors 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 for a subscription, list of all cloud account connectors and their settings as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Cloud accounts connectors 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 for a subscription, list of all cloud account connectors and their settings along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Cloud accounts connectors 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 for a subscription, list of all cloud account connectors and their settings along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Cloud accounts connectors 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 for a subscription, list of all cloud account connectors and their settings as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Cloud accounts connectors 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 for a subscription, list of all cloud account connectors and their settings as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String connectorName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + connectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String connectorName) { + return getWithResponseAsync(connectorName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String connectorName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), connectorName, + accept, context); + } + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorSettingInner get(String connectorName) { + return getWithResponse(connectorName, Context.NONE).getValue(); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String connectorName, + ConnectorSettingInner connectorSetting) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (connectorSetting == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectorSetting is required and cannot be null.")); + } else { + connectorSetting.validate(); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), connectorName, connectorSetting, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String connectorName, + ConnectorSettingInner connectorSetting) { + return createOrUpdateWithResponseAsync(connectorName, connectorSetting) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String connectorName, + ConnectorSettingInner connectorSetting, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (connectorSetting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter connectorSetting is required and cannot be null.")); + } else { + connectorSetting.validate(); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + connectorName, connectorSetting, accept, context); + } + + /** + * Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either + * account credentials or role-based authentication. For GCP, use account organization credentials. + * + * @param connectorName Name of the cloud account connector. + * @param connectorSetting Settings for the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorSettingInner createOrUpdate(String connectorName, ConnectorSettingInner connectorSetting) { + return createOrUpdateWithResponse(connectorName, connectorSetting, Context.NONE).getValue(); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 connectorName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), connectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 connectorName) { + return deleteWithResponseAsync(connectorName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 connectorName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (connectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), connectorName, + accept, context); + } + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 connectorName) { + deleteWithResponse(connectorName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return for a subscription, list of all cloud account connectors and their settings along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectorsClientImpl.class); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java new file mode 100644 index 000000000000..b0fc9d20799e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ConnectorsClient; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import com.azure.resourcemanager.security.models.ConnectorSetting; +import com.azure.resourcemanager.security.models.Connectors; + +public final class ConnectorsImpl implements Connectors { + private static final ClientLogger LOGGER = new ClientLogger(ConnectorsImpl.class); + + private final ConnectorsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ConnectorsImpl(ConnectorsClient 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 ConnectorSettingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ConnectorSettingImpl(inner1, this.manager())); + } + + public Response getWithResponse(String connectorName, Context context) { + Response inner = this.serviceClient().getWithResponse(connectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ConnectorSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ConnectorSetting get(String connectorName) { + ConnectorSettingInner inner = this.serviceClient().get(connectorName); + if (inner != null) { + return new ConnectorSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String connectorName, Context context) { + return this.serviceClient().deleteWithResponse(connectorName, context); + } + + public void delete(String connectorName) { + this.serviceClient().delete(connectorName); + } + + public ConnectorSetting getById(String id) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.getWithResponse(connectorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.getWithResponse(connectorName, context); + } + + public void deleteById(String id) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + this.deleteWithResponse(connectorName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.deleteWithResponse(connectorName, context); + } + + private ConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public ConnectorSettingImpl define(String name) { + return new ConnectorSettingImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationImpl.java new file mode 100644 index 000000000000..0b3887a29ac0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationInner; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomation; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomationRequest; +import com.azure.resourcemanager.security.models.SeverityEnum; +import com.azure.resourcemanager.security.models.SupportedCloudEnum; + +public final class CustomAssessmentAutomationImpl + implements CustomAssessmentAutomation, CustomAssessmentAutomation.Definition { + private CustomAssessmentAutomationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + CustomAssessmentAutomationImpl(CustomAssessmentAutomationInner 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 compressedQuery() { + return this.innerModel().compressedQuery(); + } + + public SupportedCloudEnum supportedCloud() { + return this.innerModel().supportedCloud(); + } + + public SeverityEnum severity() { + return this.innerModel().severity(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String remediationDescription() { + return this.innerModel().remediationDescription(); + } + + public String assessmentKey() { + return this.innerModel().assessmentKey(); + } + + public CustomAssessmentAutomationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String customAssessmentAutomationName; + + private CustomAssessmentAutomationRequest createCustomAssessmentAutomationBody; + + public CustomAssessmentAutomationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CustomAssessmentAutomation create() { + this.innerObject = serviceManager.serviceClient() + .getCustomAssessmentAutomations() + .createWithResponse(resourceGroupName, customAssessmentAutomationName, createCustomAssessmentAutomationBody, + Context.NONE) + .getValue(); + return this; + } + + public CustomAssessmentAutomation create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomAssessmentAutomations() + .createWithResponse(resourceGroupName, customAssessmentAutomationName, createCustomAssessmentAutomationBody, + context) + .getValue(); + return this; + } + + CustomAssessmentAutomationImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new CustomAssessmentAutomationInner(); + this.serviceManager = serviceManager; + this.customAssessmentAutomationName = name; + this.createCustomAssessmentAutomationBody = new CustomAssessmentAutomationRequest(); + } + + public CustomAssessmentAutomation refresh() { + this.innerObject = serviceManager.serviceClient() + .getCustomAssessmentAutomations() + .getByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, Context.NONE) + .getValue(); + return this; + } + + public CustomAssessmentAutomation refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomAssessmentAutomations() + .getByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, context) + .getValue(); + return this; + } + + public CustomAssessmentAutomationImpl withCompressedQuery(String compressedQuery) { + this.createCustomAssessmentAutomationBody.withCompressedQuery(compressedQuery); + return this; + } + + public CustomAssessmentAutomationImpl withSupportedCloud(SupportedCloudEnum supportedCloud) { + this.createCustomAssessmentAutomationBody.withSupportedCloud(supportedCloud); + return this; + } + + public CustomAssessmentAutomationImpl withSeverity(SeverityEnum severity) { + this.createCustomAssessmentAutomationBody.withSeverity(severity); + return this; + } + + public CustomAssessmentAutomationImpl withDisplayName(String displayName) { + this.createCustomAssessmentAutomationBody.withDisplayName(displayName); + return this; + } + + public CustomAssessmentAutomationImpl withDescription(String description) { + this.createCustomAssessmentAutomationBody.withDescription(description); + return this; + } + + public CustomAssessmentAutomationImpl withRemediationDescription(String remediationDescription) { + this.createCustomAssessmentAutomationBody.withRemediationDescription(remediationDescription); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsClientImpl.java new file mode 100644 index 000000000000..bdd74cce7000 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsClientImpl.java @@ -0,0 +1,1062 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.CustomAssessmentAutomationsClient; +import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationInner; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomationRequest; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomationsListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CustomAssessmentAutomationsClient. + */ +public final class CustomAssessmentAutomationsClientImpl implements CustomAssessmentAutomationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CustomAssessmentAutomationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of CustomAssessmentAutomationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomAssessmentAutomationsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(CustomAssessmentAutomationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterCustomAssessmentAutomations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterCustom") + public interface CustomAssessmentAutomationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customAssessmentAutomationName") String customAssessmentAutomationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customAssessmentAutomationName") String customAssessmentAutomationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customAssessmentAutomationName") String customAssessmentAutomationName, + @BodyParam("application/json") CustomAssessmentAutomationRequest customAssessmentAutomationBody, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customAssessmentAutomationName") String customAssessmentAutomationName, + @BodyParam("application/json") CustomAssessmentAutomationRequest customAssessmentAutomationBody, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customAssessmentAutomationName") String customAssessmentAutomationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customAssessmentAutomationName") String customAssessmentAutomationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations") + @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}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@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/customAssessmentAutomations") + @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/customAssessmentAutomations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") 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, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getByResourceGroupWithResponseAsync(String resourceGroupName, String customAssessmentAutomationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (customAssessmentAutomationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customAssessmentAutomationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, customAssessmentAutomationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String customAssessmentAutomationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, customAssessmentAutomationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String customAssessmentAutomationName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (customAssessmentAutomationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customAssessmentAutomationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, customAssessmentAutomationName, accept, context); + } + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomAssessmentAutomationInner getByResourceGroup(String resourceGroupName, + String customAssessmentAutomationName) { + return getByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, Context.NONE) + .getValue(); + } + + /** + * Creates a custom assessment automation + * + * Creates or updates a custom assessment automation for the provided subscription. Please note that providing an + * existing custom assessment automation will replace the existing record. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param customAssessmentAutomationBody Custom Assessment Automation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Assessment Automation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String customAssessmentAutomationName, CustomAssessmentAutomationRequest customAssessmentAutomationBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (customAssessmentAutomationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customAssessmentAutomationName is required and cannot be null.")); + } + if (customAssessmentAutomationBody == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customAssessmentAutomationBody is required and cannot be null.")); + } else { + customAssessmentAutomationBody.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.create(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, customAssessmentAutomationName, customAssessmentAutomationBody, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a custom assessment automation + * + * Creates or updates a custom assessment automation for the provided subscription. Please note that providing an + * existing custom assessment automation will replace the existing record. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param customAssessmentAutomationBody Custom Assessment Automation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Assessment Automation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, + String customAssessmentAutomationName, CustomAssessmentAutomationRequest customAssessmentAutomationBody) { + return createWithResponseAsync(resourceGroupName, customAssessmentAutomationName, + customAssessmentAutomationBody).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a custom assessment automation + * + * Creates or updates a custom assessment automation for the provided subscription. Please note that providing an + * existing custom assessment automation will replace the existing record. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param customAssessmentAutomationBody Custom Assessment Automation body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Assessment Automation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String customAssessmentAutomationName, CustomAssessmentAutomationRequest customAssessmentAutomationBody, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (customAssessmentAutomationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customAssessmentAutomationName is required and cannot be null.")); + } + if (customAssessmentAutomationBody == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customAssessmentAutomationBody is required and cannot be null.")); + } else { + customAssessmentAutomationBody.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, customAssessmentAutomationName, customAssessmentAutomationBody, accept, context); + } + + /** + * Creates a custom assessment automation + * + * Creates or updates a custom assessment automation for the provided subscription. Please note that providing an + * existing custom assessment automation will replace the existing record. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param customAssessmentAutomationBody Custom Assessment Automation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Assessment Automation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomAssessmentAutomationInner create(String resourceGroupName, String customAssessmentAutomationName, + CustomAssessmentAutomationRequest customAssessmentAutomationBody) { + return createWithResponse(resourceGroupName, customAssessmentAutomationName, customAssessmentAutomationBody, + Context.NONE).getValue(); + } + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 customAssessmentAutomationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (customAssessmentAutomationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customAssessmentAutomationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, customAssessmentAutomationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 customAssessmentAutomationName) { + return deleteWithResponseAsync(resourceGroupName, customAssessmentAutomationName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 customAssessmentAutomationName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (customAssessmentAutomationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customAssessmentAutomationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, customAssessmentAutomationName, accept, context); + } + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 customAssessmentAutomationName) { + deleteWithResponse(resourceGroupName, customAssessmentAutomationName, Context.NONE); + } + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and 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 a list of Custom Assessment Automations 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-07-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())); + } + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and 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 a list of Custom Assessment Automations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and 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 a list of Custom Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and resource group. + * + * @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 ManagementException thrown if 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 Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and 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 a list of Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and resource group. + * + * @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 ManagementException thrown if 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 Assessment Automations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, + Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations 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-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())); + } + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, 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 Custom Assessment Automations 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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 Custom Assessment Automations 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 Assessment Automations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(CustomAssessmentAutomationsClientImpl.class); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsImpl.java new file mode 100644 index 000000000000..0ccaf3e23862 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.CustomAssessmentAutomationsClient; +import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationInner; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomation; +import com.azure.resourcemanager.security.models.CustomAssessmentAutomations; + +public final class CustomAssessmentAutomationsImpl implements CustomAssessmentAutomations { + private static final ClientLogger LOGGER = new ClientLogger(CustomAssessmentAutomationsImpl.class); + + private final CustomAssessmentAutomationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public CustomAssessmentAutomationsImpl(CustomAssessmentAutomationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String customAssessmentAutomationName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CustomAssessmentAutomationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CustomAssessmentAutomation getByResourceGroup(String resourceGroupName, + String customAssessmentAutomationName) { + CustomAssessmentAutomationInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, customAssessmentAutomationName); + if (inner != null) { + return new CustomAssessmentAutomationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, + String customAssessmentAutomationName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, customAssessmentAutomationName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String customAssessmentAutomationName) { + this.serviceClient().delete(resourceGroupName, customAssessmentAutomationName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomAssessmentAutomationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomAssessmentAutomationImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomAssessmentAutomationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomAssessmentAutomationImpl(inner1, this.manager())); + } + + public CustomAssessmentAutomation 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 customAssessmentAutomationName + = ResourceManagerUtils.getValueFromIdByName(id, "customAssessmentAutomations"); + if (customAssessmentAutomationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'customAssessmentAutomations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, 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 customAssessmentAutomationName + = ResourceManagerUtils.getValueFromIdByName(id, "customAssessmentAutomations"); + if (customAssessmentAutomationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'customAssessmentAutomations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, 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 customAssessmentAutomationName + = ResourceManagerUtils.getValueFromIdByName(id, "customAssessmentAutomations"); + if (customAssessmentAutomationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'customAssessmentAutomations'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, 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 customAssessmentAutomationName + = ResourceManagerUtils.getValueFromIdByName(id, "customAssessmentAutomations"); + if (customAssessmentAutomationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'customAssessmentAutomations'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, customAssessmentAutomationName, context); + } + + private CustomAssessmentAutomationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public CustomAssessmentAutomationImpl define(String name) { + return new CustomAssessmentAutomationImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentImpl.java new file mode 100644 index 000000000000..f2249d1a838a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentImpl.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentInner; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignment; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignmentRequest; + +public final class CustomEntityStoreAssignmentImpl + implements CustomEntityStoreAssignment, CustomEntityStoreAssignment.Definition { + private CustomEntityStoreAssignmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + CustomEntityStoreAssignmentImpl(CustomEntityStoreAssignmentInner 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 principal() { + return this.innerModel().principal(); + } + + public String entityStoreDatabaseLink() { + return this.innerModel().entityStoreDatabaseLink(); + } + + public CustomEntityStoreAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String customEntityStoreAssignmentName; + + private CustomEntityStoreAssignmentRequest createCustomEntityStoreAssignmentRequestBody; + + public CustomEntityStoreAssignmentImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CustomEntityStoreAssignment create() { + this.innerObject = serviceManager.serviceClient() + .getCustomEntityStoreAssignments() + .createWithResponse(resourceGroupName, customEntityStoreAssignmentName, + createCustomEntityStoreAssignmentRequestBody, Context.NONE) + .getValue(); + return this; + } + + public CustomEntityStoreAssignment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomEntityStoreAssignments() + .createWithResponse(resourceGroupName, customEntityStoreAssignmentName, + createCustomEntityStoreAssignmentRequestBody, context) + .getValue(); + return this; + } + + CustomEntityStoreAssignmentImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new CustomEntityStoreAssignmentInner(); + this.serviceManager = serviceManager; + this.customEntityStoreAssignmentName = name; + this.createCustomEntityStoreAssignmentRequestBody = new CustomEntityStoreAssignmentRequest(); + } + + public CustomEntityStoreAssignment refresh() { + this.innerObject = serviceManager.serviceClient() + .getCustomEntityStoreAssignments() + .getByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, Context.NONE) + .getValue(); + return this; + } + + public CustomEntityStoreAssignment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomEntityStoreAssignments() + .getByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, context) + .getValue(); + return this; + } + + public CustomEntityStoreAssignmentImpl withPrincipal(String principal) { + this.createCustomEntityStoreAssignmentRequestBody.withPrincipal(principal); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsClientImpl.java new file mode 100644 index 000000000000..21215c156e5a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsClientImpl.java @@ -0,0 +1,1062 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.CustomEntityStoreAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentInner; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignmentRequest; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignmentsListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CustomEntityStoreAssignmentsClient. + */ +public final class CustomEntityStoreAssignmentsClientImpl implements CustomEntityStoreAssignmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CustomEntityStoreAssignmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of CustomEntityStoreAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomEntityStoreAssignmentsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(CustomEntityStoreAssignmentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterCustomEntityStoreAssignments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterCustom") + public interface CustomEntityStoreAssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customEntityStoreAssignmentName") String customEntityStoreAssignmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customEntityStoreAssignmentName") String customEntityStoreAssignmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customEntityStoreAssignmentName") String customEntityStoreAssignmentName, + @BodyParam("application/json") CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customEntityStoreAssignmentName") String customEntityStoreAssignmentName, + @BodyParam("application/json") CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customEntityStoreAssignmentName") String customEntityStoreAssignmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customEntityStoreAssignmentName") String customEntityStoreAssignmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments") + @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}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@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/customEntityStoreAssignments") + @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/customEntityStoreAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") 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, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getByResourceGroupWithResponseAsync(String resourceGroupName, String customEntityStoreAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (customEntityStoreAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, customEntityStoreAssignmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String customEntityStoreAssignmentName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, customEntityStoreAssignmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String customEntityStoreAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (customEntityStoreAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, customEntityStoreAssignmentName, accept, context); + } + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomEntityStoreAssignmentInner getByResourceGroup(String resourceGroupName, + String customEntityStoreAssignmentName) { + return getByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, Context.NONE) + .getValue(); + } + + /** + * Creates a custom entity store assignment + * + * Creates a custom entity store assignment for the provided subscription, if not already exists. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is GUID. + * @param customEntityStoreAssignmentRequestBody Custom entity store assignment body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom entity store assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String customEntityStoreAssignmentName, + CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (customEntityStoreAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentName is required and cannot be null.")); + } + if (customEntityStoreAssignmentRequestBody == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentRequestBody is required and cannot be null.")); + } else { + customEntityStoreAssignmentRequestBody.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, customEntityStoreAssignmentName, + customEntityStoreAssignmentRequestBody, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a custom entity store assignment + * + * Creates a custom entity store assignment for the provided subscription, if not already exists. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is GUID. + * @param customEntityStoreAssignmentRequestBody Custom entity store assignment body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom entity store assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, + String customEntityStoreAssignmentName, + CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody) { + return createWithResponseAsync(resourceGroupName, customEntityStoreAssignmentName, + customEntityStoreAssignmentRequestBody).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a custom entity store assignment + * + * Creates a custom entity store assignment for the provided subscription, if not already exists. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is GUID. + * @param customEntityStoreAssignmentRequestBody Custom entity store assignment body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom entity store assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String customEntityStoreAssignmentName, + CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (customEntityStoreAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentName is required and cannot be null.")); + } + if (customEntityStoreAssignmentRequestBody == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentRequestBody is required and cannot be null.")); + } else { + customEntityStoreAssignmentRequestBody.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, customEntityStoreAssignmentName, customEntityStoreAssignmentRequestBody, accept, + context); + } + + /** + * Creates a custom entity store assignment + * + * Creates a custom entity store assignment for the provided subscription, if not already exists. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is GUID. + * @param customEntityStoreAssignmentRequestBody Custom entity store assignment body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom entity store assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomEntityStoreAssignmentInner create(String resourceGroupName, String customEntityStoreAssignmentName, + CustomEntityStoreAssignmentRequest customEntityStoreAssignmentRequestBody) { + return createWithResponse(resourceGroupName, customEntityStoreAssignmentName, + customEntityStoreAssignmentRequestBody, Context.NONE).getValue(); + } + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 resourceGroupName, + String customEntityStoreAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required 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 (customEntityStoreAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, customEntityStoreAssignmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 resourceGroupName, String customEntityStoreAssignmentName) { + return deleteWithResponseAsync(resourceGroupName, customEntityStoreAssignmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String customEntityStoreAssignmentName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (customEntityStoreAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter customEntityStoreAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, customEntityStoreAssignmentName, accept, context); + } + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 resourceGroupName, String customEntityStoreAssignmentName) { + deleteWithResponse(resourceGroupName, customEntityStoreAssignmentName, Context.NONE); + } + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and 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 a list of custom entity store assignments 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-07-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())); + } + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and 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 a list of custom entity store assignments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and 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 a list of custom entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and resource group. + * + * @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 ManagementException thrown if 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 entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and 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 a list of custom entity store assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and resource group. + * + * @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 ManagementException thrown if 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 entity store assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, + Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments 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-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())); + } + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, 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 custom entity store assignments 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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 custom entity store assignments 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 entity store assignments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(CustomEntityStoreAssignmentsClientImpl.class); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsImpl.java new file mode 100644 index 000000000000..5ac206c8eea7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.CustomEntityStoreAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentInner; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignment; +import com.azure.resourcemanager.security.models.CustomEntityStoreAssignments; + +public final class CustomEntityStoreAssignmentsImpl implements CustomEntityStoreAssignments { + private static final ClientLogger LOGGER = new ClientLogger(CustomEntityStoreAssignmentsImpl.class); + + private final CustomEntityStoreAssignmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public CustomEntityStoreAssignmentsImpl(CustomEntityStoreAssignmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String customEntityStoreAssignmentName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CustomEntityStoreAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CustomEntityStoreAssignment getByResourceGroup(String resourceGroupName, + String customEntityStoreAssignmentName) { + CustomEntityStoreAssignmentInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, customEntityStoreAssignmentName); + if (inner != null) { + return new CustomEntityStoreAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, + String customEntityStoreAssignmentName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, customEntityStoreAssignmentName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String customEntityStoreAssignmentName) { + this.serviceClient().delete(resourceGroupName, customEntityStoreAssignmentName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomEntityStoreAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomEntityStoreAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomEntityStoreAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new CustomEntityStoreAssignmentImpl(inner1, this.manager())); + } + + public CustomEntityStoreAssignment 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 customEntityStoreAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "customEntityStoreAssignments"); + if (customEntityStoreAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'customEntityStoreAssignments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, 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 customEntityStoreAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "customEntityStoreAssignments"); + if (customEntityStoreAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'customEntityStoreAssignments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, 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 customEntityStoreAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "customEntityStoreAssignments"); + if (customEntityStoreAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'customEntityStoreAssignments'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, 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 customEntityStoreAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "customEntityStoreAssignments"); + if (customEntityStoreAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'customEntityStoreAssignments'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, customEntityStoreAssignmentName, context); + } + + private CustomEntityStoreAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public CustomEntityStoreAssignmentImpl define(String name) { + return new CustomEntityStoreAssignmentImpl(name, this.manager()); + } +} 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..5429374cd766 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 @@ -28,6 +28,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.CustomRecommendationsClient; import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner; import com.azure.resourcemanager.security.models.CustomRecommendationsList; @@ -73,6 +74,14 @@ Mono> list(@HostParam("$host") String endpoi @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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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 }) @@ -82,6 +91,15 @@ Mono> get(@HostParam("$host") String endpoin @PathParam("customRecommendationName") String customRecommendationName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("customRecommendationName") String customRecommendationName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") @ExpectedResponses({ 200, 201 }) @@ -92,6 +110,16 @@ Mono> createOrUpdate(@HostParam("$host") Str @BodyParam("application/json") CustomRecommendationInner customRecommendationBody, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("customRecommendationName") String customRecommendationName, + @BodyParam("application/json") CustomRecommendationInner customRecommendationBody, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") @ExpectedResponses({ 200, 204 }) @@ -100,6 +128,14 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("scope") String scope, @PathParam("customRecommendationName") String customRecommendationName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("scope") String scope, @PathParam("customRecommendationName") String customRecommendationName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -107,6 +143,13 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -147,28 +190,14 @@ private Mono> listSinglePageAsync(Strin * '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}. + * @return a list of all relevant custom recommendations over a scope as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -181,11 +210,24 @@ private Mono> listSinglePageAsync(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 a list of all relevant custom recommendations over a scope as paginated response with {@link PagedFlux}. + * @return a list of all relevant custom recommendations over a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String scope) { - return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -199,12 +241,24 @@ private PagedFlux listAsync(String 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 list of all relevant custom recommendations over a scope as paginated response with {@link PagedFlux}. + * @return a list of all relevant custom recommendations over a scope along with {@link PagedResponse}. */ - @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) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -222,7 +276,7 @@ private PagedFlux listAsync(String scope, Context con */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope) { - return new PagedIterable<>(listAsync(scope)); + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); } /** @@ -241,7 +295,8 @@ public PagedIterable list(String scope) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope, Context context) { - return new PagedIterable<>(listAsync(scope, context)); + return new PagedIterable<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -280,41 +335,6 @@ private Mono> getWithResponseAsync(String sc .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get a specific custom recommendation for the requested scope by customRecommendationName. - * - * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: - * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * 'subscriptions/{subscriptionId}'), or security connector (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. - * @param customRecommendationName Name of the Custom Recommendation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a specific custom recommendation for the requested scope by customRecommendationName along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String scope, - String customRecommendationName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (scope == null) { - return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); - } - if (customRecommendationName == null) { - return Mono.error( - new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, accept, context); - } - /** * Get a specific custom recommendation for the requested scope by customRecommendationName. * @@ -352,7 +372,22 @@ private Mono getAsync(String scope, String customReco @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String scope, String customRecommendationName, Context context) { - return getWithResponseAsync(scope, customRecommendationName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, accept, context); } /** @@ -415,48 +450,6 @@ private Mono> createOrUpdateWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Creates or updates a custom recommendation over a given scope. - * - * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: - * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * 'subscriptions/{subscriptionId}'), or security connector (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. - * @param customRecommendationName Name of the Custom Recommendation. - * @param customRecommendationBody Custom Recommendation body. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return custom Recommendation along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String scope, - String customRecommendationName, CustomRecommendationInner customRecommendationBody, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (scope == null) { - return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); - } - if (customRecommendationName == null) { - return Mono.error( - new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); - } - if (customRecommendationBody == null) { - return Mono.error( - new IllegalArgumentException("Parameter customRecommendationBody is required and cannot be null.")); - } else { - customRecommendationBody.validate(); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, - customRecommendationBody, accept, context); - } - /** * Creates or updates a custom recommendation over a given scope. * @@ -496,8 +489,30 @@ private Mono createOrUpdateAsync(String scope, String @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String scope, String customRecommendationName, CustomRecommendationInner customRecommendationBody, Context context) { - return createOrUpdateWithResponseAsync(scope, customRecommendationName, customRecommendationBody, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + if (customRecommendationBody == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter customRecommendationBody is required and cannot be null.")); + } else { + customRecommendationBody.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, + customRecommendationBody, accept, context); } /** @@ -555,40 +570,6 @@ private Mono> deleteWithResponseAsync(String scope, String custom .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Delete a custom recommendation over a given scope. - * - * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: - * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * 'subscriptions/{subscriptionId}'), or security connector (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. - * @param customRecommendationName Name of the Custom Recommendation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String scope, String customRecommendationName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (scope == null) { - return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); - } - if (customRecommendationName == null) { - return Mono.error( - new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, accept, context); - } - /** * Delete a custom recommendation over a given scope. * @@ -623,7 +604,23 @@ private Mono deleteAsync(String scope, String customRecommendationName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String scope, String customRecommendationName, Context context) { - return deleteWithResponseAsync(scope, customRecommendationName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, accept, + context); } /** @@ -669,6 +666,33 @@ private Mono> listNextSinglePageAsync(S .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -677,22 +701,25 @@ 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 Custom Recommendations along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(CustomRecommendationsClientImpl.class); } 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..ed37e5bd8f86 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStorageSettingImpl.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.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.SettingNameAutoGenerated; + +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 DefenderForStorageSettingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceId; + + private SettingNameAutoGenerated 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(SettingNameAutoGenerated 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..8861ce60dbc4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesClientImpl.java @@ -0,0 +1,693 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.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.SettingNameAutoGenerated; +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("{$host}") + @ServiceInterface(name = "SecurityCenterDefend") + public interface DefenderForStoragesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, + @BodyParam("application/json") DefenderForStorageSettingInner defenderForStorageSetting, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, + @BodyParam("application/json") DefenderForStorageSettingInner defenderForStorageSetting, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/startMalwareScan") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> startMalwareScan(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/startMalwareScan") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response startMalwareScanSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}/cancelMalwareScan") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelMalwareScan(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, @PathParam("scanId") String scanId, + @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) + Response cancelMalwareScanSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, @PathParam("scanId") String scanId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMalwareScan(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated 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) + Response getMalwareScanSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingNameAutoGenerated settingName, @PathParam("scanId") String scanId, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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, + SettingNameAutoGenerated 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-01-01"; + 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 identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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, SettingNameAutoGenerated 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 identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage settings for the specified storage account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, + SettingNameAutoGenerated settingName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2025-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context); + } + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage settings for the specified storage account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DefenderForStorageSettingInner get(String resourceId, SettingNameAutoGenerated settingName) { + return getWithResponse(resourceId, settingName, Context.NONE).getValue(); + } + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName 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, + SettingNameAutoGenerated 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-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, + defenderForStorageSetting, accept, 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 identifier of the resource. + * @param settingName 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, SettingNameAutoGenerated 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 identifier of the resource. + * @param settingName 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, + SettingNameAutoGenerated settingName, DefenderForStorageSettingInner defenderForStorageSetting, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (defenderForStorageSetting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter defenderForStorageSetting is required and cannot be null.")); + } else { + defenderForStorageSetting.validate(); + } + final String apiVersion = "2025-01-01"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), apiVersion, resourceId, settingName, + defenderForStorageSetting, accept, context); + } + + /** + * Creates or updates the Defender for Storage settings on a specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName 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, SettingNameAutoGenerated settingName, + DefenderForStorageSettingInner defenderForStorageSetting) { + return createWithResponse(resourceId, settingName, defenderForStorageSetting, Context.NONE).getValue(); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startMalwareScanWithResponseAsync(String resourceId, + SettingNameAutoGenerated 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-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.startMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, + settingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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, SettingNameAutoGenerated settingName) { + return startMalwareScanWithResponseAsync(resourceId, settingName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startMalwareScanWithResponse(String resourceId, + SettingNameAutoGenerated settingName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2025-01-01"; + final String accept = "application/json"; + return service.startMalwareScanSync(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, + context); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MalwareScanInner startMalwareScan(String resourceId, SettingNameAutoGenerated settingName) { + return startMalwareScanWithResponse(resourceId, settingName, Context.NONE).getValue(); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelMalwareScanWithResponseAsync(String resourceId, + SettingNameAutoGenerated 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-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.cancelMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, + settingName, scanId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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, SettingNameAutoGenerated settingName, + String scanId) { + return cancelMalwareScanWithResponseAsync(resourceId, settingName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelMalwareScanWithResponse(String resourceId, + SettingNameAutoGenerated settingName, String scanId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (scanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + final String apiVersion = "2025-01-01"; + final String accept = "application/json"; + return service.cancelMalwareScanSync(this.client.getEndpoint(), apiVersion, resourceId, settingName, scanId, + accept, context); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MalwareScanInner cancelMalwareScan(String resourceId, SettingNameAutoGenerated settingName, String scanId) { + return cancelMalwareScanWithResponse(resourceId, settingName, scanId, Context.NONE).getValue(); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMalwareScanWithResponseAsync(String resourceId, + SettingNameAutoGenerated 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-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, + settingName, scanId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, SettingNameAutoGenerated settingName, + String scanId) { + return getMalwareScanWithResponseAsync(resourceId, settingName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMalwareScanWithResponse(String resourceId, + SettingNameAutoGenerated settingName, String scanId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (scanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + final String apiVersion = "2025-01-01"; + final String accept = "application/json"; + return service.getMalwareScanSync(this.client.getEndpoint(), apiVersion, resourceId, settingName, scanId, + accept, context); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MalwareScanInner getMalwareScan(String resourceId, SettingNameAutoGenerated settingName, String scanId) { + return getMalwareScanWithResponse(resourceId, settingName, scanId, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(DefenderForStoragesClientImpl.class); +} 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..74635b8edaa7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesImpl.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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.SettingNameAutoGenerated; + +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, SettingNameAutoGenerated settingName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceId, settingName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DefenderForStorageSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DefenderForStorageSetting get(String resourceId, SettingNameAutoGenerated settingName) { + DefenderForStorageSettingInner inner = this.serviceClient().get(resourceId, settingName); + if (inner != null) { + return new DefenderForStorageSettingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response startMalwareScanWithResponse(String resourceId, SettingNameAutoGenerated settingName, + Context context) { + Response inner + = this.serviceClient().startMalwareScanWithResponse(resourceId, settingName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MalwareScan startMalwareScan(String resourceId, SettingNameAutoGenerated 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, SettingNameAutoGenerated settingName, + String scanId, Context context) { + Response inner + = this.serviceClient().cancelMalwareScanWithResponse(resourceId, settingName, scanId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MalwareScan cancelMalwareScan(String resourceId, SettingNameAutoGenerated 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, SettingNameAutoGenerated settingName, + String scanId, Context context) { + Response inner + = this.serviceClient().getMalwareScanWithResponse(resourceId, settingName, scanId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MalwareScan getMalwareScan(String resourceId, SettingNameAutoGenerated 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))); + } + SettingNameAutoGenerated settingName = SettingNameAutoGenerated.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))); + } + SettingNameAutoGenerated settingName = SettingNameAutoGenerated.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(SettingNameAutoGenerated 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..9e56179ffc97 --- /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) AutoRest 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public DevOpsConfigurationProperties properties() { + return this.innerModel().properties(); + } + + 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..ee843c480a7a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsClientImpl.java @@ -0,0 +1,1266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +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.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("{$host}") + @ServiceInterface(name = "SecurityCenterDevOps") + public interface DevOpsConfigurationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DevOpsConfigurationInner devOpsConfiguration, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DevOpsConfigurationInner devOpsConfiguration, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DevOpsConfigurationInner devOpsConfiguration, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DevOpsConfigurationInner devOpsConfiguration, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, 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())); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String securityConnectorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String securityConnectorName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, apiVersion, accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePage(nextLink, 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, 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. + */ + @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, devOpsConfiguration, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (devOpsConfiguration == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, devOpsConfiguration, accept, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (devOpsConfiguration == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, devOpsConfiguration, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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) { + Response response + = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, devOpsConfiguration); + return this.client.getLroResult(response, + DevOpsConfigurationInner.class, DevOpsConfigurationInner.class, Context.NONE); + } + + /** + * 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) { + Response response + = createOrUpdateWithResponse(resourceGroupName, securityConnectorName, devOpsConfiguration, context); + return this.client.getLroResult(response, + 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, devOpsConfiguration).getFinalResult(); + } + + /** + * 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 beginCreateOrUpdate(resourceGroupName, securityConnectorName, devOpsConfiguration, context) + .getFinalResult(); + } + + /** + * 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, devOpsConfiguration, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (devOpsConfiguration == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, devOpsConfiguration, accept, Context.NONE); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String securityConnectorName, + DevOpsConfigurationInner devOpsConfiguration, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (devOpsConfiguration == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter devOpsConfiguration is required and cannot be null.")); + } else { + devOpsConfiguration.validate(); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, devOpsConfiguration, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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) { + Response response + = updateWithResponse(resourceGroupName, securityConnectorName, devOpsConfiguration); + return this.client.getLroResult(response, + DevOpsConfigurationInner.class, DevOpsConfigurationInner.class, Context.NONE); + } + + /** + * 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) { + Response response + = updateWithResponse(resourceGroupName, securityConnectorName, devOpsConfiguration, context); + return this.client.getLroResult(response, + 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 beginUpdate(resourceGroupName, securityConnectorName, devOpsConfiguration).getFinalResult(); + } + + /** + * 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 beginUpdate(resourceGroupName, securityConnectorName, devOpsConfiguration, context).getFinalResult(); + } + + /** + * 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String securityConnectorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, accept, Context.NONE); + } + + /** + * 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String securityConnectorName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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) { + Response response = deleteWithResponse(resourceGroupName, securityConnectorName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * 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) { + Response response = deleteWithResponse(resourceGroupName, securityConnectorName, context); + return this.client.getLroResult(response, 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + beginDelete(resourceGroupName, securityConnectorName).getFinalResult(); + } + + /** + * 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) { + beginDelete(resourceGroupName, securityConnectorName, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(DevOpsConfigurationsClientImpl.class); +} 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..60c918ba97bd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DevOpsConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + } + + 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..23cbe34e1631 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.core.util.logging.ClientLogger; +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("{$host}") + @ServiceInterface(name = "SecurityCenterDevOps") + 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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("operationResultId") String operationResultId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/operationResults/{operationResultId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("operationResultId") String operationResultId, @QueryParam("api-version") String apiVersion, + @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 operation result Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, operationResultId, apiVersion, 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 operation result Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops 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 operation result Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops long running operation result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String operationResultId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (operationResultId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter operationResultId is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, operationResultId, apiVersion, 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 operation result Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops 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(); + } + + private static final ClientLogger LOGGER = new ClientLogger(DevOpsOperationResultsClientImpl.class); +} 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..70ec0c19e8a9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperationStatusResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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/DeviceSecurityGroupsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java index 4d9dc359fb6a..58eef024b1d5 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 @@ -28,6 +28,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.DeviceSecurityGroupsClient; import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; import com.azure.resourcemanager.security.models.DeviceSecurityGroupList; @@ -74,6 +75,15 @@ Mono> list(@HostParam("$host") String endpoint @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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 }) @@ -84,6 +94,16 @@ Mono> get(@HostParam("$host") String endpoint @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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 }) @@ -95,6 +115,17 @@ Mono> createOrUpdate(@HostParam("$host") Stri @BodyParam("application/json") DeviceSecurityGroupInner deviceSecurityGroup, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Delete("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") @ExpectedResponses({ 200, 204 }) @@ -104,12 +135,28 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("deviceSecurityGroupName") String deviceSecurityGroupName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") 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" }) @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -143,27 +190,14 @@ private Mono> listSinglePageAsync(String * 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}. + * @return list of device security groups as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceId), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -173,11 +207,25 @@ private Mono> listSinglePageAsync(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 list of device security groups as paginated response with {@link PagedFlux}. + * @return list of device security groups along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceId) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceId), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceId) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, resourceId, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -188,12 +236,25 @@ private PagedFlux listAsync(String resourceId) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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}. + * @return list of device security groups along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceId, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceId, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, resourceId, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -207,7 +268,7 @@ private PagedFlux listAsync(String resourceId, Context */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceId) { - return new PagedIterable<>(listAsync(resourceId)); + return new PagedIterable<>(() -> listSinglePage(resourceId), nextLink -> listNextSinglePage(nextLink)); } /** @@ -222,7 +283,8 @@ public PagedIterable list(String resourceId) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceId, Context context) { - return new PagedIterable<>(listAsync(resourceId, context)); + return new PagedIterable<>(() -> listSinglePage(resourceId, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -258,38 +320,6 @@ private Mono> getWithResponseAsync(String res .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Use this method to get the device security group for the specified IoT Hub resource. - * - * @param resourceId The 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the device security group resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceId, - String deviceSecurityGroupName, 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 (deviceSecurityGroupName == null) { - return Mono.error( - 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.get(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept, context); - } - /** * Use this method to get the device security group for the specified IoT Hub resource. * @@ -322,7 +352,23 @@ private Mono getAsync(String resourceId, String device @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceId, String deviceSecurityGroupName, Context context) { - return getWithResponseAsync(resourceId, deviceSecurityGroupName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept, + context); } /** @@ -381,46 +427,6 @@ private Mono> createOrUpdateWithResponseAsync .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 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. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the device security group resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceId, - String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup, 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 (deviceSecurityGroupName == null) { - return Mono.error( - new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); - } - if (deviceSecurityGroup == null) { - return Mono - .error(new IllegalArgumentException("Parameter deviceSecurityGroup is required and cannot be null.")); - } else { - deviceSecurityGroup.validate(); - } - final String apiVersion = "2019-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, - deviceSecurityGroup, accept, context); - } - /** * Use this method to creates or updates the device security group on a specified IoT Hub resource. * @@ -456,8 +462,29 @@ private Mono createOrUpdateAsync(String resourceId, St @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceId, String deviceSecurityGroupName, DeviceSecurityGroupInner deviceSecurityGroup, Context context) { - return createOrUpdateWithResponseAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + if (deviceSecurityGroup == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter deviceSecurityGroup is required and cannot be null.")); + } else { + deviceSecurityGroup.validate(); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, + deviceSecurityGroup, accept, context); } /** @@ -511,39 +538,6 @@ private Mono> deleteWithResponseAsync(String resourceId, String d .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 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown 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 deviceSecurityGroupName, - 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 (deviceSecurityGroupName == null) { - return Mono.error( - 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); - } - /** * User this method to deletes the device security group. * @@ -574,7 +568,23 @@ private Mono deleteAsync(String resourceId, String deviceSecurityGroupName */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceId, String deviceSecurityGroupName, Context context) { - return deleteWithResponseAsync(resourceId, deviceSecurityGroupName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (deviceSecurityGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter deviceSecurityGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, resourceId, deviceSecurityGroupName, accept, + context); } /** @@ -617,6 +627,33 @@ private Mono> listNextSinglePageAsync(St .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -625,21 +662,25 @@ private Mono> listNextSinglePageAsync(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 list of device security groups along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of device security groups along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(DeviceSecurityGroupsClientImpl.class); } 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..0f55162dd870 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.DiscoveredSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; import com.azure.resourcemanager.security.models.DiscoveredSecuritySolutionList; @@ -70,6 +71,14 @@ Mono> list(@HostParam("$host") String e @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions") @ExpectedResponses({ 200 }) @@ -78,6 +87,14 @@ Mono> listByHomeRegion(@HostParam("$hos @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, @QueryParam("api-version") String apiVersion, @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) + Response listByHomeRegionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}") @ExpectedResponses({ 200 }) @@ -88,6 +105,16 @@ Mono> get(@HostParam("$host") String e @PathParam("discoveredSecuritySolutionName") String discoveredSecuritySolutionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -96,6 +123,14 @@ Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -103,6 +138,14 @@ Mono> listNext( Mono> listByHomeRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByHomeRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -136,29 +179,14 @@ private Mono> listSinglePageAsync /** * 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 list of discovered Security Solutions for the subscription along with {@link PagedResponse} 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> 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -166,12 +194,26 @@ private Mono> listSinglePageAsync * * @throws ManagementException thrown if 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 list of discovered Security Solutions for the subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -181,13 +223,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of discovered Security Solutions for the subscription as paginated response with - * {@link PagedFlux}. + * @return a list of discovered Security Solutions for the subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -200,7 +255,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -215,7 +270,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -257,35 +312,16 @@ private Mono> listByHomeRegionSin * * @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 a list of discovered Security Solutions for the subscription and location along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of discovered Security Solutions for the subscription and location as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionSinglePageAsync(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 = "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) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); } /** @@ -296,13 +332,31 @@ private Mono> listByHomeRegionSin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 and location as paginated response with - * {@link PagedFlux}. + * @return a list of discovered Security Solutions for the subscription and location along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -314,13 +368,32 @@ private PagedFlux listByHomeRegionAsync(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 a list of discovered Security Solutions for the subscription and location as paginated response with - * {@link PagedFlux}. + * @return a list of discovered Security Solutions for the subscription and location along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation, context), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -336,7 +409,8 @@ private PagedFlux listByHomeRegionAsync(String */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation), + nextLink -> listByHomeRegionNextSinglePage(nextLink)); } /** @@ -353,7 +427,8 @@ public PagedIterable listByHomeRegion(String as */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation, Context context) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePage(nextLink, context)); } /** @@ -400,50 +475,6 @@ private Mono> getWithResponseAsync(Str .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a specific discovered Security Solution. - * - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Gets a specific discovered Security Solution. * @@ -481,7 +512,33 @@ private Mono getAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String ascLocation, String discoveredSecuritySolutionName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, discoveredSecuritySolutionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (discoveredSecuritySolutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter discoveredSecuritySolutionName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, discoveredSecuritySolutionName, apiVersion, accept, context); } /** @@ -528,6 +585,33 @@ private Mono> listNextSinglePageA .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -536,23 +620,24 @@ 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 the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -581,6 +666,33 @@ private Mono> listByHomeRegionNex .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -589,22 +701,26 @@ 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 the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, + private PagedResponse listByHomeRegionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredSecuritySolutionsClientImpl.class); } 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..61a3d51fc4f8 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.ExternalSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; import com.azure.resourcemanager.security.models.ExternalSecuritySolutionList; @@ -70,6 +71,14 @@ Mono> list(@HostParam("$host") String end @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/externalSecuritySolutions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/locations/{ascLocation}/ExternalSecuritySolutions") @ExpectedResponses({ 200 }) @@ -78,6 +87,14 @@ Mono> listByHomeRegion(@HostParam("$host" @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, @QueryParam("api-version") String apiVersion, @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) + Response listByHomeRegionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}") @ExpectedResponses({ 200 }) @@ -88,6 +105,16 @@ Mono> get(@HostParam("$host") String end @PathParam("externalSecuritySolutionsName") String externalSecuritySolutionsName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -96,6 +123,14 @@ Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -103,6 +138,14 @@ Mono> listNext( Mono> listByHomeRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByHomeRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -136,29 +179,13 @@ private Mono> listSinglePageAsync() /** * 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 list of external security solutions for the subscription along with {@link PagedResponse} 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> 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -166,11 +193,26 @@ private Mono> listSinglePageAsync(C * * @throws ManagementException thrown if 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 list of external security solutions for the subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -180,12 +222,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of external security solutions for the subscription as paginated response with {@link PagedFlux}. + * @return a list of external security solutions for the subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -198,7 +254,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -213,7 +269,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -255,35 +311,16 @@ private Mono> listByHomeRegionSingl * * @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 a list of external Security Solutions for the subscription and location along with {@link PagedResponse} - * on successful completion of {@link Mono}. + * @return a list of external Security Solutions for the subscription and location as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionSinglePageAsync(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 = "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) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); } /** @@ -294,13 +331,30 @@ private Mono> listByHomeRegionSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 and location as paginated response with - * {@link PagedFlux}. + * @return a list of external Security Solutions for the subscription and location along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -312,13 +366,31 @@ private PagedFlux listByHomeRegionAsync(String as * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 and location as paginated response with - * {@link PagedFlux}. + * @return a list of external Security Solutions for the subscription and location along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation, context), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -334,7 +406,8 @@ private PagedFlux listByHomeRegionAsync(String as */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation), + nextLink -> listByHomeRegionNextSinglePage(nextLink)); } /** @@ -351,7 +424,8 @@ public PagedIterable listByHomeRegion(String ascL */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation, Context context) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePage(nextLink, context)); } /** @@ -398,50 +472,6 @@ private Mono> getWithResponseAsync(Strin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a specific external Security Solution. - * - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Gets a specific external Security Solution. * @@ -479,7 +509,33 @@ private Mono getAsync(String resourceGroupName, S @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String ascLocation, String externalSecuritySolutionsName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, externalSecuritySolutionsName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (externalSecuritySolutionsName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter externalSecuritySolutionsName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, externalSecuritySolutionsName, apiVersion, accept, context); } /** @@ -526,6 +582,33 @@ private Mono> listNextSinglePageAsy .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -534,23 +617,24 @@ 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 the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -579,6 +663,33 @@ private Mono> listByHomeRegionNextS .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -587,22 +698,26 @@ 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 the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, + private PagedResponse listByHomeRegionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ExternalSecuritySolutionsClientImpl.class); } 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..2536c4907c06 --- /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) AutoRest 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..15134d6c65c6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GetSensitivitySettingsResponseImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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/GitHubOwnerImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnerImpl.java new file mode 100644 index 000000000000..c8983ce0b00d --- /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) AutoRest 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitHubOwnerProperties properties() { + return this.innerModel().properties(); + } + + 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..6d727c5be259 --- /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) AutoRest 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..1cfa3d9c3c12 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersClientImpl.java @@ -0,0 +1,620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.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 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("{$host}") + @ServiceInterface(name = "SecurityCenterGitHub") + public interface GitHubOwnersService { + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @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) + Response listAvailableSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.listAvailableSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, 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. + */ + @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. + * + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, apiVersion, accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePage(nextLink, 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 GitHub owner 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, ownerName, apiVersion, 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 GitHub owner 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 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 GitHub owner 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 gitHub Owner resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (ownerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, apiVersion, 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 GitHub owner 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 gitHub Owner resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitHubOwnerInner get(String resourceGroupName, String securityConnectorName, String ownerName) { + return getWithResponse(resourceGroupName, securityConnectorName, ownerName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GitHubOwnersClientImpl.class); +} 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..8408b8f3bfec --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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 listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().listAvailableWithResponse(resourceGroupName, securityConnectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitHubOwnerListResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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 getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, ownerName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitHubOwnerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..ccd240db99a9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposClientImpl.java @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterGitHub") + public interface GitHubReposService { + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @PathParam("repoName") String repoName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, @PathParam("ownerName") String ownerName, + @PathParam("repoName") String repoName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context 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 GitHub owner 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, 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, ownerName, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of 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 GitHub owner 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, + 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 GitHub owner 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + String ownerName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (ownerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, apiVersion, accept, Context.NONE); + return 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 GitHub owner 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + String ownerName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (ownerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, apiVersion, accept, context); + return 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 GitHub owner 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, + String ownerName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, ownerName), + nextLink -> listNextSinglePage(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 GitHub owner 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, + String ownerName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, ownerName, context), + nextLink -> listNextSinglePage(nextLink, 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 GitHub owner name. + * @param repoName The repository 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, ownerName, repoName, apiVersion, 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 GitHub owner name. + * @param repoName The repository 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 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 GitHub owner name. + * @param repoName The repository 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 gitHub Repository resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (ownerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); + } + if (repoName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, ownerName, repoName, apiVersion, 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 GitHub owner name. + * @param repoName The repository 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 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GitHubReposClientImpl.class); +} 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..337d99f2269b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String ownerName, String repoName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, ownerName, repoName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitHubRepositoryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..7a7ea6f4781e --- /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) AutoRest 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitHubRepositoryProperties properties() { + return this.innerModel().properties(); + } + + 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..76325ed4607f --- /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) AutoRest 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitLabGroupProperties properties() { + return this.innerModel().properties(); + } + + 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..a5174724475e --- /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) AutoRest 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..0de326ea89b5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsClientImpl.java @@ -0,0 +1,623 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.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 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("{$host}") + @ServiceInterface(name = "SecurityCenterGitLab") + public interface GitLabGroupsService { + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @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) + Response listAvailableSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.listAvailableSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, 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. + */ + @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. + * + * @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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, apiVersion, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, apiVersion, accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePage(nextLink, 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 GitLab group fully-qualified 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, apiVersion, 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 GitLab group fully-qualified 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 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 GitLab group fully-qualified 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 gitLab Group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (groupFQName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, apiVersion, 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 GitLab group fully-qualified 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 gitLab Group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GitLabGroupInner get(String resourceGroupName, String securityConnectorName, String groupFQName) { + return getWithResponse(resourceGroupName, securityConnectorName, groupFQName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GitLabGroupsClientImpl.class); +} 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..d1480ba8ad7d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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 listAvailableWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().listAvailableWithResponse(resourceGroupName, securityConnectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabGroupListResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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 getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, groupFQName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..df5e3c2e83e6 --- /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) AutoRest 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public GitLabProjectProperties properties() { + return this.innerModel().properties(); + } + + 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..8f3c7e2b3f51 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsClientImpl.java @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterGitLab") + public interface GitLabProjectsService { + @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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @PathParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @PathParam("projectName") String projectName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context 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 GitLab group fully-qualified 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, 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 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 GitLab group fully-qualified 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 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 GitLab group fully-qualified 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 GitLab projects that are directly owned by given group and onboarded to the connector along + * with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + String groupFQName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (groupFQName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, apiVersion, accept, Context.NONE); + return 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 GitLab group fully-qualified 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 GitLab projects that are directly owned by given group and onboarded to the connector along + * with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + String groupFQName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (groupFQName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, apiVersion, accept, context); + return 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 GitLab group fully-qualified 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 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<>(() -> listSinglePage(resourceGroupName, securityConnectorName, groupFQName), + nextLink -> listNextSinglePage(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 GitLab group fully-qualified 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 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<>(() -> listSinglePage(resourceGroupName, securityConnectorName, groupFQName, context), + nextLink -> listNextSinglePage(nextLink, 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 GitLab group fully-qualified name. + * @param projectName The project 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, projectName, apiVersion, 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 GitLab group fully-qualified name. + * @param projectName The project 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 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 GitLab group fully-qualified name. + * @param projectName The project 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 gitLab Project resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, String projectName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (groupFQName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + if (projectName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, projectName, apiVersion, 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 GitLab group fully-qualified name. + * @param projectName The project 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 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GitLabProjectsClientImpl.class); +} 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..496f8da7e492 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String groupFQName, String projectName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, groupFQName, projectName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabProjectImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..842ce8a6e340 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.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.core.util.logging.ClientLogger; +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("{$host}") + @ServiceInterface(name = "SecurityCenterGitLab") + 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("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @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) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("groupFQName") String groupFQName, @QueryParam("api-version") String apiVersion, + @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 GitLab group fully-qualified 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 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, groupFQName, apiVersion, 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 GitLab group fully-qualified 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 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 GitLab group fully-qualified 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (groupFQName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); + } + final String apiVersion = "2025-03-01"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, groupFQName, apiVersion, 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 GitLab group fully-qualified 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 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(); + } + + private static final ClientLogger LOGGER = new ClientLogger(GitLabSubgroupsClientImpl.class); +} 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..b7df246c9ce3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GitLabGroupListResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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..0511fd355f7b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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..5871e4868c8e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsClientImpl.java @@ -0,0 +1,755 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterGovern") + public interface GovernanceAssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("assessmentName") String assessmentName, @PathParam("assignmentKey") String assignmentKey, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("assessmentName") String assessmentName, @PathParam("assignmentKey") String assignmentKey, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("assessmentName") String assessmentName, @PathParam("assignmentKey") String assignmentKey, + @BodyParam("application/json") GovernanceAssignmentInner governanceAssignment, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("assessmentName") String assessmentName, @PathParam("assignmentKey") String assignmentKey, + @BodyParam("application/json") GovernanceAssignmentInner governanceAssignment, + @HeaderParam("Accept") String accept, 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("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("scope") String scope, @PathParam("assessmentName") String assessmentName, + @PathParam("assignmentKey") String assignmentKey, 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) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("scope") String scope, @PathParam("assessmentName") String assessmentName, + @PathParam("assignmentKey") String assignmentKey, 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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the Governance assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 governance assignments on all of your resources inside a scope along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, String assessmentName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, Context.NONE); + return 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 governance assignments on all of your resources inside a scope along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, String assessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, context); + return 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 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<>(() -> listSinglePage(scope, assessmentName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get governance assignments on all of your resources inside a scope. + * + * @param scope The scope of the Governance assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A 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 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<>(() -> listSinglePage(scope, assessmentName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get a specific governanceAssignment for the requested scope by AssignmentKey. + * + * @param scope The scope of the Governance assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return service.getSync(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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required governance assignment. + * @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, assessmentName, + assignmentKey, governanceAssignment, accept, 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required governance assignment. + * @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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required governance assignment. + * @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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + if (governanceAssignment == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter governanceAssignment is required and cannot be null.")); + } else { + governanceAssignment.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, scope, assessmentName, assignmentKey, + governanceAssignment, accept, context); + } + + /** + * Creates or updates a governance assignment on the given subscription. + * + * @param scope The scope of the Governance assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required governance assignment. + * @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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 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 assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String scope, String assessmentName, String assignmentKey, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (assignmentKey == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assignmentKey is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, scope, assessmentName, assignmentKey, context); + } + + /** + * Delete a GovernanceAssignment over a given scope. + * + * @param scope The scope of the Governance assignments. Valid scopes are: subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param assessmentName The Assessment Key - A unique key for the assessment type. + * @param assignmentKey The governance assignment key - the assessment key of the required 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String assessmentName, String assignmentKey) { + deleteWithResponse(scope, assessmentName, assignmentKey, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a governance assignments list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 governance assignments list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 governance assignments list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GovernanceAssignmentsClientImpl.class); +} 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..54e9df9a52e2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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 Response getWithResponse(String scope, String assessmentName, String assignmentKey, + Context context) { + Response inner + = this.serviceClient().getWithResponse(scope, assessmentName, assignmentKey, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GovernanceAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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..e17130f23c34 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRuleImpl.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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..39e2cc8ff927 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesClientImpl.java @@ -0,0 +1,1274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +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.OperationResultAutoGeneratedInner; +import com.azure.resourcemanager.security.models.ExecuteGovernanceRuleParams; +import com.azure.resourcemanager.security.models.GovernanceRuleList; +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("{$host}") + @ServiceInterface(name = "SecurityCenterGovern") + public interface GovernanceRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/governanceRules") + @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/governanceRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/governanceRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, @BodyParam("application/json") GovernanceRuleInner governanceRule, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, @BodyParam("application/json") GovernanceRuleInner governanceRule, + @HeaderParam("Accept") String accept, 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("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, 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) + Response deleteSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, + @BodyParam("application/json") ExecuteGovernanceRuleParams executeGovernanceRuleParams, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/execute") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response executeSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, + @BodyParam("application/json") ExecuteGovernanceRuleParams executeGovernanceRuleParams, + @HeaderParam("Accept") String accept, 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("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("ruleId") String ruleId, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + GovernanceRulesOperationResultsResponse operationResultsSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") 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("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a list of all relevant governance rules over a scope. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 governance rules over a scope along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return 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 scope of the Governance rules. 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 governance rules over a scope along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return 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 scope of the Governance rules. 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 governance rules over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get a list of all relevant governance rules over a scope. + * + * @param scope The scope of the Governance rules. 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 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<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, scope, ruleId, accept, context); + } + + /** + * Get a specific governance rule for the requested scope by ruleId. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, ruleId, + governanceRule, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (governanceRule == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter governanceRule is required and cannot be null.")); + } else { + governanceRule.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, scope, ruleId, governanceRule, accept, + context); + } + + /** + * Creates or updates a governance rule over a given scope. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String scope, String ruleId) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, scope, ruleId, Context.NONE); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The scope of the Governance rules. 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 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String scope, String ruleId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, scope, ruleId, context); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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) { + Response response = deleteWithResponse(scope, ruleId); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The scope of the Governance rules. 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 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) { + Response response = deleteWithResponse(scope, ruleId, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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) { + beginDelete(scope, ruleId).getFinalResult(); + } + + /** + * Delete a Governance rule over a given scope. + * + * @param scope The scope of the Governance rules. 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 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) { + beginDelete(scope, ruleId, context).getFinalResult(); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.execute(this.client.getEndpoint(), apiVersion, scope, ruleId, + executeGovernanceRuleParams, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response executeWithResponse(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (executeGovernanceRuleParams != null) { + executeGovernanceRuleParams.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return service.executeSync(this.client.getEndpoint(), apiVersion, scope, ruleId, executeGovernanceRuleParams, + accept, Context.NONE); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response executeWithResponse(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (executeGovernanceRuleParams != null) { + executeGovernanceRuleParams.validate(); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return service.executeSync(this.client.getEndpoint(), apiVersion, scope, ruleId, executeGovernanceRuleParams, + accept, context); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExecute(String scope, String ruleId, + ExecuteGovernanceRuleParams executeGovernanceRuleParams) { + Response response = executeWithResponse(scope, ruleId, executeGovernanceRuleParams); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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; + Response response = executeWithResponse(scope, ruleId, executeGovernanceRuleParams); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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) { + Response response = executeWithResponse(scope, ruleId, executeGovernanceRuleParams, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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 scope of the Governance rules. 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 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 scope of the Governance rules. 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 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; + beginExecute(scope, ruleId, executeGovernanceRuleParams).getFinalResult(); + } + + /** + * Execute a governance rule. + * + * @param scope The scope of the Governance rules. 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 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) { + beginExecute(scope, ruleId, executeGovernanceRuleParams, context).getFinalResult(); + } + + /** + * Get governance rules long run operation result for the requested scope by ruleId and operationId. + * + * @param scope The scope of the Governance rules. 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 ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @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 rules. 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 ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @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 rules. 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 ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (operationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2022-01-01-preview"; + final String accept = "application/json"; + return service.operationResultsSync(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 rules. 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 ruleId The governance rule key - unique key for the standard governance rule (GUID). + * @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 OperationResultAutoGeneratedInner 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 page of a governance rules list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 governance rules list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 governance rules list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GovernanceRulesClientImpl.class); +} 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..d225d2c02b16 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.GovernanceRulesClient; +import com.azure.resourcemanager.security.fluent.models.GovernanceRuleInner; +import com.azure.resourcemanager.security.fluent.models.OperationResultAutoGeneratedInner; +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.OperationResultAutoGenerated; + +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 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 Response getWithResponse(String scope, String ruleId, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, ruleId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GovernanceRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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 OperationResultAutoGeneratedImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationResultAutoGenerated operationResults(String scope, String ruleId, String operationId) { + OperationResultAutoGeneratedInner inner = this.serviceClient().operationResults(scope, ruleId, operationId); + if (inner != null) { + return new OperationResultAutoGeneratedImpl(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..f238c398a50c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportImpl.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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.Issue; +import com.azure.resourcemanager.security.models.ResourceDetailsAutoGenerated; +import com.azure.resourcemanager.security.models.StatusAutoGenerated; +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 ResourceDetailsAutoGenerated resourceDetails() { + return this.innerModel().resourceDetails(); + } + + public EnvironmentDetails environmentDetails() { + return this.innerModel().environmentDetails(); + } + + public HealthDataClassification healthDataClassification() { + return this.innerModel().healthDataClassification(); + } + + public StatusAutoGenerated 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..323d8aafed85 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsClientImpl.java @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterHealth") + public interface HealthReportsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/healthReports") + @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("/{scope}/providers/Microsoft.Security/healthReports") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/healthReports/{healthReportName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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("/{resourceId}/providers/Microsoft.Security/healthReports/{healthReportName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context 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 scope at which the operation is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 scope at which the operation is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 scope at which the operation is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2023-05-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return 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 scope at which the operation is performed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2023-05-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return 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 scope at which the operation is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(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 scope at which the operation is performed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get health report of resource. + * + * @param resourceId The identifier of the resource. + * @param healthReportName The health report Key - Unique key for the health report 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 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 identifier of the resource. + * @param healthReportName The health report Key - Unique key for the health report 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 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 identifier of the resource. + * @param healthReportName The health report Key - Unique key for the health report 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 health report of resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, String healthReportName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (healthReportName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter healthReportName is required and cannot be null.")); + } + final String apiVersion = "2023-05-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, resourceId, healthReportName, accept, context); + } + + /** + * Get health report of resource. + * + * @param resourceId The identifier of the resource. + * @param healthReportName The health report Key - Unique key for the health report 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 health report of resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthReportInner get(String resourceId, String healthReportName) { + return getWithResponse(resourceId, healthReportName, 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 page of health reports list along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 health reports list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 health reports list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(HealthReportsClientImpl.class); +} 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..4fea8a3b2f19 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String resourceId, String healthReportName, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceId, healthReportName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HealthReportImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..902f2485611d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java @@ -0,0 +1,581 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterInform") + public interface InformationProtectionPoliciesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") InformationProtectionPolicyName informationProtectionPolicyName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") InformationProtectionPolicyName informationProtectionPolicyName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") InformationProtectionPolicyName informationProtectionPolicyName, + @BodyParam("application/json") InformationProtectionPolicyInner informationProtectionPolicy, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scope", encoded = true) String scope, + @PathParam("informationProtectionPolicyName") InformationProtectionPolicyName informationProtectionPolicyName, + @BodyParam("application/json") InformationProtectionPolicyInner informationProtectionPolicy, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/informationProtectionPolicies") + @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("/{scope}/providers/Microsoft.Security/informationProtectionPolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (informationProtectionPolicyName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, scope, informationProtectionPolicyName, accept, + context); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, + informationProtectionPolicyName, informationProtectionPolicy, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (informationProtectionPolicyName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter informationProtectionPolicyName is required and cannot be null.")); + } + if (informationProtectionPolicy == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter informationProtectionPolicy is required and cannot be null.")); + } else { + informationProtectionPolicy.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, scope, informationProtectionPolicyName, + informationProtectionPolicy, accept, context); + } + + /** + * Details of the information protection policy. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 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 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 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 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 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 information protection policies response along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return 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 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 information protection policies response along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return 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 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 information protection policies response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Information protection policies of a specific management group. + * + * @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 information protection policies response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(InformationProtectionPoliciesClientImpl.class); +} 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..a4e09b7273f7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new InformationProtectionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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..9605b4e41e59 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPolicyImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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/IotSecuritySolutionAnalyticsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsClientImpl.java index d7feb1c6f78a..318c194fa568 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 @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionAnalyticsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner; @@ -67,6 +68,15 @@ Mono> list(@HostParam("$hos @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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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") @ExpectedResponses({ 200 }) @@ -75,6 +85,15 @@ Mono> get(@HostParam("$host") S @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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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); } /** @@ -115,44 +134,6 @@ private Mono> listWithRespo .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(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.")); - } - 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 (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(), resourceGroupName, - solutionName, accept, context); - } - /** * Use this method to get IoT security Analytics metrics in an array. * @@ -184,7 +165,28 @@ private Mono listAsync(String resour @ServiceMethod(returns = ReturnType.SINGLE) public Response listWithResponse(String resourceGroupName, String solutionName, Context context) { - return listWithResponseAsync(resourceGroupName, solutionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, accept, context); } /** @@ -241,44 +243,6 @@ private Mono> getWithResponseAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(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.")); - } - 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 (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.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, - solutionName, accept, context); - } - /** * Use this method to get IoT Security Analytics metrics. * @@ -310,7 +274,28 @@ private Mono getAsync(String resourceGro @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String solutionName, Context context) { - return getWithResponseAsync(resourceGroupName, solutionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, accept, context); } /** @@ -328,4 +313,6 @@ public Response getWithResponse(String r public IoTSecuritySolutionAnalyticsModelInner get(String resourceGroupName, String solutionName) { return getWithResponse(resourceGroupName, solutionName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(IotSecuritySolutionAnalyticsClientImpl.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java index fa845b52ee65..dda79ee4114c 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 @@ -26,6 +26,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsAggregatedAlertsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedAlertInner; import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertList; @@ -74,6 +75,15 @@ Mono> list(@HostParam("$host") String e @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}") @ExpectedResponses({ 200 }) @@ -84,6 +94,16 @@ Mono> get(@HostParam("$host") String e @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}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss") @ExpectedResponses({ 200 }) @@ -94,6 +114,16 @@ Mono> dismiss(@HostParam("$host") String endpoint, @QueryParam("a @PathParam("aggregatedAlertName") String aggregatedAlertName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response dismissSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -101,6 +131,14 @@ Mono> dismiss(@HostParam("$host") String endpoint, @QueryParam("a Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -151,39 +189,16 @@ private Mono> listSinglePageAsync * 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 along with {@link PagedResponse} 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> 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.")); - } - 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 (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(), resourceGroupName, - solutionName, top, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String solutionName, + Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -192,15 +207,14 @@ private Mono> listSinglePageAsync * @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) { + private PagedFlux listAsync(String resourceGroupName, String solutionName) { + final Integer top = null; return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), nextLink -> listNextSinglePageAsync(nextLink)); } @@ -211,16 +225,39 @@ private PagedFlux listAsync(String resourceGrou * @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}. + * @return list of IoT Security solution aggregated alert data along with {@link PagedResponse}. */ - @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 PagedResponse listSinglePage(String resourceGroupName, String solutionName, + Integer top) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, solutionName, top, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -234,13 +271,35 @@ private PagedFlux listAsync(String resourceGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of IoT Security solution aggregated alert data along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String solutionName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String solutionName, Integer top, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, solutionName, top, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -257,7 +316,8 @@ private PagedFlux listAsync(String resourceGrou @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String solutionName) { final Integer top = null; - return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -276,7 +336,8 @@ public PagedIterable list(String resourceGroupN @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String solutionName, Integer top, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top, context)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, solutionName, top, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -323,50 +384,6 @@ private Mono> getWithResponseAsync(Str .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. - * - * @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. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is * performed by alert name. @@ -404,7 +421,32 @@ private Mono getAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { - return getWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedAlertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, aggregatedAlertName, accept, context); } /** @@ -468,48 +510,6 @@ private Mono> dismissWithResponseAsync(String resourceGroupName, .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 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 ManagementException thrown 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> dismissWithResponseAsync(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.")); - } - 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 (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.dismiss(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, aggregatedAlertName, accept, context); - } - /** * Use this method to dismiss an aggregated IoT Security Solution Alert. * @@ -544,7 +544,32 @@ private Mono dismissAsync(String resourceGroupName, String solutionName, S @ServiceMethod(returns = ReturnType.SINGLE) public Response dismissWithResponse(String resourceGroupName, String solutionName, String aggregatedAlertName, Context context) { - return dismissWithResponseAsync(resourceGroupName, solutionName, aggregatedAlertName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedAlertName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aggregatedAlertName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.dismissSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, aggregatedAlertName, accept, context); } /** @@ -589,6 +614,33 @@ private Mono> listNextSinglePageA .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -597,23 +649,26 @@ 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 IoT Security solution aggregated alert data along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return list of IoT Security solution aggregated alert data along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER + = new ClientLogger(IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.class); } 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..149000a8edaf 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsAnalyticsRecommendationsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; import com.azure.resourcemanager.security.models.IoTSecurityAggregatedRecommendationList; @@ -74,6 +75,16 @@ Mono> get(@HostParam("$host") @PathParam("aggregatedRecommendationName") String aggregatedRecommendationName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, + @PathParam("aggregatedRecommendationName") String aggregatedRecommendationName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations") @ExpectedResponses({ 200 }) @@ -83,6 +94,15 @@ Mono> list(@HostParam("$host") @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -90,6 +110,14 @@ Mono> list(@HostParam("$host") Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -136,50 +164,6 @@ private Mono> getWithResponse .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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 recommendation information along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String solutionName, String aggregatedRecommendationName, 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 (solutionName == null) { - return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); - } - if (aggregatedRecommendationName == null) { - return Mono.error( - new IllegalArgumentException("Parameter aggregatedRecommendationName 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, aggregatedRecommendationName, accept, context); - } - /** * Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This * aggregation is performed by recommendation name. @@ -217,7 +201,33 @@ private Mono getAsync(String resourceG @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String solutionName, String aggregatedRecommendationName, Context context) { - return getWithResponseAsync(resourceGroupName, solutionName, aggregatedRecommendationName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (aggregatedRecommendationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter aggregatedRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, aggregatedRecommendationName, accept, context); } /** @@ -288,39 +298,16 @@ private Mono> listSingle * 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 recommendations along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return list of IoT Security solution aggregated recommendations as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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(), resourceGroupName, - solutionName, top, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String solutionName, + Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -329,15 +316,15 @@ private Mono> listSingle * @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 recommendations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String solutionName, - Integer top) { + private PagedFlux listAsync(String resourceGroupName, + String solutionName) { + final Integer top = null; return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, solutionName, top), nextLink -> listNextSinglePageAsync(nextLink)); } @@ -348,17 +335,39 @@ private PagedFlux listAsync(String res * @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 recommendations as paginated response with {@link PagedFlux}. + * @return list of IoT Security solution aggregated recommendations along with {@link PagedResponse}. */ - @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 PagedResponse listSinglePage(String resourceGroupName, + String solutionName, Integer top) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, solutionName, top, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -372,13 +381,35 @@ private PagedFlux listAsync(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 recommendations as paginated response with {@link PagedFlux}. + * @return list of IoT Security solution aggregated recommendations along with {@link PagedResponse}. */ - @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) + private PagedResponse listSinglePage(String resourceGroupName, + String solutionName, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, solutionName, top, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -396,7 +427,8 @@ private PagedFlux listAsync(String res @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String solutionName) { final Integer top = null; - return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, solutionName, top), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -416,7 +448,8 @@ public PagedIterable list(String resou @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String solutionName, Integer top, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, solutionName, top, context)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, solutionName, top, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -446,6 +479,33 @@ private Mono> listNextSi .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 recommendations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -454,23 +514,27 @@ private Mono> listNextSi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 recommendations along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return list of IoT Security solution aggregated recommendations along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER + = new ClientLogger(IotSecuritySolutionsAnalyticsRecommendationsClientImpl.class); } 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..a29bcdb9964a 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 @@ -29,6 +29,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.IotSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionModelInner; import com.azure.resourcemanager.security.models.IoTSecuritySolutionsList; @@ -75,6 +76,14 @@ Mono> list(@HostParam("$host") String endpoin @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}/providers/Microsoft.Security/iotSecuritySolutions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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 }) @@ -84,6 +93,15 @@ Mono> listByResourceGroup(@HostParam("$host") @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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@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 }) @@ -93,6 +111,15 @@ Mono> getByResourceGroup(@HostParam("$ho @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}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") 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 }) @@ -103,6 +130,16 @@ Mono> createOrUpdate(@HostParam("$host") @BodyParam("application/json") IoTSecuritySolutionModelInner iotSecuritySolutionData, @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) + Response createOrUpdateSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") @ExpectedResponses({ 200 }) @@ -113,6 +150,16 @@ Mono> update(@HostParam("$host") String @BodyParam("application/json") UpdateIotSecuritySolutionData updateIotSecuritySolutionData, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, + @BodyParam("application/json") UpdateIotSecuritySolutionData updateIotSecuritySolutionData, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") @ExpectedResponses({ 200, 204 }) @@ -122,6 +169,15 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("resourceGroupName") String resourceGroupName, @PathParam("solutionName") String solutionName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") 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("{nextLink}") @ExpectedResponses({ 200 }) @@ -130,6 +186,14 @@ Mono> listBySubscriptionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -137,6 +201,14 @@ Mono> listBySubscriptionNext( Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -172,42 +244,27 @@ private Mono> listSinglePageAsync(S * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of IoT Security solutions as paginated response with {@link PagedFlux}. */ - @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-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)); + @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. * - * @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 listAsync(String filter) { + private PagedFlux listAsync() { + final String filter = null; return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } @@ -215,15 +272,30 @@ private PagedFlux listAsync(String 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of IoT Security solutions along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - final String filter = null; - return new PagedFlux<>(() -> listSinglePageAsync(filter), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), filter, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -234,12 +306,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of IoT Security solutions as paginated response with {@link PagedFlux}. + * @return list of IoT Security solutions along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String filter, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(filter, context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), filter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -252,7 +338,8 @@ private PagedFlux listAsync(String filter, Contex @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final String filter = null; - return new PagedIterable<>(listAsync(filter)); + return new PagedIterable<>(() -> listSinglePage(filter), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -267,7 +354,8 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String filter, Context context) { - return new PagedIterable<>(listAsync(filter, context)); + return new PagedIterable<>(() -> listSinglePage(filter, context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -312,35 +400,15 @@ public PagedIterable list(String filter, Context * @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 ManagementException thrown 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 list of IoT Security solutions as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 = "2019-08-01"; - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -348,14 +416,14 @@ public PagedIterable list(String filter, Context * * @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) { + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } @@ -365,16 +433,35 @@ private PagedFlux listByResourceGroupAsync(String * * @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}. + * @return list of IoT Security solutions along with {@link PagedResponse}. */ - @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 PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, filter, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -387,13 +474,31 @@ private PagedFlux listByResourceGroupAsync(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 list of IoT Security solutions as paginated response with {@link PagedFlux}. + * @return list of IoT Security solutions along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter, - Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + String filter, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, filter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -409,7 +514,8 @@ private PagedFlux listByResourceGroupAsync(String @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { final String filter = null; - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -427,7 +533,8 @@ public PagedIterable listByResourceGroup(String r @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, filter, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -468,44 +575,6 @@ private Mono> getByResourceGroupWithResp .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. - * - * @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 context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, solutionName, accept, context); - } - /** * User this method to get details of a specific IoT Security solution based on solution name. * @@ -538,7 +607,28 @@ private Mono getByResourceGroupAsync(String resou @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse(String resourceGroupName, String solutionName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, solutionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, accept, context); } /** @@ -601,51 +691,6 @@ private Mono> createOrUpdateWithResponse .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Use this method to create or update yours IoT Security solution. * @@ -681,8 +726,34 @@ private Mono createOrUpdateAsync(String resourceG @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceGroupName, String solutionName, IoTSecuritySolutionModelInner iotSecuritySolutionData, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, solutionName, iotSecuritySolutionData, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (iotSecuritySolutionData == null) { + throw LOGGER.atError() + .log(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 service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, iotSecuritySolutionData, accept, context); } /** @@ -751,52 +822,6 @@ private Mono> updateWithResponseAsync(St .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. - * - * @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 context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Use this method to update existing IoT Security solution tags or user defined resources. To update other fields * use the CreateOrUpdate method. @@ -834,7 +859,35 @@ private Mono updateAsync(String resourceGroupName @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(String resourceGroupName, String solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Context context) { - return updateWithResponseAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + if (updateIotSecuritySolutionData == null) { + throw LOGGER.atError() + .log(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 service.updateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, updateIotSecuritySolutionData, accept, context); } /** @@ -893,43 +946,6 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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 the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Use this method to delete yours IoT Security solution. * @@ -960,7 +976,28 @@ private Mono deleteAsync(String resourceGroupName, String solutionName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceGroupName, String solutionName, Context context) { - return deleteWithResponseAsync(resourceGroupName, solutionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (solutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter solutionName is required and cannot be null.")); + } + final String apiVersion = "2019-08-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, solutionName, accept, context); } /** @@ -1005,6 +1042,33 @@ private Mono> listBySubscriptionNex .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1013,23 +1077,25 @@ private Mono> listBySubscriptionNex * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of IoT Security solutions along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1059,6 +1125,33 @@ private Mono> listByResourceGroupNe .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1067,22 +1160,26 @@ private Mono> listByResourceGroupNe * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 list of IoT Security solutions along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(IotSecuritySolutionsClientImpl.class); } 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..9d0b7382556b 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 @@ -29,6 +29,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.JitNetworkAccessPoliciesClient; import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner; import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner; @@ -76,6 +77,14 @@ Mono> list(@HostParam("$host") String end @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies") @ExpectedResponses({ 200 }) @@ -84,6 +93,14 @@ Mono> listByRegion(@HostParam("$host") St @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByRegionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies") @ExpectedResponses({ 200 }) @@ -93,6 +110,15 @@ Mono> listByResourceGroup(@HostParam("$ho @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies") @ExpectedResponses({ 200 }) @@ -102,6 +128,15 @@ Mono> listByResourceGroupAndRegion(@HostP @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupAndRegionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") @ExpectedResponses({ 200 }) @@ -112,6 +147,16 @@ Mono> get(@HostParam("$host") String endpo @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") @ExpectedResponses({ 200 }) @@ -124,6 +169,18 @@ Mono> createOrUpdate(@HostParam("$host") S @BodyParam("application/json") JitNetworkAccessPolicyInner body, @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 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@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, + @BodyParam("application/json") JitNetworkAccessPolicyInner body, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") @ExpectedResponses({ 200, 204 }) @@ -134,6 +191,16 @@ Mono> delete(@HostParam("$host") String endpoint, @PathParam("jitNetworkAccessPolicyName") String jitNetworkAccessPolicyName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@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); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}") @ExpectedResponses({ 202 }) @@ -147,6 +214,19 @@ Mono> initiate(@HostParam("$host") String @BodyParam("application/json") JitNetworkAccessPolicyInitiateRequest body, @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 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response initiateSync(@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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -155,6 +235,14 @@ Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -163,6 +251,14 @@ Mono> listByRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -171,6 +267,14 @@ Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -178,6 +282,14 @@ Mono> listByResourceGroupNext( Mono> listByResourceGroupAndRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupAndRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -210,28 +322,13 @@ private Mono> listSinglePageAsync() { /** * 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 response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -239,11 +336,26 @@ private Mono> listSinglePageAsync(Con * * @throws ManagementException 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 the response body along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -253,12 +365,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. + * @return the response body along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -270,7 +396,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -284,7 +410,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -325,34 +451,15 @@ private Mono> listByRegionSinglePageA * * @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 response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 = "2020-01-01"; - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listByRegionSinglePageAsync(ascLocation), + nextLink -> listByRegionNextSinglePageAsync(nextLink)); } /** @@ -363,12 +470,30 @@ private Mono> listByRegionSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 the response body along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listByRegionSinglePageAsync(ascLocation), - nextLink -> listByRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByRegionSinglePage(String ascLocation) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -380,12 +505,30 @@ private PagedFlux listByRegionAsync(String ascLocat * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 the response body along with {@link PagedResponse}. */ - @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) + private PagedResponse listByRegionSinglePage(String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -400,7 +543,8 @@ private PagedFlux listByRegionAsync(String ascLocat */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByRegion(String ascLocation) { - return new PagedIterable<>(listByRegionAsync(ascLocation)); + return new PagedIterable<>(() -> listByRegionSinglePage(ascLocation), + nextLink -> listByRegionNextSinglePage(nextLink)); } /** @@ -416,7 +560,8 @@ public PagedIterable listByRegion(String ascLocatio */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByRegion(String ascLocation, Context context) { - return new PagedIterable<>(listByRegionAsync(ascLocation, context)); + return new PagedIterable<>(() -> listByRegionSinglePage(ascLocation, context), + nextLink -> listByRegionNextSinglePage(nextLink, context)); } /** @@ -459,35 +604,15 @@ public PagedIterable listByRegion(String ascLocatio * * @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 ManagementException 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 paginated response with {@link PagedFlux}. */ - @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 = "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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -498,12 +623,30 @@ public PagedIterable listByRegion(String ascLocatio * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 the response body along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -515,12 +658,31 @@ private PagedFlux listByResourceGroupAsync(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 the response body along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -535,7 +697,8 @@ private PagedFlux listByResourceGroupAsync(String r */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -551,7 +714,8 @@ public PagedIterable listByResourceGroup(String res */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -601,38 +765,16 @@ public PagedIterable listByResourceGroup(String res * 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 response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupAndRegionSinglePageAsync(String resourceGroupName, 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 (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 = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroupAndRegion(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - ascLocation, apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAndRegionAsync(String resourceGroupName, + String ascLocation) { + return new PagedFlux<>(() -> listByResourceGroupAndRegionSinglePageAsync(resourceGroupName, ascLocation), + nextLink -> listByResourceGroupAndRegionNextSinglePageAsync(nextLink)); } /** @@ -645,13 +787,35 @@ public PagedIterable listByResourceGroup(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 the response body along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAndRegionAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupAndRegionSinglePage(String resourceGroupName, String ascLocation) { - return new PagedFlux<>(() -> listByResourceGroupAndRegionSinglePageAsync(resourceGroupName, ascLocation), - nextLink -> listByResourceGroupAndRegionNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupAndRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, ascLocation, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -665,14 +829,35 @@ private PagedFlux listByResourceGroupAndRegionAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 the response body along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAndRegionAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupAndRegionSinglePage(String resourceGroupName, String ascLocation, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupAndRegionSinglePageAsync(resourceGroupName, ascLocation, context), - nextLink -> listByResourceGroupAndRegionNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByResourceGroupAndRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, ascLocation, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -690,7 +875,8 @@ private PagedFlux listByResourceGroupAndRegionAsync @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroupAndRegion(String resourceGroupName, String ascLocation) { - return new PagedIterable<>(listByResourceGroupAndRegionAsync(resourceGroupName, ascLocation)); + return new PagedIterable<>(() -> listByResourceGroupAndRegionSinglePage(resourceGroupName, ascLocation), + nextLink -> listByResourceGroupAndRegionNextSinglePage(nextLink)); } /** @@ -709,7 +895,9 @@ public PagedIterable listByResourceGroupAndRegion(S @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroupAndRegion(String resourceGroupName, String ascLocation, Context context) { - return new PagedIterable<>(listByResourceGroupAndRegionAsync(resourceGroupName, ascLocation, context)); + return new PagedIterable<>( + () -> listByResourceGroupAndRegionSinglePage(resourceGroupName, ascLocation, context), + nextLink -> listByResourceGroupAndRegionNextSinglePage(nextLink, context)); } /** @@ -755,49 +943,6 @@ private Mono> getWithResponseAsync(String .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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Policies for protecting resources using Just-in-Time access control for the subscription, location. * @@ -835,75 +980,52 @@ private Mono getAsync(String resourceGroupName, Str @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 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocation, - String jitNetworkAccessPolicyName) { - return getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE).getValue(); - } - - /** - * Create a policy 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 body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> 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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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(); + if (jitNetworkAccessPolicyName == null) { + throw LOGGER.atError() + .log(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.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, ascLocation, jitNetworkAccessPolicyName, apiVersion, body, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, jitNetworkAccessPolicyName, apiVersion, accept, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitNetworkAccessPolicyInner get(String resourceGroupName, String ascLocation, + String jitNetworkAccessPolicyName) { + return getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, Context.NONE).getValue(); } /** @@ -915,7 +1037,6 @@ private Mono> createOrUpdateWithResponseAs * 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. @@ -923,7 +1044,7 @@ private Mono> createOrUpdateWithResponseAs */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String ascLocation, String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInner body, Context context) { + 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.")); @@ -950,9 +1071,10 @@ private Mono> createOrUpdateWithResponseAs } final String apiVersion = "2020-01-01"; 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 FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, ascLocation, jitNetworkAccessPolicyName, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -994,8 +1116,38 @@ private Mono createOrUpdateAsync(String resourceGro @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(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, jitNetworkAccessPolicyName, apiVersion, body, accept, context); } /** @@ -1062,49 +1214,6 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown 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 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.")); - } - 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 (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); - } - /** * Delete a Just-in-Time access control policy. * @@ -1141,7 +1250,33 @@ private Mono deleteAsync(String resourceGroupName, String ascLocation, Str @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName, Context context) { - return deleteWithResponseAsync(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, jitNetworkAccessPolicyName, apiVersion, accept, context); } /** @@ -1212,58 +1347,6 @@ private Mono> initiateWithResponseAsync(S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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 Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Initiate a JIT access from a specific Just-in-Time policy configuration. * @@ -1303,8 +1386,40 @@ private Mono initiateAsync(String resourceGroupNam @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(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (jitNetworkAccessPolicyName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter jitNetworkAccessPolicyName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(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 service.initiateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, jitNetworkAccessPolicyName, jitNetworkAccessPolicyInitiateType, apiVersion, body, accept, + context); } /** @@ -1353,6 +1468,33 @@ private Mono> listNextSinglePageAsync .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1361,22 +1503,24 @@ private Mono> listNextSinglePageAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1405,6 +1549,33 @@ private Mono> listByRegionNextSingleP .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1413,23 +1584,24 @@ private Mono> listByRegionNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByRegionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByRegionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByRegionNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1459,6 +1631,33 @@ private Mono> listByResourceGroupNext .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1467,23 +1666,25 @@ private Mono> listByResourceGroupNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1513,6 +1714,33 @@ private Mono> listByResourceGroupNext .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupAndRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupAndRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1521,22 +1749,26 @@ private Mono> listByResourceGroupNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupAndRegionNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByResourceGroupAndRegionNextSinglePage(String nextLink, + Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(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)); + Response res + = service.listByResourceGroupAndRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(JitNetworkAccessPoliciesClientImpl.class); } 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..d3efdaf997a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterLocati") + public interface LocationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations") + @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/locations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/locations/{ascLocation}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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/{ascLocation}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context 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 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. + * + * @throws ManagementException thrown 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. + * + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AscLocationInner get(String ascLocation) { + return getWithResponse(ascLocation, 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(LocationsClientImpl.class); +} 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..cc476cfd3e1f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String ascLocation, Context context) { + Response inner = this.serviceClient().getWithResponse(ascLocation, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AscLocationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AscLocation get(String ascLocation) { + AscLocationInner inner = this.serviceClient().get(ascLocation); + if (inner != null) { + return new AscLocationImpl(inner, this.manager()); + } else { + return null; + } + } + + 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..4c5abf408977 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MalwareScanImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; +import com.azure.resourcemanager.security.models.MalwareScan; +import com.azure.resourcemanager.security.models.MalwareScanProperties; + +public final class MalwareScanImpl implements MalwareScan { + private MalwareScanInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + MalwareScanImpl(MalwareScanInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public MalwareScanProperties properties() { + return this.innerModel().properties(); + } + + public MalwareScanInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingDataImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingDataImpl.java new file mode 100644 index 000000000000..bc505796e77c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingDataImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..8b7a9a39cad1 --- /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) AutoRest 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..8ca526597410 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingsClientImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.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 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("{$host}") + @ServiceInterface(name = "SecurityCenterMdeOnb") + public interface MdeOnboardingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings") + @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/mdeOnboardings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/mdeOnboardings/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@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/mdeOnboardings/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context 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 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. + * + * @throws ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(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 service.listSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MdeOnboardingDataListInner list() { + return listWithResponse(Context.NONE).getValue(); + } + + /** + * 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. + * + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(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 service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MdeOnboardingDataInner get() { + return getWithResponse(Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(MdeOnboardingsClientImpl.class); +} 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..ad745ba5a6f9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MdeOnboardingsImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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 listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MdeOnboardingDataListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MdeOnboardingDataList list() { + MdeOnboardingDataListInner inner = this.serviceClient().list(); + if (inner != null) { + return new MdeOnboardingDataListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(Context context) { + Response inner = this.serviceClient().getWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MdeOnboardingDataImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MdeOnboardingData get() { + MdeOnboardingDataInner inner = this.serviceClient().get(); + if (inner != null) { + return new MdeOnboardingDataImpl(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..75c220f621c8 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.models.ActionType; +import com.azure.resourcemanager.security.models.Operation; +import com.azure.resourcemanager.security.models.OperationDisplay; +import com.azure.resourcemanager.security.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + 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 ActionType 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/OperationResultAutoGeneratedImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultAutoGeneratedImpl.java new file mode 100644 index 000000000000..bbeb3b70d2c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationResultAutoGeneratedImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.OperationResultAutoGeneratedInner; +import com.azure.resourcemanager.security.models.OperationResult; +import com.azure.resourcemanager.security.models.OperationResultAutoGenerated; + +public final class OperationResultAutoGeneratedImpl implements OperationResultAutoGenerated { + private OperationResultAutoGeneratedInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + OperationResultAutoGeneratedImpl(OperationResultAutoGeneratedInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OperationResult status() { + return this.innerModel().status(); + } + + public OperationResultAutoGeneratedInner 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/OperationStatusResultImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusResultImpl.java new file mode 100644 index 000000000000..a78430c5f026 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationStatusResultImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.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 Float 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 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/OperationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..419e4524329d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterOperat") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") 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 = "2024-10-01-preview"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + 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. + * + * @throws ManagementException thrown if 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. + * + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationsClientImpl.class); +} 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..b40714e8b3e8 --- /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) AutoRest 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/PricingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/PricingsClientImpl.java index bc2876b3ba79..83d1c6d387d6 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 @@ -24,6 +24,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.PricingsClient; import com.azure.resourcemanager.security.fluent.models.PricingInner; import com.azure.resourcemanager.security.fluent.models.PricingListInner; @@ -68,6 +69,14 @@ Mono> get(@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); + @Headers({ "Content-Type: application/json" }) + @Get("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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); + @Headers({ "Content-Type: application/json" }) @Put("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") @ExpectedResponses({ 200, 201 }) @@ -77,6 +86,15 @@ Mono> update(@HostParam("$host") String endpoint, @PathParam("pricingName") String pricingName, @BodyParam("application/json") PricingInner pricing, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Delete("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") @ExpectedResponses({ 200, 204 }) @@ -85,6 +103,14 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam(value = "scopeId", encoded = true) String scopeId, @PathParam("pricingName") String pricingName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@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); + @Headers({ "Content-Type: application/json" }) @Get("/{scopeId}/providers/Microsoft.Security/pricings") @ExpectedResponses({ 200 }) @@ -92,6 +118,14 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam(value = "scopeId", encoded = true) String scopeId, @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scopeId}/providers/Microsoft.Security/pricings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam(value = "scopeId", encoded = true) String scopeId, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); } /** @@ -129,40 +163,6 @@ private Mono> getWithResponseAsync(String scopeId, String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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 the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a - * subscription id) along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String scopeId, 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 (scopeId == null) { - return Mono.error(new IllegalArgumentException("Parameter scopeId 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 = "2024-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, scopeId, pricingName, accept, context); - } - /** * 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'. @@ -201,7 +201,22 @@ private Mono getAsync(String scopeId, String pricingName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String scopeId, String pricingName, Context context) { - return getWithResponseAsync(scopeId, pricingName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scopeId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scopeId is required and cannot be null.")); + } + if (pricingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + final String apiVersion = "2024-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, scopeId, pricingName, accept, context); } /** @@ -267,48 +282,6 @@ private Mono> updateWithResponseAsync(String scopeId, Str .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Updates a provided Microsoft Defender for Cloud pricing configuration in the scope. Valid scopes are: - * 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 pricingName name of the pricing configuration. - * @param pricing Pricing 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 microsoft Defender for Cloud is provided in two pricing tiers: free and standard along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String scopeId, String pricingName, - PricingInner pricing, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (scopeId == null) { - return Mono.error(new IllegalArgumentException("Parameter scopeId is required and cannot be null.")); - } - if (pricingName == null) { - return Mono.error(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); - } - if (pricing == null) { - return Mono.error(new IllegalArgumentException("Parameter pricing is required and cannot be null.")); - } else { - pricing.validate(); - } - final String apiVersion = "2024-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), apiVersion, scopeId, pricingName, pricing, accept, context); - } - /** * Updates a provided Microsoft Defender for Cloud pricing configuration in the scope. Valid scopes are: * subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and @@ -352,7 +325,29 @@ private Mono updateAsync(String scopeId, String pricingName, Prici @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(String scopeId, String pricingName, PricingInner pricing, Context context) { - return updateWithResponseAsync(scopeId, pricingName, pricing, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scopeId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scopeId is required and cannot be null.")); + } + if (pricingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (pricing == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricing is required and cannot be null.")); + } else { + pricing.validate(); + } + final String apiVersion = "2024-01-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), apiVersion, scopeId, pricingName, pricing, accept, + context); } /** @@ -408,37 +403,6 @@ private Mono> deleteWithResponseAsync(String scopeId, String pric .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'). - * - * @param scopeId The identifier of the resource, (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}). - * @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 the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String scopeId, 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 (scopeId == null) { - return Mono.error(new IllegalArgumentException("Parameter scopeId 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 = "2024-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, scopeId, pricingName, accept, 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'). @@ -471,7 +435,22 @@ private Mono deleteAsync(String scopeId, String pricingName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String scopeId, String pricingName, Context context) { - return deleteWithResponseAsync(scopeId, pricingName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scopeId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scopeId is required and cannot be null.")); + } + if (pricingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + final String apiVersion = "2024-01-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, scopeId, pricingName, accept, context); } /** @@ -525,40 +504,6 @@ private Mono> listWithResponseAsync(String scopeId, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists Microsoft Defender for Cloud pricing configurations of the scopeId, that match the optional given $filter. - * Valid scopes are: subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and - * ARC Machines'). Valid $filter is: 'name in ({planName1},{planName2},...)'. If $filter is not provided, the - * 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 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 pricing configurations response along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String scopeId, 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 (scopeId == null) { - return Mono.error(new IllegalArgumentException("Parameter scopeId is required and cannot be null.")); - } - final String apiVersion = "2024-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, scopeId, filter, accept, context); - } - /** * Lists Microsoft Defender for Cloud pricing configurations of the scopeId, that match the optional given $filter. * Valid scopes are: subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and @@ -601,7 +546,18 @@ private Mono listAsync(String scopeId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response listWithResponse(String scopeId, String filter, Context context) { - return listWithResponseAsync(scopeId, filter, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scopeId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scopeId is required and cannot be null.")); + } + final String apiVersion = "2024-01-01"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), apiVersion, scopeId, filter, accept, context); } /** @@ -625,4 +581,6 @@ public PricingListInner list(String scopeId) { final String filter = null; return listWithResponse(scopeId, filter, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(PricingsClientImpl.class); } 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..8345f2183601 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..69a45fd7222c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java @@ -0,0 +1,540 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterRegula") + public interface RegulatoryComplianceAssessmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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/{regulatoryComplianceAssessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context 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. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, accept, context); + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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<>( + () -> listSinglePage(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter), + nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String filter, Context context) { + return new PagedIterable<>( + () -> listSinglePage(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, context), + nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + if (regulatoryComplianceAssessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceAssessmentInner get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName) { + return getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceAssessmentsClientImpl.class); +} 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..6148dd03e3a2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, String regulatoryComplianceAssessmentName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, + regulatoryComplianceAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RegulatoryComplianceAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..9c60baec0bd4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..0608c73688fd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterRegula") + public interface RegulatoryComplianceControlsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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/{regulatoryComplianceControlName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String regulatoryComplianceStandardName, + String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), regulatoryComplianceStandardName, filter, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String regulatoryComplianceStandardName, + String filter, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), regulatoryComplianceStandardName, filter, accept, context); + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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<>(() -> listSinglePage(regulatoryComplianceStandardName, filter), + nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String regulatoryComplianceStandardName, String filter, + Context context) { + return new PagedIterable<>(() -> listSinglePage(regulatoryComplianceStandardName, filter, context), + nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + if (regulatoryComplianceControlName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceControlName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceControlInner get(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName) { + return getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceControlsClientImpl.class); +} 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..253dcaf1bbf5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String regulatoryComplianceStandardName, + String regulatoryComplianceControlName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(regulatoryComplianceStandardName, regulatoryComplianceControlName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RegulatoryComplianceControlImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..ac80baff8529 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..e3a181223a73 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterRegula") + public interface RegulatoryComplianceStandardsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards") + @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}/providers/Microsoft.Security/regulatoryComplianceStandards") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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/{regulatoryComplianceStandardName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), filter, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), filter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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<>(() -> listSinglePage(filter), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(() -> listSinglePage(filter, context), + nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (regulatoryComplianceStandardName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter regulatoryComplianceStandardName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegulatoryComplianceStandardInner get(String regulatoryComplianceStandardName) { + return getWithResponse(regulatoryComplianceStandardName, 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(RegulatoryComplianceStandardsClientImpl.class); +} 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..b6a36939c29e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + public Response getWithResponse(String regulatoryComplianceStandardName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(regulatoryComplianceStandardName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RegulatoryComplianceStandardImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RegulatoryComplianceStandard get(String regulatoryComplianceStandardName) { + RegulatoryComplianceStandardInner inner = this.serviceClient().get(regulatoryComplianceStandardName); + if (inner != null) { + return new RegulatoryComplianceStandardImpl(inner, this.manager()); + } else { + return null; + } + } + + 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/ResourceProvidersClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..bf57ce177b15 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.security.fluent.models.ScenarioResponseInner; +import com.azure.resourcemanager.security.models.ParametersSchema; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** + * The proxy service used to perform REST calls. + */ + private final ResourceProvidersService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterResourceProviders to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterResour") + public interface ResourceProvidersService { + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Security/view") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> view(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") ParametersSchema parameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Security/view") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response viewSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") ParametersSchema parameters, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Fetch Microsoft Defender for Cloud data over a specified view. + * + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> viewWithResponseAsync(ParametersSchema parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2025-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.view(this.client.getEndpoint(), apiVersion, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fetch Microsoft Defender for Cloud data over a specified view. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono viewAsync() { + final ParametersSchema parameters = null; + return viewWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Fetch Microsoft Defender for Cloud data over a specified view. + * + * @param parameters Additional parameters supplied to the 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 query result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response viewWithResponse(ParametersSchema parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2025-05-01-preview"; + final String accept = "application/json"; + return service.viewSync(this.client.getEndpoint(), apiVersion, parameters, accept, context); + } + + /** + * Fetch Microsoft Defender for Cloud data over a specified view. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScenarioResponseInner view() { + final ParametersSchema parameters = null; + return viewWithResponse(parameters, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersClientImpl.class); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceProvidersImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..2d14aa2a9ef3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ResourceProvidersImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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.ResourceProvidersClient; +import com.azure.resourcemanager.security.fluent.models.ScenarioResponseInner; +import com.azure.resourcemanager.security.models.ParametersSchema; +import com.azure.resourcemanager.security.models.ResourceProviders; +import com.azure.resourcemanager.security.models.ScenarioResponse; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response viewWithResponse(ParametersSchema parameters, Context context) { + Response inner = this.serviceClient().viewWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScenarioResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScenarioResponse view() { + ScenarioResponseInner inner = this.serviceClient().view(); + if (inner != null) { + return new ScenarioResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient 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/RuleResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java new file mode 100644 index 000000000000..2fea217b5484 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RuleResultsImpl.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 RuleResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String ruleId; + + private String resourceId; + + private String createWorkspaceId; + + private RuleResultsInput createBody; + + private String updateWorkspaceId; + + private RuleResultsInput updateBody; + + public RuleResultsImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public RuleResults create() { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, createWorkspaceId, resourceId, createBody, Context.NONE) + .getValue(); + return this; + } + + public RuleResults create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, createWorkspaceId, resourceId, createBody, context) + .getValue(); + return this; + } + + RuleResultsImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new RuleResultsInner(); + this.serviceManager = serviceManager; + this.ruleId = name; + this.createWorkspaceId = null; + this.createBody = new RuleResultsInput(); + } + + public RuleResultsImpl update() { + this.updateWorkspaceId = null; + this.updateBody = new RuleResultsInput(); + return this; + } + + public RuleResults apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, updateWorkspaceId, resourceId, updateBody, Context.NONE) + .getValue(); + return this; + } + + public RuleResults apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlVulnerabilityAssessmentBaselineRules() + .createOrUpdateWithResponse(ruleId, updateWorkspaceId, resourceId, updateBody, context) + .getValue(); + return this; + } + + RuleResultsImpl(RuleResultsInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.ruleId = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "ruleId"); + this.resourceId = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}", + "resourceId"); + } + + 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 withWorkspaceId(String workspaceId) { + if (isInCreateMode()) { + this.createWorkspaceId = workspaceId; + return this; + } else { + this.updateWorkspaceId = workspaceId; + return this; + } + } + + private boolean isInCreateMode() { + return 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..6daf8a684865 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RulesResultsImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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/ScanImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanImpl.java new file mode 100644 index 000000000000..d9478f1ddc00 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.models.Scan; +import com.azure.resourcemanager.security.models.ScanProperties; + +public final class ScanImpl implements Scan { + private ScanInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScanImpl(ScanInner 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 ScanProperties properties() { + return this.innerModel().properties(); + } + + public ScanInner 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..cfda06c821fe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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/ScanResultsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultsImpl.java new file mode 100644 index 000000000000..b6497100bdfd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScanResultsImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; +import com.azure.resourcemanager.security.models.ScanResult; +import com.azure.resourcemanager.security.models.ScanResults; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ScanResultsImpl implements ScanResults { + private ScanResultsInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScanResultsImpl(ScanResultsInner 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 ScanResultImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ScanResultsInner 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/ScansImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScansImpl.java new file mode 100644 index 000000000000..8c61fe7739ea --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScansImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; +import com.azure.resourcemanager.security.models.Scan; +import com.azure.resourcemanager.security.models.Scans; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ScansImpl implements Scans { + private ScansInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScansImpl(ScansInner 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 ScanImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ScansInner 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/ScenarioResponseImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScenarioResponseImpl.java new file mode 100644 index 000000000000..5c6935b3b2c4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ScenarioResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.ScenarioResponseInner; +import com.azure.resourcemanager.security.models.ScenarioResponse; + +public final class ScenarioResponseImpl implements ScenarioResponse { + private ScenarioResponseInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + ScenarioResponseImpl(ScenarioResponseInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Object scenarioResult() { + return this.innerModel().scenarioResult(); + } + + public ScenarioResponseInner 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/SecureScoreControlDefinitionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java index 7428fdb884f3..2b1b1056a204 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecureScoreControlDefinitionsClient; import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDefinitionItemInner; import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionList; @@ -69,6 +70,13 @@ public interface SecureScoreControlDefinitionsService { Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/secureScoreControlDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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 }) @@ -77,6 +85,14 @@ Mono> listBySubscription(@HostParam(" @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/secureScoreControlDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@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("{nextLink}") @ExpectedResponses({ 200 }) @@ -85,6 +101,14 @@ Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -92,6 +116,14 @@ Mono> listNext( Mono> listBySubscriptionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -119,25 +151,13 @@ private Mono> listSinglePag /** * List the available security controls, their assessments, and the max score. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 definition along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of security controls definition as paginated response with {@link PagedFlux}. */ - @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 = "2020-01-01"; - 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -145,11 +165,21 @@ private Mono> listSinglePag * * @throws ManagementException thrown 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 definition as paginated response with {@link PagedFlux}. + * @return list of security controls definition along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -159,12 +189,21 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of security controls definition as paginated response with {@link PagedFlux}. + * @return list of security controls definition along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -176,7 +215,7 @@ private PagedFlux listAsync(Context conte */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -190,7 +229,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -224,31 +263,14 @@ private Mono> listBySubscri /** * For a specified subscription, list the available security controls, their assessments, and the max score. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 definition along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of security controls definition as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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 (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 - .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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -256,12 +278,26 @@ private Mono> listBySubscri * * @throws ManagementException thrown 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 definition as paginated response with {@link PagedFlux}. + * @return list of security controls definition along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySubscriptionAsync() { - return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -271,12 +307,26 @@ private PagedFlux listBySubscriptionAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 definition as paginated response with {@link PagedFlux}. + * @return list of security controls definition along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySubscriptionAsync(Context context) { - return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -288,7 +338,8 @@ private PagedFlux listBySubscriptionAsync */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySubscription() { - return new PagedIterable<>(listBySubscriptionAsync()); + return new PagedIterable<>(() -> listBySubscriptionSinglePage(), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -302,7 +353,8 @@ public PagedIterable listBySubscription() */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySubscription(Context context) { - return new PagedIterable<>(listBySubscriptionAsync(context)); + return new PagedIterable<>(() -> listBySubscriptionSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -331,6 +383,33 @@ private Mono> listNextSingl .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 definition along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -339,24 +418,24 @@ private Mono> listNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 definition along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of security controls definition along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -388,6 +467,33 @@ private Mono> listNextSingl .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 definition along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -396,23 +502,26 @@ private Mono> listNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 definition along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of security controls definition along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SecureScoreControlDefinitionsClientImpl.class); } 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..0212faee5ab3 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecureScoreControlsClient; import com.azure.resourcemanager.security.fluent.models.SecureScoreControlDetailsInner; import com.azure.resourcemanager.security.models.ExpandControlsEnum; @@ -72,6 +73,15 @@ Mono> listBySecureScore(@HostParam("$host") Str @PathParam("secureScoreName") String secureScoreName, @QueryParam("$expand") ExpandControlsEnum expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySecureScoreSync(@HostParam("$host") 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); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls") @ExpectedResponses({ 200 }) @@ -80,6 +90,14 @@ Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @QueryParam("$expand") ExpandControlsEnum expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") ExpandControlsEnum expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -88,12 +106,27 @@ Mono> listBySecureScoreNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySecureScoreNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") 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("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -139,36 +172,17 @@ private Mono> listBySecureScoreSin * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample * request below. * @param expand OData expand. 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 all security controls for a specific initiative within a scope along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return all security controls for a specific initiative within a scope as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySecureScoreSinglePageAsync(String secureScoreName, - ExpandControlsEnum expand, 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 (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 - .listBySecureScore(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), secureScoreName, - expand, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySecureScoreAsync(String secureScoreName, + ExpandControlsEnum expand) { + return new PagedFlux<>(() -> listBySecureScoreSinglePageAsync(secureScoreName, expand), + nextLink -> listBySecureScoreNextSinglePageAsync(nextLink)); } /** @@ -176,7 +190,6 @@ private Mono> listBySecureScoreSin * * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample * request below. - * @param expand OData expand. 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. @@ -184,8 +197,8 @@ private Mono> listBySecureScoreSin * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySecureScoreAsync(String secureScoreName, - ExpandControlsEnum expand) { + private PagedFlux listBySecureScoreAsync(String secureScoreName) { + final ExpandControlsEnum expand = null; return new PagedFlux<>(() -> listBySecureScoreSinglePageAsync(secureScoreName, expand), nextLink -> listBySecureScoreNextSinglePageAsync(nextLink)); } @@ -195,17 +208,35 @@ private PagedFlux listBySecureScoreAsync(String * * @param secureScoreName The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample * request below. + * @param expand OData expand. 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 all security controls for a specific initiative within a scope as paginated response with - * {@link PagedFlux}. + * @return all security controls for a specific initiative within a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySecureScoreAsync(String secureScoreName) { - final ExpandControlsEnum expand = null; - return new PagedFlux<>(() -> listBySecureScoreSinglePageAsync(secureScoreName, expand), - nextLink -> listBySecureScoreNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySecureScoreSinglePage(String secureScoreName, + ExpandControlsEnum expand) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (secureScoreName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter secureScoreName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listBySecureScoreSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), secureScoreName, expand, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -218,14 +249,31 @@ private PagedFlux listBySecureScoreAsync(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 all security controls for a specific initiative within a scope as paginated response with - * {@link PagedFlux}. + * @return all security controls for a specific initiative within a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySecureScoreAsync(String secureScoreName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySecureScoreSinglePage(String secureScoreName, ExpandControlsEnum expand, Context context) { - return new PagedFlux<>(() -> listBySecureScoreSinglePageAsync(secureScoreName, expand, context), - nextLink -> listBySecureScoreNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (secureScoreName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter secureScoreName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listBySecureScoreSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), secureScoreName, expand, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -242,7 +290,8 @@ private PagedFlux listBySecureScoreAsync(String @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySecureScore(String secureScoreName) { final ExpandControlsEnum expand = null; - return new PagedIterable<>(listBySecureScoreAsync(secureScoreName, expand)); + return new PagedIterable<>(() -> listBySecureScoreSinglePage(secureScoreName, expand), + nextLink -> listBySecureScoreNextSinglePage(nextLink)); } /** @@ -261,7 +310,8 @@ public PagedIterable listBySecureScore(String se @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySecureScore(String secureScoreName, ExpandControlsEnum expand, Context context) { - return new PagedIterable<>(listBySecureScoreAsync(secureScoreName, expand, context)); + return new PagedIterable<>(() -> listBySecureScoreSinglePage(secureScoreName, expand, context), + nextLink -> listBySecureScoreNextSinglePage(nextLink, context)); } /** @@ -298,58 +348,56 @@ private Mono> listSinglePageAsync( * Get all security controls within a scope. * * @param expand OData expand. 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 all security controls within a scope along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return all security controls within a scope as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(ExpandControlsEnum expand, - 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(), expand, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(ExpandControlsEnum expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get all security controls within a scope. * - * @param expand OData expand. 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 all security controls within a scope as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(ExpandControlsEnum expand) { + private PagedFlux listAsync() { + final ExpandControlsEnum expand = null; return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get all security controls within a scope. * + * @param expand OData expand. 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 all security controls within a scope as paginated response with {@link PagedFlux}. + * @return all security controls within a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - final ExpandControlsEnum expand = null; - return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(ExpandControlsEnum expand) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), expand, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -360,12 +408,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all security controls within a scope as paginated response with {@link PagedFlux}. + * @return all security controls within a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(ExpandControlsEnum expand, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(expand, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(ExpandControlsEnum expand, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), expand, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -378,7 +440,7 @@ private PagedFlux listAsync(ExpandControlsEnum e @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final ExpandControlsEnum expand = null; - return new PagedIterable<>(listAsync(expand)); + return new PagedIterable<>(() -> listSinglePage(expand), nextLink -> listNextSinglePage(nextLink)); } /** @@ -393,7 +455,8 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(ExpandControlsEnum expand, Context context) { - return new PagedIterable<>(listAsync(expand, context)); + return new PagedIterable<>(() -> listSinglePage(expand, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -422,6 +485,33 @@ private Mono> listBySecureScoreNex .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySecureScoreNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySecureScoreNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -430,23 +520,25 @@ 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 list of security controls along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySecureScoreNextSinglePageAsync(String nextLink, + private PagedResponse listBySecureScoreNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listBySecureScoreNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listBySecureScoreNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -474,6 +566,33 @@ private Mono> listNextSinglePageAs .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -482,22 +601,25 @@ 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 list of security controls along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SecureScoreControlsClientImpl.class); } 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..ce3e4a5fa631 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecureScoresClient; import com.azure.resourcemanager.security.fluent.models.SecureScoreItemInner; import com.azure.resourcemanager.security.models.SecureScoresList; @@ -70,6 +71,14 @@ 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/secureScores") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/secureScores/{secureScoreName}") @ExpectedResponses({ 200 }) @@ -79,12 +88,28 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("secureScoreName") String secureScoreName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("secureScoreName") String secureScoreName, @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -117,28 +142,13 @@ private Mono> listSinglePageAsync() { /** * 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 list of secure scores along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of secure scores as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -146,11 +156,26 @@ private Mono> listSinglePageAsync(Context co * * @throws ManagementException thrown 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 list of secure scores along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -160,12 +185,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of secure scores as paginated response with {@link PagedFlux}. + * @return list of secure scores along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -177,7 +216,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -191,7 +230,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -228,40 +267,6 @@ private Mono> getWithResponseAsync(String secureS .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'. - * - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - if (this.client.getSubscriptionId() == null) { - 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); - } - /** * Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC * Default initiative, use 'ascScore'. @@ -294,7 +299,24 @@ private Mono getAsync(String secureScoreName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String secureScoreName, Context context) { - return getWithResponseAsync(secureScoreName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (secureScoreName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter secureScoreName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), secureScoreName, + accept, context); } /** @@ -338,6 +360,33 @@ private Mono> listNextSinglePageAsync(String .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -346,21 +395,24 @@ private Mono> listNextSinglePageAsync(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 list of secure scores along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of secure scores along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SecureScoresClientImpl.class); } 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..a531cf8f819a 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 @@ -15,43 +15,90 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; 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.ApplicationOperationsClient; +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.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.ConnectorsClient; +import com.azure.resourcemanager.security.fluent.CustomAssessmentAutomationsClient; +import com.azure.resourcemanager.security.fluent.CustomEntityStoreAssignmentsClient; import com.azure.resourcemanager.security.fluent.CustomRecommendationsClient; +import com.azure.resourcemanager.security.fluent.DefenderForStoragesClient; +import com.azure.resourcemanager.security.fluent.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.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.OperationsClient; import com.azure.resourcemanager.security.fluent.PricingsClient; +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.ResourceProvidersClient; 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.SecurityConnectorApplicationOperationsClient; +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.SoftwareInventoriesClient; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentBaselineRulesClient; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScansClient; import com.azure.resourcemanager.security.fluent.StandardAssignmentsClient; +import com.azure.resourcemanager.security.fluent.SubAssessmentsClient; +import com.azure.resourcemanager.security.fluent.TasksClient; import com.azure.resourcemanager.security.fluent.TopologiesClient; +import com.azure.resourcemanager.security.fluent.WorkspaceSettingsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -136,6 +183,468 @@ public Duration getDefaultPollInterval() { return this.defaultPollInterval; } + /** + * The LocationsClient object to access its operations. + */ + private final LocationsClient locations; + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + public LocationsClient getLocations() { + return this.locations; + } + + /** + * The TasksClient object to access its operations. + */ + private final TasksClient tasks; + + /** + * Gets the TasksClient object to access its operations. + * + * @return the TasksClient object. + */ + public TasksClient getTasks() { + return this.tasks; + } + + /** + * 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 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 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 SubAssessmentsClient object to access its operations. + */ + private final SubAssessmentsClient subAssessments; + + /** + * Gets the SubAssessmentsClient object to access its operations. + * + * @return the SubAssessmentsClient object. + */ + public SubAssessmentsClient getSubAssessments() { + return this.subAssessments; + } + + /** + * The ConnectorsClient object to access its operations. + */ + private final ConnectorsClient connectors; + + /** + * Gets the ConnectorsClient object to access its operations. + * + * @return the ConnectorsClient object. + */ + public ConnectorsClient getConnectors() { + return this.connectors; + } + + /** + * The SoftwareInventoriesClient object to access its operations. + */ + private final SoftwareInventoriesClient softwareInventories; + + /** + * Gets the SoftwareInventoriesClient object to access its operations. + * + * @return the SoftwareInventoriesClient object. + */ + public SoftwareInventoriesClient getSoftwareInventories() { + return this.softwareInventories; + } + + /** + * The CustomAssessmentAutomationsClient object to access its operations. + */ + private final CustomAssessmentAutomationsClient customAssessmentAutomations; + + /** + * Gets the CustomAssessmentAutomationsClient object to access its operations. + * + * @return the CustomAssessmentAutomationsClient object. + */ + public CustomAssessmentAutomationsClient getCustomAssessmentAutomations() { + return this.customAssessmentAutomations; + } + + /** + * The CustomEntityStoreAssignmentsClient object to access its operations. + */ + private final CustomEntityStoreAssignmentsClient customEntityStoreAssignments; + + /** + * Gets the CustomEntityStoreAssignmentsClient object to access its operations. + * + * @return the CustomEntityStoreAssignmentsClient object. + */ + public CustomEntityStoreAssignmentsClient getCustomEntityStoreAssignments() { + return this.customEntityStoreAssignments; + } + + /** + * 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 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 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 ApplicationOperationsClient object to access its operations. + */ + private final ApplicationOperationsClient applicationOperations; + + /** + * Gets the ApplicationOperationsClient object to access its operations. + * + * @return the ApplicationOperationsClient object. + */ + public ApplicationOperationsClient getApplicationOperations() { + return this.applicationOperations; + } + + /** + * The SecurityConnectorApplicationsClient object to access its operations. + */ + private final SecurityConnectorApplicationsClient securityConnectorApplications; + + /** + * Gets the SecurityConnectorApplicationsClient object to access its operations. + * + * @return the SecurityConnectorApplicationsClient object. + */ + public SecurityConnectorApplicationsClient getSecurityConnectorApplications() { + return this.securityConnectorApplications; + } + + /** + * The SecurityConnectorApplicationOperationsClient object to access its operations. + */ + private final SecurityConnectorApplicationOperationsClient securityConnectorApplicationOperations; + + /** + * Gets the SecurityConnectorApplicationOperationsClient object to access its operations. + * + * @return the SecurityConnectorApplicationOperationsClient object. + */ + public SecurityConnectorApplicationOperationsClient getSecurityConnectorApplicationOperations() { + return this.securityConnectorApplicationOperations; + } + + /** + * 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 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 SqlVulnerabilityAssessmentScansClient object to access its operations. + */ + private final SqlVulnerabilityAssessmentScansClient sqlVulnerabilityAssessmentScans; + + /** + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScansClient object. + */ + public SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans() { + return this.sqlVulnerabilityAssessmentScans; + } + + /** + * The SqlVulnerabilityAssessmentScanResultsClient object to access its operations. + */ + private final SqlVulnerabilityAssessmentScanResultsClient sqlVulnerabilityAssessmentScanResults; + + /** + * Gets the SqlVulnerabilityAssessmentScanResultsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScanResultsClient object. + */ + public SqlVulnerabilityAssessmentScanResultsClient getSqlVulnerabilityAssessmentScanResults() { + return this.sqlVulnerabilityAssessmentScanResults; + } + + /** + * The SensitivitySettingsClient object to access its operations. + */ + private final SensitivitySettingsClient sensitivitySettings; + + /** + * Gets the SensitivitySettingsClient object to access its operations. + * + * @return the SensitivitySettingsClient object. + */ + public SensitivitySettingsClient getSensitivitySettings() { + return this.sensitivitySettings; + } + + /** + * 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 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 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 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 ResourceProvidersClient object to access its operations. + */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + /** * The ComplianceResultsClient object to access its operations. */ @@ -528,6 +1037,160 @@ public CustomRecommendationsClient getCustomRecommendations() { return this.customRecommendations; } + /** + * The DefenderForStoragesClient object to access its operations. + */ + private final DefenderForStoragesClient defenderForStorages; + + /** + * Gets the DefenderForStoragesClient object to access its operations. + * + * @return the DefenderForStoragesClient object. + */ + public DefenderForStoragesClient getDefenderForStorages() { + return this.defenderForStorages; + } + + /** + * The AzureDevOpsOrgsClient object to access its operations. + */ + private final AzureDevOpsOrgsClient azureDevOpsOrgs; + + /** + * Gets the AzureDevOpsOrgsClient object to access its operations. + * + * @return the AzureDevOpsOrgsClient object. + */ + public AzureDevOpsOrgsClient getAzureDevOpsOrgs() { + return this.azureDevOpsOrgs; + } + + /** + * The AzureDevOpsProjectsClient object to access its operations. + */ + private final AzureDevOpsProjectsClient azureDevOpsProjects; + + /** + * Gets the AzureDevOpsProjectsClient object to access its operations. + * + * @return the AzureDevOpsProjectsClient object. + */ + public AzureDevOpsProjectsClient getAzureDevOpsProjects() { + return this.azureDevOpsProjects; + } + + /** + * The AzureDevOpsReposClient object to access its operations. + */ + private final AzureDevOpsReposClient azureDevOpsRepos; + + /** + * Gets the AzureDevOpsReposClient object to access its operations. + * + * @return the AzureDevOpsReposClient object. + */ + public AzureDevOpsReposClient getAzureDevOpsRepos() { + return this.azureDevOpsRepos; + } + + /** + * The DevOpsConfigurationsClient object to access its operations. + */ + private final DevOpsConfigurationsClient devOpsConfigurations; + + /** + * Gets the DevOpsConfigurationsClient object to access its operations. + * + * @return the DevOpsConfigurationsClient object. + */ + public DevOpsConfigurationsClient getDevOpsConfigurations() { + return this.devOpsConfigurations; + } + + /** + * The GitHubOwnersClient object to access its operations. + */ + private final GitHubOwnersClient gitHubOwners; + + /** + * Gets the GitHubOwnersClient object to access its operations. + * + * @return the GitHubOwnersClient object. + */ + public GitHubOwnersClient getGitHubOwners() { + return this.gitHubOwners; + } + + /** + * The GitHubReposClient object to access its operations. + */ + private final GitHubReposClient gitHubRepos; + + /** + * Gets the GitHubReposClient object to access its operations. + * + * @return the GitHubReposClient object. + */ + public GitHubReposClient getGitHubRepos() { + return this.gitHubRepos; + } + + /** + * The GitLabGroupsClient object to access its operations. + */ + private final GitLabGroupsClient gitLabGroups; + + /** + * Gets the GitLabGroupsClient object to access its operations. + * + * @return the GitLabGroupsClient object. + */ + public GitLabGroupsClient getGitLabGroups() { + return this.gitLabGroups; + } + + /** + * The GitLabSubgroupsClient object to access its operations. + */ + private final GitLabSubgroupsClient gitLabSubgroups; + + /** + * Gets the GitLabSubgroupsClient object to access its operations. + * + * @return the GitLabSubgroupsClient object. + */ + public GitLabSubgroupsClient getGitLabSubgroups() { + return this.gitLabSubgroups; + } + + /** + * The GitLabProjectsClient object to access its operations. + */ + private final GitLabProjectsClient gitLabProjects; + + /** + * Gets the GitLabProjectsClient object to access its operations. + * + * @return the GitLabProjectsClient object. + */ + public GitLabProjectsClient getGitLabProjects() { + return this.gitLabProjects; + } + + /** + * The DevOpsOperationResultsClient object to access its operations. + */ + private final DevOpsOperationResultsClient devOpsOperationResults; + + /** + * Gets the DevOpsOperationResultsClient object to access its operations. + * + * @return the DevOpsOperationResultsClient object. + */ + public DevOpsOperationResultsClient getDevOpsOperationResults() { + return this.devOpsOperationResults; + } + /** * Initializes an instance of SecurityCenter client. * @@ -545,6 +1208,39 @@ public CustomRecommendationsClient getCustomRecommendations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.locations = new LocationsClientImpl(this); + this.tasks = new TasksClientImpl(this); + this.autoProvisioningSettings = new AutoProvisioningSettingsClientImpl(this); + this.compliances = new CompliancesClientImpl(this); + this.informationProtectionPolicies = new InformationProtectionPoliciesClientImpl(this); + this.workspaceSettings = new WorkspaceSettingsClientImpl(this); + this.alertsSuppressionRules = new AlertsSuppressionRulesClientImpl(this); + this.regulatoryComplianceStandards = new RegulatoryComplianceStandardsClientImpl(this); + this.regulatoryComplianceControls = new RegulatoryComplianceControlsClientImpl(this); + this.regulatoryComplianceAssessments = new RegulatoryComplianceAssessmentsClientImpl(this); + this.subAssessments = new SubAssessmentsClientImpl(this); + this.connectors = new ConnectorsClientImpl(this); + this.softwareInventories = new SoftwareInventoriesClientImpl(this); + this.customAssessmentAutomations = new CustomAssessmentAutomationsClientImpl(this); + this.customEntityStoreAssignments = new CustomEntityStoreAssignmentsClientImpl(this); + this.mdeOnboardings = new MdeOnboardingsClientImpl(this); + this.governanceAssignments = new GovernanceAssignmentsClientImpl(this); + this.governanceRules = new GovernanceRulesClientImpl(this); + this.applications = new ApplicationsClientImpl(this); + this.applicationOperations = new ApplicationOperationsClientImpl(this); + this.securityConnectorApplications = new SecurityConnectorApplicationsClientImpl(this); + this.securityConnectorApplicationOperations = new SecurityConnectorApplicationOperationsClientImpl(this); + this.securityOperators = new SecurityOperatorsClientImpl(this); + this.sqlVulnerabilityAssessmentBaselineRules = new SqlVulnerabilityAssessmentBaselineRulesClientImpl(this); + this.sqlVulnerabilityAssessmentScans = new SqlVulnerabilityAssessmentScansClientImpl(this); + this.sqlVulnerabilityAssessmentScanResults = new SqlVulnerabilityAssessmentScanResultsClientImpl(this); + this.sensitivitySettings = new SensitivitySettingsClientImpl(this); + this.healthReports = new HealthReportsClientImpl(this); + this.automations = new AutomationsClientImpl(this); + this.securityContacts = new SecurityContactsClientImpl(this); + this.securityConnectors = new SecurityConnectorsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); this.complianceResults = new ComplianceResultsClientImpl(this); this.advancedThreatProtections = new AdvancedThreatProtectionsClientImpl(this); this.deviceSecurityGroups = new DeviceSecurityGroupsClientImpl(this); @@ -575,6 +1271,17 @@ public CustomRecommendationsClient getCustomRecommendations() { this.securityStandards = new SecurityStandardsClientImpl(this); this.standardAssignments = new StandardAssignmentsClientImpl(this); this.customRecommendations = new CustomRecommendationsClientImpl(this); + this.defenderForStorages = new DefenderForStoragesClientImpl(this); + this.azureDevOpsOrgs = new AzureDevOpsOrgsClientImpl(this); + this.azureDevOpsProjects = new AzureDevOpsProjectsClientImpl(this); + this.azureDevOpsRepos = new AzureDevOpsReposClientImpl(this); + this.devOpsConfigurations = new DevOpsConfigurationsClientImpl(this); + this.gitHubOwners = new GitHubOwnersClientImpl(this); + this.gitHubRepos = new GitHubReposClientImpl(this); + this.gitLabGroups = new GitLabGroupsClientImpl(this); + this.gitLabSubgroups = new GitLabSubgroupsClientImpl(this); + this.gitLabProjects = new GitLabProjectsClientImpl(this); + this.devOpsOperationResults = new DevOpsOperationResultsClientImpl(this); } /** @@ -614,6 +1321,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationOperationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationOperationsClientImpl.java new file mode 100644 index 000000000000..be184fa4bc27 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationOperationsClientImpl.java @@ -0,0 +1,514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecurityConnectorApplicationOperationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SecurityConnectorApplicationOperationsClient. + */ +public final class SecurityConnectorApplicationOperationsClientImpl + implements SecurityConnectorApplicationOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecurityConnectorApplicationOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecurityConnectorApplicationOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityConnectorApplicationOperationsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SecurityConnectorApplicationOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecurityConnectorApplicationOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + public interface SecurityConnectorApplicationOperationsService { + @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("$host") 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); + + @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) + Response getSync(@HostParam("$host") 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); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("applicationId") String applicationId, + @BodyParam("application/json") ApplicationInner application, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("applicationId") String applicationId, + @BodyParam("application/json") ApplicationInner application, @HeaderParam("Accept") String accept, + 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("$host") 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({ "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) + Response deleteSync(@HostParam("$host") 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); + } + + /** + * Get a specific application for the requested scope by applicationId. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (applicationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + return service.getSync(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 within the user's subscription. 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 within the user's subscription. 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, applicationId, application, + accept, 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (applicationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + if (application == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, applicationId, application, accept, context); + } + + /** + * Creates or update a security Application on the given security connector. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (applicationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter applicationId is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + return service.deleteSync(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 within the user's subscription. 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); + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityConnectorApplicationOperationsClientImpl.class); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationOperationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationOperationsImpl.java new file mode 100644 index 000000000000..ba0329b7dc54 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationOperationsImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecurityConnectorApplicationOperationsClient; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import com.azure.resourcemanager.security.models.Application; +import com.azure.resourcemanager.security.models.SecurityConnectorApplicationOperations; + +public final class SecurityConnectorApplicationOperationsImpl implements SecurityConnectorApplicationOperations { + private static final ClientLogger LOGGER = new ClientLogger(SecurityConnectorApplicationOperationsImpl.class); + + private final SecurityConnectorApplicationOperationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecurityConnectorApplicationOperationsImpl(SecurityConnectorApplicationOperationsClient 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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + } + + private SecurityConnectorApplicationOperationsClient 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/SecurityConnectorApplicationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsClientImpl.java new file mode 100644 index 000000000000..480a2bd08fed --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsClientImpl.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + public interface SecurityConnectorApplicationsService { + @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("$host") 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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, accept, Context.NONE); + return 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 within the user's subscription. 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String securityConnectorName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2022-07-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, accept, context); + return 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 within the user's subscription. 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<>(() -> listSinglePage(resourceGroupName, securityConnectorName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get a list of all relevant applications over a security connector level scope. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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<>(() -> listSinglePage(resourceGroupName, securityConnectorName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a security applications list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 applications list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 applications list along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityConnectorApplicationsClientImpl.class); +} 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..655888a76d63 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.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 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..0329d2ef0f1e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.Region; +import com.azure.core.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 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 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 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..e9ca308ec3d0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsClientImpl.java @@ -0,0 +1,1152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +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.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("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + public interface SecurityConnectorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors") + @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/securityConnectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") 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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @BodyParam("application/json") SecurityConnectorInner securityConnector, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @BodyParam("application/json") SecurityConnectorInner securityConnector, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @BodyParam("application/json") SecurityConnectorInner securityConnector, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @BodyParam("application/json") SecurityConnectorInner securityConnector, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") 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" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") 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("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") 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, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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. + * + * @throws ManagementException thrown 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. + * + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(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 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 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 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 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 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 connectors response along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return 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 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 ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, accept, context); + return 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 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 connectors response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(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 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 ManagementException thrown 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<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Retrieves details of a specific security connector. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + return service.getByResourceGroupSync(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 within the user's subscription. 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 within the user's subscription. 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, securityConnector, accept, + 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 within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (securityConnector == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnector is required and cannot be null.")); + } else { + securityConnector.validate(); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, securityConnector, accept, 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 within the user's subscription. 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 within the user's subscription. 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 accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, securityConnector, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (securityConnector == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnector is required and cannot be null.")); + } else { + securityConnector.validate(); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, securityConnector, accept, context); + } + + /** + * Updates a security connector. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a security connector. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, accept, context); + } + + /** + * Deletes a security connector. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityConnectorsClientImpl.class); +} 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..f2939bcf75f2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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 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 Response getByResourceGroupWithResponse(String resourceGroupName, + String securityConnectorName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, securityConnectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityConnectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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..029aa7570401 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 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..90b8bc0c429b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java @@ -0,0 +1,656 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + public interface SecurityContactsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts") + @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/securityContacts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/securityContacts/{securityContactName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @BodyParam("application/json") SecurityContactInner securityContact, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @BodyParam("application/json") SecurityContactInner securityContact, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("securityContactName") SecurityContactName securityContactName, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context 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 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. + * + * @throws ManagementException thrown 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. + * + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), securityContactName, securityContact, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + if (securityContact == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityContact is required and cannot be null.")); + } else { + securityContact.validate(); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + securityContactName, securityContact, accept, 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. + */ + @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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), securityContactName, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (securityContactName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityContactName is required and cannot be null.")); + } + final String apiVersion = "2023-12-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + securityContactName, accept, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(SecurityContactName securityContactName) { + deleteWithResponse(securityContactName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityContactsClientImpl.class); +} 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..c0f936d77aad --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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 Response getWithResponse(SecurityContactName securityContactName, Context context) { + Response inner = this.serviceClient().getWithResponse(securityContactName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityContactImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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..8b47bb003823 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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/SecurityOperatorListImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorListImpl.java new file mode 100644 index 000000000000..2d7b6005ef57 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorListImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorListInner; +import com.azure.resourcemanager.security.models.SecurityOperator; +import com.azure.resourcemanager.security.models.SecurityOperatorList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class SecurityOperatorListImpl implements SecurityOperatorList { + private SecurityOperatorListInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SecurityOperatorListImpl(SecurityOperatorListInner 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 SecurityOperatorImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public SecurityOperatorListInner 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..75631bacc633 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorsClientImpl.java @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecurityOperatorsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorListInner; +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("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + public interface SecurityOperatorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("pricingName") String pricingName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("$host") 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) + Response createOrUpdateSync(@HostParam("$host") 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" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") 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" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") 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); + } + + /** + * 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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)) + .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String pricingName) { + return listWithResponseAsync(pricingName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String pricingName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName, + accept, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityOperatorListInner list(String pricingName) { + return listWithResponse(pricingName, Context.NONE).getValue(); + } + + /** + * Get a specific security operator for the requested scope. + * + * @param pricingName name of the pricing configuration. + * @param securityOperatorName name of the securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 securityOperator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + return service.getSync(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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 securityOperator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), pricingName, securityOperatorName, accept, 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 securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 securityOperator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (pricingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter pricingName is required and cannot be null.")); + } + if (securityOperatorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityOperatorName is required and cannot be null.")); + } + final String apiVersion = "2023-01-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), pricingName, + securityOperatorName, accept, context); + } + + /** + * Delete Microsoft Defender for Cloud securityOperator in the subscription. + * + * @param pricingName name of the pricing configuration. + * @param securityOperatorName name of the securityOperator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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); + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityOperatorsClientImpl.class); +} 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..e5d70025bc58 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityOperatorsImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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.SecurityOperatorsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorInner; +import com.azure.resourcemanager.security.fluent.models.SecurityOperatorListInner; +import com.azure.resourcemanager.security.models.SecurityOperator; +import com.azure.resourcemanager.security.models.SecurityOperatorList; +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 listWithResponse(String pricingName, Context context) { + Response inner = this.serviceClient().listWithResponse(pricingName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityOperatorListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SecurityOperatorList list(String pricingName) { + SecurityOperatorListInner inner = this.serviceClient().list(pricingName); + if (inner != null) { + return new SecurityOperatorListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String pricingName, String securityOperatorName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(pricingName, securityOperatorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityOperatorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityOperatorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + } + + 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/SecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java index 84189c7ddba7..67f9f73295fa 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.models.SecuritySolutionInner; import com.azure.resourcemanager.security.models.SecuritySolutionList; @@ -70,6 +71,14 @@ Mono> list(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}") @ExpectedResponses({ 200 }) @@ -80,12 +89,29 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("securitySolutionName") String securitySolutionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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); + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -119,29 +145,13 @@ private Mono> listSinglePageAsync() { /** * 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}. + * @return a list of Security Solutions for the subscription as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -149,11 +159,26 @@ private Mono> listSinglePageAsync(Context c * * @throws ManagementException thrown if 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}. + * @return a list of Security Solutions for the subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -163,12 +188,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Security Solutions for the subscription as paginated response with {@link PagedFlux}. + * @return a list of Security Solutions for the subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -180,7 +219,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -194,7 +233,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -240,49 +279,6 @@ private Mono> getWithResponseAsync(String resour .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 ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param securitySolutionName Name of 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 Security Solution along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String ascLocation, - String securitySolutionName, 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 (securitySolutionName == null) { - return Mono - .error(new IllegalArgumentException("Parameter securitySolutionName 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, - securitySolutionName, apiVersion, accept, context); - } - /** * Gets a specific Security Solution. * @@ -320,7 +316,32 @@ private Mono getAsync(String resourceGroupName, String as @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String ascLocation, String securitySolutionName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, securitySolutionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (securitySolutionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securitySolutionName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, securitySolutionName, apiVersion, accept, context); } /** @@ -366,6 +387,33 @@ private Mono> listNextSinglePageAsync(Strin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -374,21 +422,24 @@ 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 the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SecuritySolutionsClientImpl.class); } 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..5f38e86dba4e 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 @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecuritySolutionsReferenceDatasClient; import com.azure.resourcemanager.security.fluent.models.SecuritySolutionsReferenceDataListInner; import reactor.core.publisher.Mono; @@ -65,6 +66,14 @@ Mono> list(@HostParam("$host") @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData") @ExpectedResponses({ 200 }) @@ -72,6 +81,14 @@ Mono> list(@HostParam("$host") 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); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByHomeRegionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); } /** @@ -100,32 +117,6 @@ private Mono> listWithResponse .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a list of all supported 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 all supported Security Solutions for the subscription 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 = "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); - } - /** * Gets a list of all supported Security Solutions for the subscription. * @@ -149,7 +140,20 @@ private Mono listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response listWithResponse(Context context) { - return listWithResponseAsync(context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, + context); } /** @@ -197,39 +201,6 @@ public SecuritySolutionsReferenceDataListInner list() { .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets list of all supported Security Solutions for subscription and 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 list of all supported Security Solutions for subscription and location along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByHomeRegionWithResponseAsync(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 = "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); - } - /** * Gets list of all supported Security Solutions for subscription and location. * @@ -260,7 +231,24 @@ private Mono listByHomeRegionAsync(Stri @ServiceMethod(returns = ReturnType.SINGLE) public Response listByHomeRegionWithResponse(String ascLocation, Context context) { - return listByHomeRegionWithResponseAsync(ascLocation, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.listByHomeRegionSync(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, + apiVersion, accept, context); } /** @@ -277,4 +265,6 @@ public Response listByHomeRegionWithRes public SecuritySolutionsReferenceDataListInner listByHomeRegion(String ascLocation) { return listByHomeRegionWithResponse(ascLocation, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(SecuritySolutionsReferenceDatasClientImpl.class); } 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..20655ee2e6d7 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 @@ -28,6 +28,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecurityStandardsClient; import com.azure.resourcemanager.security.fluent.models.SecurityStandardInner; import com.azure.resourcemanager.security.models.SecurityStandardList; @@ -73,6 +74,14 @@ 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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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 }) @@ -81,6 +90,14 @@ Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, @PathParam("standardId") String standardId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("standardId") String standardId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") @ExpectedResponses({ 200, 201 }) @@ -90,6 +107,15 @@ Mono> createOrUpdate(@HostParam("$host") String @PathParam("standardId") String standardId, @BodyParam("application/json") SecurityStandardInner standard, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("standardId") String standardId, @BodyParam("application/json") SecurityStandardInner standard, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") @ExpectedResponses({ 200, 204 }) @@ -98,12 +124,27 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("scope") String scope, @PathParam("standardId") String standardId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("scope") String scope, @PathParam("standardId") String standardId, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -144,28 +185,14 @@ private Mono> listSinglePageAsync(String sc * '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}. + * @return a list of all relevant security standards over a scope as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -178,11 +205,24 @@ private Mono> listSinglePageAsync(String sc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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}. + * @return a list of all relevant security standards over a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String scope) { - return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -196,12 +236,24 @@ private PagedFlux listAsync(String 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 list of all relevant security standards over a scope as paginated response with {@link PagedFlux}. + * @return a list of all relevant security standards over a scope along with {@link PagedResponse}. */ - @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) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -218,7 +270,7 @@ private PagedFlux listAsync(String scope, Context context */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope) { - return new PagedIterable<>(listAsync(scope)); + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); } /** @@ -236,7 +288,8 @@ public PagedIterable list(String scope) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope, Context context) { - return new PagedIterable<>(listAsync(scope, context)); + return new PagedIterable<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -273,40 +326,6 @@ private Mono> getWithResponseAsync(String scope, .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get a specific security standard for the requested scope by standardId. - * - * @param scope The scope of the security standard. Valid scopes are: management group (format: - * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * 'subscriptions/{subscriptionId}'), or security connector (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. - * @param standardId The Security Standard key - unique key for the standard type. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a specific security standard for the requested scope by standardId along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String scope, String standardId, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (scope == null) { - return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); - } - if (standardId == null) { - return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context); - } - /** * Get a specific security standard for the requested scope by standardId. * @@ -342,7 +361,21 @@ private Mono getAsync(String scope, String standardId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String scope, String standardId, Context context) { - return getWithResponseAsync(scope, standardId, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context); } /** @@ -403,46 +436,6 @@ private Mono> createOrUpdateWithResponseAsync(St .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Creates or updates a security standard over a given scope. - * - * @param scope The scope of the security standard. Valid scopes are: management group (format: - * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * 'subscriptions/{subscriptionId}'), or security connector (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. - * @param standardId The Security Standard key - unique key for the standard type. - * @param standard Custom security standard over a pre-defined scope. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return security Standard on a resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String scope, String standardId, - SecurityStandardInner standard, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (scope == null) { - return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); - } - if (standardId == null) { - return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); - } - if (standard == null) { - return Mono.error(new IllegalArgumentException("Parameter standard is required and cannot be null.")); - } else { - standard.validate(); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId, standard, accept, - context); - } - /** * Creates or updates a security standard over a given scope. * @@ -482,7 +475,28 @@ private Mono createOrUpdateAsync(String scope, String sta @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String scope, String standardId, SecurityStandardInner standard, Context context) { - return createOrUpdateWithResponseAsync(scope, standardId, standard, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + if (standard == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standard is required and cannot be null.")); + } else { + standard.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, scope, standardId, standard, accept, + context); } /** @@ -537,38 +551,6 @@ private Mono> deleteWithResponseAsync(String scope, String standa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Delete a security standard over a given scope. - * - * @param scope The scope of the security standard. Valid scopes are: management group (format: - * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: - * 'subscriptions/{subscriptionId}'), or security connector (format: - * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. - * @param standardId The Security Standard key - unique key for the standard type. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String scope, String standardId, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (scope == null) { - return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); - } - if (standardId == null) { - return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context); - } - /** * Delete a security standard over a given scope. * @@ -603,7 +585,21 @@ private Mono deleteAsync(String scope, String standardId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String scope, String standardId, Context context) { - return deleteWithResponseAsync(scope, standardId, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context); } /** @@ -648,6 +644,33 @@ private Mono> listNextSinglePageAsync(Strin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -656,21 +679,24 @@ 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 page of a Standard list along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityStandardsClientImpl.class); } 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..b3497d8c02b1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySubAssessmentImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..6d71c09739a1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityTaskImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.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 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..e22adcb5abd7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SensitivitySettingsClientImpl.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.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.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterSensit") + public interface SensitivitySettingsService { + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Security/sensitivitySettings/current") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateSensitivitySettingsRequest sensitivitySettings, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Security/sensitivitySettings/current") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateSensitivitySettingsRequest sensitivitySettings, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/sensitivitySettings/current") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/sensitivitySettings/current") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/sensitivitySettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Security/sensitivitySettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, 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 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, sensitivitySettings, + accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (sensitivitySettings == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter sensitivitySettings is required and cannot be null.")); + } else { + sensitivitySettings.validate(); + } + final String apiVersion = "2023-02-15-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, sensitivitySettings, accept, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetSensitivitySettingsResponseInner createOrUpdate(UpdateSensitivitySettingsRequest sensitivitySettings) { + return createOrUpdateWithResponse(sensitivitySettings, Context.NONE).getValue(); + } + + /** + * 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. + * + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(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 service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetSensitivitySettingsResponseInner get() { + return getWithResponse(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. + * + * @throws ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(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 service.listSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetSensitivitySettingsListResponseInner list() { + return listWithResponse(Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(SensitivitySettingsClientImpl.class); +} 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..2b77f8d61377 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SensitivitySettingsImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 + createOrUpdateWithResponse(UpdateSensitivitySettingsRequest sensitivitySettings, Context context) { + Response inner + = this.serviceClient().createOrUpdateWithResponse(sensitivitySettings, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetSensitivitySettingsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 getWithResponse(Context context) { + Response inner = this.serviceClient().getWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetSensitivitySettingsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GetSensitivitySettingsResponse get() { + GetSensitivitySettingsResponseInner inner = this.serviceClient().get(); + if (inner != null) { + return new GetSensitivitySettingsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetSensitivitySettingsListResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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/ServerVulnerabilityAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsClientImpl.java index e27cdff5f0ec..0d6af87253dc 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 @@ -22,8 +22,10 @@ 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.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsClient; @@ -76,6 +78,17 @@ Mono> listByExtendedResource( @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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByExtendedResourceSync( + @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 }) @@ -88,6 +101,18 @@ Mono> get(@HostParam("$host") Strin @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, @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) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, + @QueryParam("api-version") String apiVersion, @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 }) @@ -100,6 +125,18 @@ Mono> createOrUpdate(@HostParam("$h @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, @QueryParam("api-version") String apiVersion, @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) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}") @ExpectedResponses({ 200, 202, 204 }) @@ -111,6 +148,18 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("resourceName") String resourceName, @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "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) + Response deleteSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, + @PathParam("serverVulnerabilityAssessment") String serverVulnerabilityAssessment, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); } /** @@ -161,53 +210,6 @@ private Mono> listByExtendedRe .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. * @@ -247,8 +249,36 @@ private Mono listByExtendedResourceAsyn @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(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.listByExtendedResourceSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, resourceNamespace, resourceType, resourceName, apiVersion, accept, context); } /** @@ -320,54 +350,6 @@ private Mono> getWithResponseAsync( .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 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 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> getWithResponseAsync(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 serverVulnerabilityAssessment = "default"; - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); - } - /** * Gets a server vulnerability assessment onboarding statuses on a given resource. * @@ -406,7 +388,37 @@ private Mono getAsync(String resourceGroupNa @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { - return getWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + throw LOGGER.atError() + .log(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"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); } /** @@ -479,55 +491,6 @@ private Mono> createOrUpdateWithRes .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * 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 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 describes the server vulnerability assessment details on a resource along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(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 serverVulnerabilityAssessment = "default"; - final String apiVersion = "2020-01-01"; - 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); - } - /** * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it. @@ -568,8 +531,37 @@ private Mono createOrUpdateAsync(String reso @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + throw LOGGER.atError() + .log(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"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); } /** @@ -649,43 +641,46 @@ private Mono>> deleteWithResponseAsync(String resource * @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 the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, Context context) { + private Response deleteWithResponse(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); + return service.deleteSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, + Context.NONE); } /** @@ -696,18 +691,46 @@ private Mono>> deleteWithResponseAsync(String resource * @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 the {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName) { - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + throw LOGGER.atError() + .log(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"; + return service.deleteSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, serverVulnerabilityAssessment, apiVersion, accept, context); } /** @@ -718,7 +741,6 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @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. @@ -726,12 +748,11 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, Context context) { - context = this.client.mergeContext(context); + String resourceType, String resourceName) { Mono>> mono - = deleteWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + = deleteWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -750,7 +771,9 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { - return this.beginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).getSyncPoller(); + Response response + = deleteWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -770,8 +793,9 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { - return this.beginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context) - .getSyncPoller(); + Response response + = deleteWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -794,27 +818,6 @@ private Mono deleteAsync(String resourceGroupName, String resourceNamespac .flatMap(this.client::getLroFinalResultOrError); } - /** - * 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 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 {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String resourceNamespace, String resourceType, - String resourceName, Context context) { - return beginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Removing server vulnerability assessment from a resource. * @@ -829,7 +832,7 @@ private Mono deleteAsync(String resourceGroupName, String resourceNamespac */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { - deleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).block(); + beginDelete(resourceGroupName, resourceNamespace, resourceType, resourceName).getFinalResult(); } /** @@ -848,6 +851,8 @@ public void delete(String resourceGroupName, String resourceNamespace, String re @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { - deleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context).block(); + beginDelete(resourceGroupName, resourceNamespace, resourceType, resourceName, context).getFinalResult(); } + + private static final ClientLogger LOGGER = new ClientLogger(ServerVulnerabilityAssessmentsClientImpl.class); } 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..64defa7e1c7a 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 @@ -28,6 +28,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsSettingsClient; import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsSettingInner; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName; @@ -76,6 +77,14 @@ Mono> list(@HostParam("$hos @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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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 }) @@ -85,6 +94,15 @@ Mono> get(@HostParam("$host @PathParam("settingKind") ServerVulnerabilityAssessmentsSettingKindName settingKind, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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 }) @@ -95,6 +113,16 @@ Mono> createOrUpdate(@HostP @BodyParam("application/json") ServerVulnerabilityAssessmentsSettingInner serverVulnerabilityAssessmentsSetting, @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) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingKind") ServerVulnerabilityAssessmentsSettingKindName settingKind, + @BodyParam("application/json") ServerVulnerabilityAssessmentsSettingInner serverVulnerabilityAssessmentsSetting, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}") @ExpectedResponses({ 200, 204 }) @@ -104,6 +132,15 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("settingKind") ServerVulnerabilityAssessmentsSettingKindName settingKind, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") 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" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -111,6 +148,14 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap Mono> listBySubscriptionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -145,29 +190,15 @@ private Mono> listSing /** * 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}. + * @return a list of all the server vulnerability assessments settings over a subscription level scope as paginated + * response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -175,13 +206,27 @@ private Mono> listSing * * @throws ManagementException thrown if 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}. + * @return a list of all the server vulnerability assessments settings over a subscription level scope along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + apiVersion, this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -191,13 +236,27 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of all the server vulnerability assessments settings over a subscription level scope as paginated - * response with {@link PagedFlux}. + * @return a list of all the server vulnerability assessments settings over a subscription level scope along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -210,7 +269,7 @@ private PagedFlux listAsync(Context */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -225,7 +284,8 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -260,38 +320,6 @@ public PagedIterable list(Context co .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get a server vulnerability assessments setting of the requested kind, that is set on the subscription. - * - * @param settingKind The kind of the server vulnerability assessments 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 a server vulnerability assessments setting of the requested kind, that is set on the subscription along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getWithResponseAsync(ServerVulnerabilityAssessmentsSettingKindName settingKind, 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 (settingKind == null) { - 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.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingKind, accept, - context); - } - /** * Get a server vulnerability assessments setting of the requested kind, that is set on the subscription. * @@ -322,7 +350,24 @@ public PagedIterable list(Context co @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(ServerVulnerabilityAssessmentsSettingKindName settingKind, Context context) { - return getWithResponseAsync(settingKind, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingKind == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingKind is required and cannot be null.")); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingKind, + accept, context); } /** @@ -379,46 +424,6 @@ private Mono> createOrUpdat .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Create or update a server vulnerability assessments setting of the requested kind on the subscription. - * - * @param settingKind The kind of the server vulnerability assessments setting. - * @param serverVulnerabilityAssessmentsSetting A server vulnerability assessments setting over a predefined 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 base vulnerability assessments setting on servers in the defined scope along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( - ServerVulnerabilityAssessmentsSettingKindName settingKind, - ServerVulnerabilityAssessmentsSettingInner serverVulnerabilityAssessmentsSetting, 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 (settingKind == null) { - return Mono.error(new IllegalArgumentException("Parameter settingKind is required and cannot be null.")); - } - if (serverVulnerabilityAssessmentsSetting == null) { - return Mono.error(new IllegalArgumentException( - "Parameter serverVulnerabilityAssessmentsSetting is required and cannot be null.")); - } else { - serverVulnerabilityAssessmentsSetting.validate(); - } - final String apiVersion = "2023-05-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - settingKind, serverVulnerabilityAssessmentsSetting, accept, context); - } - /** * Create or update a server vulnerability assessments setting of the requested kind on the subscription. * @@ -453,7 +458,31 @@ private Mono createOrUpdateAsync( public Response createOrUpdateWithResponse( ServerVulnerabilityAssessmentsSettingKindName settingKind, ServerVulnerabilityAssessmentsSettingInner serverVulnerabilityAssessmentsSetting, Context context) { - return createOrUpdateWithResponseAsync(settingKind, serverVulnerabilityAssessmentsSetting, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingKind == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingKind is required and cannot be null.")); + } + if (serverVulnerabilityAssessmentsSetting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter serverVulnerabilityAssessmentsSetting is required and cannot be null.")); + } else { + serverVulnerabilityAssessmentsSetting.validate(); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + settingKind, serverVulnerabilityAssessmentsSetting, accept, context); } /** @@ -503,37 +532,6 @@ private Mono> deleteWithResponseAsync(ServerVulnerabilityAssessme .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Delete the server vulnerability assessments setting of the requested kind from the subscription. - * - * @param settingKind The kind of the server vulnerability assessments 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(ServerVulnerabilityAssessmentsSettingKindName settingKind, - 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 (settingKind == null) { - 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); - } - /** * Delete the server vulnerability assessments setting of the requested kind from the subscription. * @@ -561,7 +559,24 @@ private Mono deleteAsync(ServerVulnerabilityAssessmentsSettingKindName set @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(ServerVulnerabilityAssessmentsSettingKindName settingKind, Context context) { - return deleteWithResponseAsync(settingKind, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingKind == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingKind is required and cannot be null.")); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingKind, + accept, context); } /** @@ -607,6 +622,34 @@ public void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind) { .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -615,23 +658,26 @@ 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 page of a server vulnerability assessments settings list along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ServerVulnerabilityAssessmentsSettingsClientImpl.class); } 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..b8796c1b3130 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 @@ -27,6 +27,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SettingsClient; import com.azure.resourcemanager.security.fluent.models.SettingInner; import com.azure.resourcemanager.security.models.SettingName; @@ -72,6 +73,14 @@ 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/settings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/settings/{settingName}") @ExpectedResponses({ 200 }) @@ -80,6 +89,14 @@ Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") @ExpectedResponses({ 200 }) @@ -89,12 +106,28 @@ Mono> update(@HostParam("$host") String endpoint, @PathParam("settingName") SettingName settingName, @BodyParam("application/json") SettingInner setting, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") 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" }) @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -127,28 +160,13 @@ private Mono> listSinglePageAsync() { /** * 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}. + * @return subscription settings list as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -156,11 +174,26 @@ private Mono> listSinglePageAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subscription settings list as paginated response with {@link PagedFlux}. + * @return subscription settings list along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -170,12 +203,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subscription settings list as paginated response with {@link PagedFlux}. + * @return subscription settings list along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -187,7 +234,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -201,7 +248,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -234,36 +281,6 @@ private Mono> getWithResponseAsync(SettingName settingNam .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Settings of different configurations in Microsoft Defender for Cloud. - * - * @param settingName The name of the 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 kind of the security setting along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(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 (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 = "2022-05-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, accept, - context); - } - /** * Settings of different configurations in Microsoft Defender for Cloud. * @@ -290,7 +307,24 @@ private Mono getAsync(SettingName settingName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(SettingName settingName, Context context) { - return getWithResponseAsync(settingName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2022-05-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, + accept, context); } /** @@ -343,43 +377,6 @@ private Mono> updateWithResponseAsync(SettingName setting .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * updating settings about different configurations in Microsoft Defender for Cloud. - * - * @param settingName The name of the setting. - * @param setting 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 the kind of the security setting along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(SettingName settingName, SettingInner 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 = "2022-05-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, - setting, accept, context); - } - /** * updating settings about different configurations in Microsoft Defender for Cloud. * @@ -408,7 +405,30 @@ private Mono updateAsync(SettingName settingName, SettingInner set */ @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(SettingName settingName, SettingInner setting, Context context) { - return updateWithResponseAsync(settingName, setting, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (settingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (setting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter setting is required and cannot be null.")); + } else { + setting.validate(); + } + final String apiVersion = "2022-05-01"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), settingName, + setting, accept, context); } /** @@ -451,6 +471,32 @@ private Mono> listNextSinglePageAsync(String nextLin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -459,21 +505,24 @@ private Mono> listNextSinglePageAsync(String nextLin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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}. + * @return subscription settings list along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SettingsClientImpl.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareImpl.java new file mode 100644 index 000000000000..53f34853574e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; +import com.azure.resourcemanager.security.models.EndOfSupportStatus; +import com.azure.resourcemanager.security.models.Software; + +public final class SoftwareImpl implements Software { + private SoftwareInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + SoftwareImpl(SoftwareInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String deviceId() { + return this.innerModel().deviceId(); + } + + public String osPlatform() { + return this.innerModel().osPlatform(); + } + + public String vendor() { + return this.innerModel().vendor(); + } + + public String softwareName() { + return this.innerModel().softwareName(); + } + + public String version() { + return this.innerModel().version(); + } + + public EndOfSupportStatus endOfSupportStatus() { + return this.innerModel().endOfSupportStatus(); + } + + public String endOfSupportDate() { + return this.innerModel().endOfSupportDate(); + } + + public Integer numberOfKnownVulnerabilities() { + return this.innerModel().numberOfKnownVulnerabilities(); + } + + public String firstSeenAt() { + return this.innerModel().firstSeenAt(); + } + + public SoftwareInner 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/SoftwareInventoriesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java new file mode 100644 index 000000000000..40c081b42c9c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java @@ -0,0 +1,816 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SoftwareInventoriesClient; +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; +import com.azure.resourcemanager.security.models.SoftwaresList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SoftwareInventoriesClient. + */ +public final class SoftwareInventoriesClientImpl implements SoftwareInventoriesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SoftwareInventoriesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SoftwareInventoriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SoftwareInventoriesClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(SoftwareInventoriesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSoftwareInventories to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSoftwa") + public interface SoftwareInventoriesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories") + @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/softwareInventories") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByExtendedResourceSync(@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}/providers/Microsoft.Security/softwareInventories") + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @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/softwareInventories/{softwareName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, @PathParam("softwareName") String softwareName, + @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/softwareInventories/{softwareName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, + @PathParam("resourceName") String resourceName, @PathParam("softwareName") String softwareName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByExtendedResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByExtendedResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") 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, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceSinglePageAsync(String resourceGroupName, + String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByExtendedResource(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, resourceNamespace, resourceType, resourceName, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByExtendedResourceAsync(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName) { + return new PagedFlux<>(() -> listByExtendedResourceSinglePageAsync(resourceGroupName, resourceNamespace, + resourceType, resourceName), nextLink -> listByExtendedResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByExtendedResourceSinglePage(String resourceGroupName, + String resourceNamespace, String resourceType, String resourceName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + Response res + = service.listByExtendedResourceSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, resourceNamespace, resourceType, resourceName, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByExtendedResourceSinglePage(String resourceGroupName, + String resourceNamespace, String resourceType, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + Response res + = service.listByExtendedResourceSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, resourceNamespace, resourceType, resourceName, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName) { + return new PagedIterable<>( + () -> listByExtendedResourceSinglePage(resourceGroupName, resourceNamespace, resourceType, resourceName), + nextLink -> listByExtendedResourceNextSinglePage(nextLink)); + } + + /** + * Gets the software inventory of the virtual machine. + * + * @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 the software inventory of the virtual machine as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName, Context context) { + return new PagedIterable<>(() -> listByExtendedResourceSinglePage(resourceGroupName, resourceNamespace, + resourceType, resourceName, context), nextLink -> listByExtendedResourceNextSinglePage(nextLink, context)); + } + + /** + * Gets the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions 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-05-01-preview"; + 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 the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * Gets the software inventory of all virtual machines in 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 the software inventory of all virtual machines in the subscriptions as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Gets a single software data of the virtual machine. + * + * @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 softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName, String softwareName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (softwareName == null) { + return Mono.error(new IllegalArgumentException("Parameter softwareName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, softwareName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a single software data of the virtual machine. + * + * @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 softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String resourceNamespace, String resourceType, + String resourceName, String softwareName) { + return getWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a single software data of the virtual machine. + * + * @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 softwareName Name of the installed software. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName, String softwareName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceNamespace == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); + } + if (resourceType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (softwareName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter softwareName is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + resourceNamespace, resourceType, resourceName, softwareName, apiVersion, accept, context); + } + + /** + * Gets a single software data of the virtual machine. + * + * @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 softwareName Name of the installed software. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single software data of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SoftwareInner get(String resourceGroupName, String resourceNamespace, String resourceType, + String resourceName, String softwareName) { + return getWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName, + 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 represents the software inventory of the virtual machine along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByExtendedResourceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByExtendedResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByExtendedResourceNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByExtendedResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByExtendedResourceNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByExtendedResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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 represents the software inventory of the virtual machine 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the software inventory of the virtual machine along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SoftwareInventoriesClientImpl.class); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesImpl.java new file mode 100644 index 000000000000..277f1a9302d0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SoftwareInventoriesClient; +import com.azure.resourcemanager.security.fluent.models.SoftwareInner; +import com.azure.resourcemanager.security.models.Software; +import com.azure.resourcemanager.security.models.SoftwareInventories; + +public final class SoftwareInventoriesImpl implements SoftwareInventories { + private static final ClientLogger LOGGER = new ClientLogger(SoftwareInventoriesImpl.class); + + private final SoftwareInventoriesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SoftwareInventoriesImpl(SoftwareInventoriesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName) { + PagedIterable inner = this.serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, + String resourceType, String resourceName, Context context) { + PagedIterable inner = this.serviceClient() + .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SoftwareImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String resourceNamespace, String resourceType, + String resourceName, String softwareName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SoftwareImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Software get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, + String softwareName) { + SoftwareInner inner + = this.serviceClient().get(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName); + if (inner != null) { + return new SoftwareImpl(inner, this.manager()); + } else { + return null; + } + } + + private SoftwareInventoriesClient 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/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java new file mode 100644 index 000000000000..0f592fa0c762 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesClientImpl.java @@ -0,0 +1,686 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.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.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterSqlVul") + public interface SqlVulnerabilityAssessmentBaselineRulesService { + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("ruleId") String ruleId, @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @BodyParam("application/json") RuleResultsInput body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("ruleId") String ruleId, @QueryParam("workspaceId") String workspaceId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @BodyParam("application/json") RuleResultsInput body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, @PathParam("ruleId") String ruleId, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, @PathParam("ruleId") String ruleId, + @QueryParam("workspaceId") String workspaceId, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @PathParam("ruleId") String ruleId, + @QueryParam("workspaceId") String workspaceId, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @PathParam("ruleId") String ruleId, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> add(@HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @BodyParam("application/json") RulesResultsInput body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response addSync(@HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @BodyParam("application/json") RulesResultsInput body, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @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 ruleId, String workspaceId, + String resourceId, RuleResultsInput body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, + resourceId, body, accept, 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 ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 rule results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String ruleId, String workspaceId, String resourceId) { + final RuleResultsInput body = null; + return createOrUpdateWithResponseAsync(ruleId, workspaceId, resourceId, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @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 ruleId, String workspaceId, String resourceId, + RuleResultsInput body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, body, + accept, context); + } + + /** + * Creates a Baseline for a rule in a database. Will overwrite any previously existing results. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 rule results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RuleResultsInner createOrUpdate(String ruleId, String workspaceId, String resourceId) { + final RuleResultsInput body = null; + return createOrUpdateWithResponse(ruleId, workspaceId, resourceId, body, Context.NONE).getValue(); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 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 ruleId, String workspaceId, + String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the results for a given rule in the Baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String ruleId, String workspaceId, String resourceId) { + return getWithResponseAsync(ruleId, workspaceId, resourceId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the results for a given rule in the Baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String ruleId, String workspaceId, String resourceId, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets the results for a given rule in the Baseline. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the results for a given rule in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RuleResultsInner get(String ruleId, String workspaceId, String resourceId) { + return getWithResponse(ruleId, workspaceId, resourceId, Context.NONE).getValue(); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String ruleId, String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, + resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String ruleId, String workspaceId, String resourceId) { + return deleteWithResponseAsync(ruleId, workspaceId, resourceId).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String ruleId, String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (ruleId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), ruleId, workspaceId, apiVersion, resourceId, accept, + context); + } + + /** + * Deletes a rule from the Baseline of a given database. + * + * @param ruleId The rule Id. + * @param workspaceId The workspace Id. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String ruleId, String workspaceId, String resourceId) { + deleteWithResponse(ruleId, workspaceId, resourceId, Context.NONE); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @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 the results for all rules in the Baseline along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.list(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @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 the results for all rules in the Baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String workspaceId, String resourceId) { + return listWithResponseAsync(workspaceId, resourceId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @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 the results for all rules in the Baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets the results for all rules in the Baseline. + * + * @param workspaceId The workspace Id. + * @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 the results for all rules in the Baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RulesResultsInner list(String workspaceId, String resourceId) { + return listWithResponse(workspaceId, resourceId, Context.NONE).getValue(); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 workspaceId, String resourceId, + RulesResultsInput body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.add(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, body, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @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 a list of rules results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addAsync(String workspaceId, String resourceId) { + final RulesResultsInput body = null; + return addWithResponseAsync(workspaceId, resourceId, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @param resourceId The identifier of the resource. + * @param body The baseline rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 workspaceId, String resourceId, RulesResultsInput body, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.addSync(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, body, accept, context); + } + + /** + * Add a list of baseline rules. Will overwrite any previously existing results (for all rules). + * + * @param workspaceId The workspace Id. + * @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 a list of rules results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RulesResultsInner add(String workspaceId, String resourceId) { + final RulesResultsInput body = null; + return addWithResponse(workspaceId, resourceId, body, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER + = new ClientLogger(SqlVulnerabilityAssessmentBaselineRulesClientImpl.class); +} 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..350e1af599c1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentBaselineRulesImpl.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 ruleId, String workspaceId, String resourceId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(ruleId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RuleResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RuleResults get(String ruleId, String workspaceId, String resourceId) { + RuleResultsInner inner = this.serviceClient().get(ruleId, workspaceId, resourceId); + if (inner != null) { + return new RuleResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String ruleId, String workspaceId, String resourceId, Context context) { + return this.serviceClient().deleteWithResponse(ruleId, workspaceId, resourceId, context); + } + + public void delete(String ruleId, String workspaceId, String resourceId) { + this.serviceClient().delete(ruleId, workspaceId, resourceId); + } + + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + Response inner = this.serviceClient().listWithResponse(workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RulesResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RulesResults list(String workspaceId, String resourceId) { + RulesResultsInner inner = this.serviceClient().list(workspaceId, resourceId); + if (inner != null) { + return new RulesResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response addWithResponse(String workspaceId, String resourceId, RulesResultsInput body, + Context context) { + Response inner + = this.serviceClient().addWithResponse(workspaceId, resourceId, body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RulesResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RulesResults add(String workspaceId, String resourceId) { + RulesResultsInner inner = this.serviceClient().add(workspaceId, resourceId); + if (inner != null) { + return new RulesResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + 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/SqlVulnerabilityAssessmentScanResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsClientImpl.java new file mode 100644 index 000000000000..245d8f6eaa24 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsClientImpl.java @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; +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("{$host}") + @ServiceInterface(name = "SecurityCenterSqlVul") + 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("$host") String endpoint, @PathParam("scanId") String scanId, + @PathParam("scanResultId") String scanResultId, @QueryParam("workspaceId") String workspaceId, + @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/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, @PathParam("scanId") String scanId, + @PathParam("scanResultId") String scanResultId, @QueryParam("workspaceId") String workspaceId, + @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/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, @PathParam("scanId") String scanId, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, @PathParam("scanId") String scanId, + @QueryParam("workspaceId") String workspaceId, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @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 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 workspaceId, + String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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 (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), scanId, scanResultId, workspaceId, + apiVersion, resourceId, 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. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @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 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 workspaceId, String resourceId) { + return getWithResponseAsync(scanId, scanResultId, workspaceId, resourceId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @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 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 workspaceId, + String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), scanId, scanResultId, workspaceId, apiVersion, resourceId, + accept, context); + } + + /** + * Gets the scan results of a single rule in a scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param scanResultId The rule Id of the results. + * @param workspaceId The workspace Id. + * @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 the scan results of a single rule in a scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanResultInner get(String scanId, String scanResultId, String workspaceId, String resourceId) { + return getWithResponse(scanId, scanResultId, workspaceId, resourceId, Context.NONE).getValue(); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @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 a list of scan results for a single scan record along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String scanId, String workspaceId, + String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, + accept, context)) + .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. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @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 a list of scan results for a single scan record on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String scanId, String workspaceId, String resourceId) { + return listWithResponseAsync(scanId, workspaceId, resourceId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @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 a list of scan results for a single scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String scanId, String workspaceId, String resourceId, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, accept, + context); + } + + /** + * Gets a list of scan results for a single scan record. + * + * @param scanId The scan Id. Type 'latest' to get the scan results for the latest scan. + * @param workspaceId The workspace Id. + * @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 a list of scan results for a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanResultsInner list(String scanId, String workspaceId, String resourceId) { + return listWithResponse(scanId, workspaceId, resourceId, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentScanResultsClientImpl.class); +} 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..ac44a1c6049b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.security.fluent.models.ScanResultInner; +import com.azure.resourcemanager.security.fluent.models.ScanResultsInner; +import com.azure.resourcemanager.security.models.ScanResult; +import com.azure.resourcemanager.security.models.ScanResults; +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 workspaceId, + String resourceId, Context context) { + Response inner + = this.serviceClient().getWithResponse(scanId, scanResultId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScanResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScanResult get(String scanId, String scanResultId, String workspaceId, String resourceId) { + ScanResultInner inner = this.serviceClient().get(scanId, scanResultId, workspaceId, resourceId); + if (inner != null) { + return new ScanResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String scanId, String workspaceId, String resourceId, + Context context) { + Response inner + = this.serviceClient().listWithResponse(scanId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScanResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScanResults list(String scanId, String workspaceId, String resourceId) { + ScanResultsInner inner = this.serviceClient().list(scanId, workspaceId, resourceId); + if (inner != null) { + return new ScanResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + 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..471236734ff5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; +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("{$host}") + @ServiceInterface(name = "SecurityCenterSqlVul") + public interface SqlVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, @PathParam("scanId") String scanId, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/scans/{scanId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, @PathParam("scanId") String scanId, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/scans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, @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/sqlVulnerabilityAssessments/default/scans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("workspaceId") String workspaceId, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, @HeaderParam("Accept") String accept, + 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 workspaceId The workspace Id. + * @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 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 workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, + 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 workspaceId The workspace Id. + * @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 the scan details of a single scan record on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scanId, String workspaceId, String resourceId) { + return getWithResponseAsync(scanId, workspaceId, resourceId).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 workspaceId The workspace Id. + * @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 the scan details of a single scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scanId, String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), scanId, workspaceId, apiVersion, resourceId, 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 workspaceId The workspace Id. + * @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 the scan details of a single scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScanInner get(String scanId, String workspaceId, String resourceId) { + return getWithResponse(scanId, workspaceId, resourceId, Context.NONE).getValue(); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @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 a list of scan records along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String workspaceId, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceId 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 = "2023-02-01-preview"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.list(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @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 a list of scan records on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String workspaceId, String resourceId) { + return listWithResponseAsync(workspaceId, resourceId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @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 a list of scan records along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (workspaceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceId is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2023-02-01-preview"; + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), workspaceId, apiVersion, resourceId, accept, context); + } + + /** + * Gets a list of scan records. + * + * @param workspaceId The workspace Id. + * @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 a list of scan records. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScansInner list(String workspaceId, String resourceId) { + return listWithResponse(workspaceId, resourceId, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentScansClientImpl.class); +} 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..a5c3bb15481a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SqlVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.models.ScanInner; +import com.azure.resourcemanager.security.fluent.models.ScansInner; +import com.azure.resourcemanager.security.models.Scan; +import com.azure.resourcemanager.security.models.Scans; +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 Response getWithResponse(String scanId, String workspaceId, String resourceId, Context context) { + Response inner = this.serviceClient().getWithResponse(scanId, workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Scan get(String scanId, String workspaceId, String resourceId) { + ScanInner inner = this.serviceClient().get(scanId, workspaceId, resourceId); + if (inner != null) { + return new ScanImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String workspaceId, String resourceId, Context context) { + Response inner = this.serviceClient().listWithResponse(workspaceId, resourceId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScansImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Scans list(String workspaceId, String resourceId) { + ScansInner inner = this.serviceClient().list(workspaceId, resourceId); + if (inner != null) { + return new ScansImpl(inner, this.manager()); + } else { + return null; + } + } + + 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/StandardAssignmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsClientImpl.java index 796a9c6fb278..3907a0aa62eb 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 @@ -28,6 +28,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.StandardAssignmentsClient; import com.azure.resourcemanager.security.fluent.models.StandardAssignmentInner; import com.azure.resourcemanager.security.models.StandardAssignmentsList; @@ -74,6 +75,15 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("standardAssignmentName") String standardAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("standardAssignmentName") String standardAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") @ExpectedResponses({ 200, 201 }) @@ -85,6 +95,17 @@ Mono> create(@HostParam("$host") String endpoi @BodyParam("application/json") StandardAssignmentInner standardAssignment, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("standardAssignmentName") String standardAssignmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StandardAssignmentInner standardAssignment, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") @ExpectedResponses({ 200, 204 }) @@ -94,6 +115,15 @@ Mono> delete(@HostParam("$host") String endpoint, @PathParam("standardAssignmentName") String standardAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("standardAssignmentName") String standardAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/{scope}/providers/Microsoft.Security/standardAssignments") @ExpectedResponses({ 200 }) @@ -102,12 +132,27 @@ 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/standardAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -145,40 +190,6 @@ private Mono> getWithResponseAsync(String reso .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Retrieves a standard assignment. - * - * This operation retrieves a single standard assignment, given its name and the scope it was created at. - * - * @param resourceId The identifier of the resource. - * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return security Assignment on a resource group over a given scope along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceId, - String standardAssignmentName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceId == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); - } - if (standardAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, accept, context); - } - /** * Retrieves a standard assignment. * @@ -213,7 +224,23 @@ private Mono getAsync(String resourceId, String standar @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceId, String standardAssignmentName, Context context) { - return getWithResponseAsync(resourceId, standardAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, accept, + context); } /** @@ -277,50 +304,6 @@ private Mono> createWithResponseAsync(String r .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Creates or updates a standard assignment. - * - * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply - * to all resources contained within their scope. For example, when you assign a policy at resource group scope, - * that policy applies to all resources in the group. - * - * @param resourceId The identifier of the resource. - * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. - * @param standardAssignment Custom standard assignment over a pre-defined scope. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return security Assignment on a resource group over a given scope along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createWithResponseAsync(String resourceId, - String standardAssignmentName, StandardAssignmentInner standardAssignment, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceId == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); - } - if (standardAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); - } - if (standardAssignment == null) { - return Mono - .error(new IllegalArgumentException("Parameter standardAssignment is required and cannot be null.")); - } else { - standardAssignment.validate(); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, - standardAssignment, accept, context); - } - /** * Creates or updates a standard assignment. * @@ -362,7 +345,29 @@ private Mono createAsync(String resourceId, String stan @ServiceMethod(returns = ReturnType.SINGLE) public Response createWithResponse(String resourceId, String standardAssignmentName, StandardAssignmentInner standardAssignment, Context context) { - return createWithResponseAsync(resourceId, standardAssignmentName, standardAssignment, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + if (standardAssignment == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standardAssignment is required and cannot be null.")); + } else { + standardAssignment.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, + standardAssignment, accept, context); } /** @@ -421,42 +426,6 @@ private Mono> deleteWithResponseAsync(String resourceId, String s .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a standard assignment. - * - * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a - * standard assignment is the part of its ID preceding - * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. - * - * @param resourceId The identifier of the resource. - * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceId, String standardAssignmentName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceId == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); - } - if (standardAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); - } - final String apiVersion = "2024-08-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, accept, - context); - } - /** * Deletes a standard assignment. * @@ -493,7 +462,23 @@ private Mono deleteAsync(String resourceId, String standardAssignmentName) */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceId, String standardAssignmentName, Context context) { - return deleteWithResponseAsync(resourceId, standardAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, accept, + context); } /** @@ -552,28 +537,14 @@ private Mono> listSinglePageAsync(String * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: * 'subscriptions/{subscriptionId}'), or security connector (format: * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of all relevant standard assignments over a scope along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a list of all relevant standard assignments over a scope as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -586,11 +557,24 @@ private Mono> listSinglePageAsync(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 a list of all relevant standard assignments over a scope as paginated response with {@link PagedFlux}. + * @return a list of all relevant standard assignments over a scope along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String scope) { - return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -604,12 +588,24 @@ private PagedFlux listAsync(String 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 list of all relevant standard assignments over a scope as paginated response with {@link PagedFlux}. + * @return a list of all relevant standard assignments over a scope along with {@link PagedResponse}. */ - @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) + private PagedResponse listSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -627,7 +623,7 @@ private PagedFlux listAsync(String scope, Context conte */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope) { - return new PagedIterable<>(listAsync(scope)); + return new PagedIterable<>(() -> listSinglePage(scope), nextLink -> listNextSinglePage(nextLink)); } /** @@ -646,7 +642,8 @@ public PagedIterable list(String scope) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String scope, Context context) { - return new PagedIterable<>(listAsync(scope, context)); + return new PagedIterable<>(() -> listSinglePage(scope, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -675,6 +672,33 @@ private Mono> listNextSinglePageAsync(Str .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -683,22 +707,25 @@ 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 page of a standard assignment list along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(StandardAssignmentsClientImpl.class); } 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..c49939ce5f32 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java @@ -0,0 +1,720 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterSubAss") + public interface SubAssessmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/subAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAll(@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("/{scope}/providers/Microsoft.Security/subAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllSync(@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("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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/assessments/{assessmentName}/subAssessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") 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/assessments/{assessmentName}/subAssessments/{subAssessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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/{subAssessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") 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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") 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("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription 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 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 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 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 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 sub-assessments on all your scanned resources inside a subscription scope along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllSinglePage(String scope) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listAllSync(this.client.getEndpoint(), apiVersion, scope, accept, Context.NONE); + return 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 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 sub-assessments on all your scanned resources inside a subscription scope along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllSinglePage(String scope, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listAllSync(this.client.getEndpoint(), apiVersion, scope, accept, context); + return 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 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 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<>(() -> listAllSinglePage(scope), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Get security sub-assessments on all your scanned resources inside a subscription 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 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<>(() -> listAllSinglePage(scope, context), + nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Get security sub-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 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. + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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. + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, String assessmentName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, Context.NONE); + return 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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String scope, String assessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, scope, assessmentName, accept, context); + return 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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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. + * @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<>(() -> listSinglePage(scope, assessmentName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get security sub-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 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. + * @throws 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<>(() -> listSinglePage(scope, assessmentName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The 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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The 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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (assessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter assessmentName is required and cannot be null.")); + } + if (subAssessmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subAssessmentName is required and cannot be null.")); + } + final String apiVersion = "2019-01-01-preview"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), apiVersion, scope, assessmentName, subAssessmentName, accept, + context); + } + + /** + * Get a security sub-assessment on your scanned resource. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @param assessmentName The 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 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 sub-assessments 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sub-assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sub-assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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 sub-assessments 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sub-assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sub-assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SubAssessmentsClientImpl.class); +} 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..65469f631ba7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + 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 Response getWithResponse(String scope, String assessmentName, + String subAssessmentName, Context context) { + Response inner + = this.serviceClient().getWithResponse(scope, assessmentName, subAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecuritySubAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + } + + 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..9a7c6d7c21dc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java @@ -0,0 +1,1515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.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.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("{$host}") + @ServiceInterface(name = "SecurityCenterTasks") + public interface TasksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks") + @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}/providers/Microsoft.Security/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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}/providers/Microsoft.Security/locations/{ascLocation}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHomeRegion(@HostParam("$host") 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({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByHomeRegionSync(@HostParam("$host") 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({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionLevelTask(@HostParam("$host") 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/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSubscriptionLevelTaskSync(@HostParam("$host") 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" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateSubscriptionLevelTaskState(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @PathParam("taskName") String taskName, + @PathParam("taskUpdateActionType") TaskUpdateActionType taskUpdateActionType, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSubscriptionLevelTaskStateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("ascLocation") String ascLocation, @PathParam("taskName") String taskName, + @PathParam("taskUpdateActionType") TaskUpdateActionType taskUpdateActionType, + @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("$host") 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({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("$host") 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({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResourceGroupLevelTask(@HostParam("$host") 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/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getResourceGroupLevelTaskSync(@HostParam("$host") 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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateResourceGroupLevelTaskState(@HostParam("$host") 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, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateResourceGroupLevelTaskStateSync(@HostParam("$host") 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, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") 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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByHomeRegionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") 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, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), filter, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), filter, accept, context); + return 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. + * + * @throws ManagementException thrown 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<>(() -> listSinglePage(filter), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(() -> listSinglePage(filter, context), + nextLink -> listNextSinglePage(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. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation, String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, filter, accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation, String filter, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, filter, accept, context); + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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<>(() -> listByHomeRegionSinglePage(ascLocation, filter), + nextLink -> listByHomeRegionNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHomeRegion(String ascLocation, String filter, Context context) { + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation, filter, context), + nextLink -> listByHomeRegionNextSinglePage(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. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return service.getSubscriptionLevelTaskSync(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. + */ + @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 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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.updateSubscriptionLevelTaskState(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, taskName, taskUpdateActionType, 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return service.updateSubscriptionLevelTaskStateSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), ascLocation, taskName, taskUpdateActionType, 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. + * @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 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 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 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 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 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 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 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 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, String ascLocation, + String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, filter, accept, Context.NONE); + return 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 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 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, String ascLocation, + String filter, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, filter, accept, context); + return 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 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 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<>(() -> listByResourceGroupSinglePage(resourceGroupName, ascLocation, filter), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @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 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<>(() -> listByResourceGroupSinglePage(resourceGroupName, ascLocation, filter, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @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 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 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 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 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return service.getResourceGroupLevelTaskSync(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 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 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 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 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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.updateResourceGroupLevelTaskState(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, taskName, taskUpdateActionType, 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 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 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 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 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (taskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter taskName is required and cannot be null.")); + } + if (taskUpdateActionType == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter taskUpdateActionType is required and cannot be null.")); + } + final String apiVersion = "2015-06-01-preview"; + final String accept = "application/json"; + return service.updateResourceGroupLevelTaskStateSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, ascLocation, taskName, taskUpdateActionType, accept, + context); + } + + /** + * Recommended tasks that will help improve the security of the subscription proactively. + * + * @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 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); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(TasksClientImpl.class); +} 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..45ea2b27801a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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())); + } + + 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 getSubscriptionLevelTaskWithResponse(String ascLocation, String taskName, + Context context) { + Response inner + = this.serviceClient().getSubscriptionLevelTaskWithResponse(ascLocation, taskName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityTaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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 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 getResourceGroupLevelTaskWithResponse(String resourceGroupName, String ascLocation, + String taskName, Context context) { + Response inner = this.serviceClient() + .getResourceGroupLevelTaskWithResponse(resourceGroupName, ascLocation, taskName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityTaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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); + } + + 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..326ce7369ad5 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 @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.TopologiesClient; import com.azure.resourcemanager.security.fluent.models.TopologyResourceInner; import com.azure.resourcemanager.security.models.TopologyList; @@ -70,6 +71,14 @@ Mono> list(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies") @ExpectedResponses({ 200 }) @@ -78,6 +87,14 @@ Mono> listByHomeRegion(@HostParam("$host") String endpoin @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, @QueryParam("api-version") String apiVersion, @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) + Response listByHomeRegionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}") @ExpectedResponses({ 200 }) @@ -88,6 +105,16 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("topologyResourceName") String topologyResourceName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -95,6 +122,13 @@ Mono> get(@HostParam("$host") String endpoint, Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -102,6 +136,13 @@ Mono> listNext(@PathParam(value = "nextLink", encoded = t Mono> listByHomeRegionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByHomeRegionNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -135,29 +176,14 @@ private Mono> listSinglePageAsync() { /** * 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 list that allows to build a topology view of a subscription along with {@link PagedResponse} 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> 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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -165,12 +191,26 @@ private Mono> listSinglePageAsync(Context c * * @throws ManagementException thrown 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 list that allows to build a topology view of a subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -180,13 +220,26 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list that allows to build a topology view of a subscription as paginated response with - * {@link PagedFlux}. + * @return a list that allows to build a topology view of a subscription along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -199,7 +252,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -214,7 +267,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -256,35 +309,16 @@ private Mono> listByHomeRegionSinglePageAsy * * @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 a list that allows to build a topology view of a subscription and location 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 as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionSinglePageAsync(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 = "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) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHomeRegionAsync(String ascLocation) { + return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), + nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); } /** @@ -295,13 +329,31 @@ private Mono> listByHomeRegionSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 and location as paginated response with - * {@link PagedFlux}. + * @return a list that allows to build a topology view of a subscription and location along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -313,13 +365,31 @@ private PagedFlux listByHomeRegionAsync(String ascLocatio * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 and location as paginated response with - * {@link PagedFlux}. + * @return a list that allows to build a topology view of a subscription and location along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByHomeRegionAsync(String ascLocation, Context context) { - return new PagedFlux<>(() -> listByHomeRegionSinglePageAsync(ascLocation, context), - nextLink -> listByHomeRegionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionSinglePage(String ascLocation, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + Response res = service.listByHomeRegionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), ascLocation, apiVersion, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -335,7 +405,8 @@ private PagedFlux listByHomeRegionAsync(String ascLocatio */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation), + nextLink -> listByHomeRegionNextSinglePage(nextLink)); } /** @@ -352,7 +423,8 @@ public PagedIterable listByHomeRegion(String ascLocation) */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByHomeRegion(String ascLocation, Context context) { - return new PagedIterable<>(listByHomeRegionAsync(ascLocation, context)); + return new PagedIterable<>(() -> listByHomeRegionSinglePage(ascLocation, context), + nextLink -> listByHomeRegionNextSinglePage(nextLink, context)); } /** @@ -398,49 +470,6 @@ private Mono> getWithResponseAsync(String resour .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a specific topology component. - * - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - 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.")); - } - 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 (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); - } - /** * Gets a specific topology component. * @@ -478,7 +507,32 @@ private Mono getAsync(String resourceGroupName, String as @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String ascLocation, String topologyResourceName, Context context) { - return getWithResponseAsync(resourceGroupName, ascLocation, topologyResourceName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ascLocation == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); + } + if (topologyResourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter topologyResourceName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + ascLocation, topologyResourceName, apiVersion, accept, context); } /** @@ -524,6 +578,32 @@ private Mono> listNextSinglePageAsync(Strin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -532,22 +612,23 @@ 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 the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -576,6 +657,33 @@ private Mono> listByHomeRegionNextSinglePag .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByHomeRegionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -584,22 +692,25 @@ 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 the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByHomeRegionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByHomeRegionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByHomeRegionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(TopologiesClientImpl.class); } 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..3b0eedc50427 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingImpl.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +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 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..ac8956573069 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java @@ -0,0 +1,799 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +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.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("{$host}") + @ServiceInterface(name = "SecurityCenterWorksp") + public interface WorkspaceSettingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings") + @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/workspaceSettings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, + @BodyParam("application/json") WorkspaceSettingInner workspaceSetting, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceSettingName") String workspaceSettingName, @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") 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. + * + * @throws ManagementException thrown 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. + * + * @throws ManagementException thrown 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. + * + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), accept, Context.NONE); + return 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(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. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.getSync(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. + */ + @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), workspaceSettingName, workspaceSetting, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + workspaceSettingName, workspaceSetting, accept, 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. + */ + @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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), workspaceSettingName, workspaceSetting, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + if (workspaceSetting == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceSetting is required and cannot be null.")); + } else { + workspaceSetting.validate(); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + workspaceSettingName, workspaceSetting, accept, 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. + */ + @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"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), workspaceSettingName, accept, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (workspaceSettingName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter workspaceSettingName is required and cannot be null.")); + } + final String apiVersion = "2017-08-01-preview"; + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + workspaceSettingName, accept, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String workspaceSettingName) { + deleteWithResponse(workspaceSettingName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceSettingsClientImpl.class); +} 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..766cb1dcc73e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.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 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 Response getWithResponse(String workspaceSettingName, Context context) { + Response inner = this.serviceClient().getWithResponse(workspaceSettingName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceSettingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 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/AccessTokenAuthentication.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AccessTokenAuthentication.java new file mode 100644 index 000000000000..5b7c5a7bdb15 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AccessTokenAuthentication.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The environment authentication details. + */ +@Fluent +public final class AccessTokenAuthentication extends Authentication { + /* + * The authentication type + */ + private AuthenticationType authenticationType = AuthenticationType.fromString("AccessToken"); + + /* + * The user name that will be used while authenticating with the onboarded environment + */ + private String username; + + /* + * The access token that will be used while authenticating with the onboarded environment + */ + private String accessToken; + + /** + * Creates an instance of AccessTokenAuthentication class. + */ + public AccessTokenAuthentication() { + } + + /** + * Get the authenticationType property: The authentication type. + * + * @return the authenticationType value. + */ + @Override + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Get the username property: The user name that will be used while authenticating with the onboarded environment. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name that will be used while authenticating with the onboarded environment. + * + * @param username the username value to set. + * @return the AccessTokenAuthentication object itself. + */ + public AccessTokenAuthentication withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the accessToken property: The access token that will be used while authenticating with the onboarded + * environment. + * + * @return the accessToken value. + */ + public String accessToken() { + return this.accessToken; + } + + /** + * Set the accessToken property: The access token that will be used while authenticating with the onboarded + * environment. + * + * @param accessToken the accessToken value to set. + * @return the AccessTokenAuthentication object itself. + */ + public AccessTokenAuthentication withAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("accessToken", this.accessToken); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccessTokenAuthentication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccessTokenAuthentication if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AccessTokenAuthentication. + */ + public static AccessTokenAuthentication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccessTokenAuthentication deserializedAccessTokenAuthentication = new AccessTokenAuthentication(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationType".equals(fieldName)) { + deserializedAccessTokenAuthentication.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("username".equals(fieldName)) { + deserializedAccessTokenAuthentication.username = reader.getString(); + } else if ("accessToken".equals(fieldName)) { + deserializedAccessTokenAuthentication.accessToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAccessTokenAuthentication; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java new file mode 100644 index 000000000000..219685a9c196 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Static value LogicApp for ActionType. + */ + public static final ActionType LOGIC_APP = fromString("LogicApp"); + + /** + * Static value EventHub for ActionType. + */ + public static final ActionType EVENT_HUB = fromString("EventHub"); + + /** + * Static value Workspace for ActionType. + */ + public static final ActionType WORKSPACE = fromString("Workspace"); + + /** + * 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..fe65667d6f03 --- /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) 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; +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..b91d0c146a17 --- /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) AutoRest 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 { + /** + * Static value None for ActionableRemediationState. + */ + public static final ActionableRemediationState NONE = fromString("None"); + + /** + * Static value Disabled for ActionableRemediationState. + */ + public static final ActionableRemediationState DISABLED = fromString("Disabled"); + + /** + * Static value Enabled for ActionableRemediationState. + */ + 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/AdditionalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java new file mode 100644 index 000000000000..b24352cd743f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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. + */ + public 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/AgentlessConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AgentlessConfiguration.java new file mode 100644 index 000000000000..1e66bca82a70 --- /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) 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; +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..0663bf818b92 --- /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) AutoRest 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 { + /** + * Static value Disabled for AgentlessEnablement. + */ + public static final AgentlessEnablement DISABLED = fromString("Disabled"); + + /** + * Static value Enabled for AgentlessEnablement. + */ + public static final AgentlessEnablement ENABLED = fromString("Enabled"); + + /** + * Static value NotApplicable for AgentlessEnablement. + */ + 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/AlertsSuppressionRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java new file mode 100644 index 000000000000..84cf7a11c1b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRule.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.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 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..dba56aff33f4 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; + +/** + * Resource collection API of AlertsSuppressionRules. + */ +public interface AlertsSuppressionRules { + /** + * 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); + + /** + * 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); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java new file mode 100644 index 000000000000..ff81c7d5c1e4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java @@ -0,0 +1,124 @@ +// 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.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. + */ +@Fluent +public final class AlertsSuppressionRulesList implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /* + * URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of AlertsSuppressionRulesList class. + */ + public AlertsSuppressionRulesList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the AlertsSuppressionRulesList object itself. + */ + public AlertsSuppressionRulesList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: 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) { + 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)); + 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/AnnotateDefaultBranchState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AnnotateDefaultBranchState.java new file mode 100644 index 000000000000..96192d68cc63 --- /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) AutoRest 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 { + /** + * Static value Disabled for AnnotateDefaultBranchState. + */ + public static final AnnotateDefaultBranchState DISABLED = fromString("Disabled"); + + /** + * Static value Enabled for AnnotateDefaultBranchState. + */ + 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/Application.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Application.java new file mode 100644 index 000000000000..51f5fa4954de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Application.java @@ -0,0 +1,261 @@ +// 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.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 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/ApplicationOperations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationOperations.java new file mode 100644 index 000000000000..e5c4555d335d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationOperations.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ApplicationOperations. + */ +public interface ApplicationOperations { + /** + * 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 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/ApplicationSourceResourceType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationSourceResourceType.java new file mode 100644 index 000000000000..87904c28b573 --- /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) AutoRest 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 { + /** + * Static value Assessments for ApplicationSourceResourceType. + */ + 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..5efcf23b1b75 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Applications.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Applications. + */ +public interface Applications { + /** + * 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); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationsList.java new file mode 100644 index 000000000000..9f486a36b1b7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationsList.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.ApplicationInner; +import java.io.IOException; +import java.util.List; + +/** + * Page of a security applications list. + */ +@Immutable +public final class ApplicationsList 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. + */ + public 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/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..74041628fd65 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..1323e0ba9f73 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..e39dc247b4cc --- /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) 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; + +/** + * 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..15b2d496292c --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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/AscLocation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java new file mode 100644 index 000000000000..2b6a9cd03eba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocation.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.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 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/AscLocationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java new file mode 100644 index 000000000000..a53b03be2dbe --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import 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 { + /* + * The value property. + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of AscLocationList class. + */ + public AscLocationList() { + } + + /** + * Get the value property: The value property. + * + * @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/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..1627745d2c2b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java @@ -0,0 +1,57 @@ +// 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; + +/** + * Sub-assessment resource type. + */ +public final class AssessedResourceType extends ExpandableStringEnum { + /** + * Static value SqlServerVulnerability for AssessedResourceType. + */ + public static final AssessedResourceType SQL_SERVER_VULNERABILITY = fromString("SqlServerVulnerability"); + + /** + * Static value ContainerRegistryVulnerability for AssessedResourceType. + */ + public static final AssessedResourceType CONTAINER_REGISTRY_VULNERABILITY + = fromString("ContainerRegistryVulnerability"); + + /** + * Static value ServerVulnerability for AssessedResourceType. + */ + public static final AssessedResourceType SERVER_VULNERABILITY = fromString("ServerVulnerability"); + + /** + * 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/Authentication.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authentication.java new file mode 100644 index 000000000000..098f17e6dba8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authentication.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The environment authentication details. + */ +@Immutable +public class Authentication implements JsonSerializable { + /* + * The authentication type + */ + private AuthenticationType authenticationType = AuthenticationType.fromString("Authentication"); + + /** + * Creates an instance of Authentication class. + */ + public Authentication() { + } + + /** + * Get the authenticationType property: The authentication type. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Authentication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Authentication if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Authentication. + */ + public static Authentication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("authenticationType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AccessToken".equals(discriminatorValue)) { + return AccessTokenAuthentication.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Authentication fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Authentication deserializedAuthentication = new Authentication(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationType".equals(fieldName)) { + deserializedAuthentication.authenticationType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAuthentication; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java new file mode 100644 index 000000000000..5cb800e6c675 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Settings for cloud authentication management. + */ +@Immutable +public class AuthenticationDetailsProperties implements JsonSerializable { + /* + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. + */ + private AuthenticationType authenticationType = AuthenticationType.fromString("AuthenticationDetailsProperties"); + + /* + * State of the multi-cloud connector + */ + private AuthenticationProvisioningState authenticationProvisioningState; + + /* + * The permissions detected in the cloud account. + */ + private List grantedPermissions; + + /** + * Creates an instance of AuthenticationDetailsProperties class. + */ + public AuthenticationDetailsProperties() { + } + + /** + * Get the authenticationType property: Connect to your cloud account, for AWS use either account credentials or + * role-based authentication. For GCP use account organization credentials. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Get the authenticationProvisioningState property: State of the multi-cloud connector. + * + * @return the authenticationProvisioningState value. + */ + public AuthenticationProvisioningState authenticationProvisioningState() { + return this.authenticationProvisioningState; + } + + /** + * Set the authenticationProvisioningState property: State of the multi-cloud connector. + * + * @param authenticationProvisioningState the authenticationProvisioningState value to set. + * @return the AuthenticationDetailsProperties object itself. + */ + AuthenticationDetailsProperties + withAuthenticationProvisioningState(AuthenticationProvisioningState authenticationProvisioningState) { + this.authenticationProvisioningState = authenticationProvisioningState; + return this; + } + + /** + * Get the grantedPermissions property: The permissions detected in the cloud account. + * + * @return the grantedPermissions value. + */ + public List grantedPermissions() { + return this.grantedPermissions; + } + + /** + * Set the grantedPermissions property: The permissions detected in the cloud account. + * + * @param grantedPermissions the grantedPermissions value to set. + * @return the AuthenticationDetailsProperties object itself. + */ + AuthenticationDetailsProperties withGrantedPermissions(List grantedPermissions) { + this.grantedPermissions = grantedPermissions; + return this; + } + + /** + * Validates the instance. + * + * @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 AuthenticationDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AuthenticationDetailsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AuthenticationDetailsProperties. + */ + public static AuthenticationDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("authenticationType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("awsCreds".equals(discriminatorValue)) { + return AwsCredsAuthenticationDetailsProperties.fromJson(readerToUse.reset()); + } else if ("awsAssumeRole".equals(discriminatorValue)) { + return AwAssumeRoleAuthenticationDetailsProperties.fromJson(readerToUse.reset()); + } else if ("gcpCredentials".equals(discriminatorValue)) { + return GcpCredentialsDetailsProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AuthenticationDetailsProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AuthenticationDetailsProperties deserializedAuthenticationDetailsProperties + = new AuthenticationDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationType".equals(fieldName)) { + deserializedAuthenticationDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("authenticationProvisioningState".equals(fieldName)) { + deserializedAuthenticationDetailsProperties.authenticationProvisioningState + = AuthenticationProvisioningState.fromString(reader.getString()); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedAuthenticationDetailsProperties.grantedPermissions = grantedPermissions; + } else { + reader.skipChildren(); + } + } + + return deserializedAuthenticationDetailsProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java new file mode 100644 index 000000000000..a3582f57a36a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java @@ -0,0 +1,61 @@ +// 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; + +/** + * State of the multi-cloud connector. + */ +public final class AuthenticationProvisioningState extends ExpandableStringEnum { + /** + * Static value Valid for AuthenticationProvisioningState. + */ + public static final AuthenticationProvisioningState VALID = fromString("Valid"); + + /** + * Static value Invalid for AuthenticationProvisioningState. + */ + public static final AuthenticationProvisioningState INVALID = fromString("Invalid"); + + /** + * Static value Expired for AuthenticationProvisioningState. + */ + public static final AuthenticationProvisioningState EXPIRED = fromString("Expired"); + + /** + * Static value IncorrectPolicy for AuthenticationProvisioningState. + */ + public static final AuthenticationProvisioningState INCORRECT_POLICY = fromString("IncorrectPolicy"); + + /** + * Creates a new instance of AuthenticationProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AuthenticationProvisioningState() { + } + + /** + * Creates or finds a AuthenticationProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationProvisioningState. + */ + public static AuthenticationProvisioningState fromString(String name) { + return fromString(name, AuthenticationProvisioningState.class); + } + + /** + * Gets known AuthenticationProvisioningState values. + * + * @return known AuthenticationProvisioningState values. + */ + public static Collection values() { + return values(AuthenticationProvisioningState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java new file mode 100644 index 000000000000..79d4f8a7b934 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java @@ -0,0 +1,57 @@ +// 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; + +/** + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. + */ +public final class AuthenticationType extends ExpandableStringEnum { + /** + * Static value awsCreds for AuthenticationType. + */ + public static final AuthenticationType AWS_CREDS = fromString("awsCreds"); + + /** + * Static value awsAssumeRole for AuthenticationType. + */ + public static final AuthenticationType AWS_ASSUME_ROLE = fromString("awsAssumeRole"); + + /** + * Static value gcpCredentials for AuthenticationType. + */ + public static final AuthenticationType GCP_CREDENTIALS = fromString("gcpCredentials"); + + /** + * 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..4d9ff9d601a5 --- /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) 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; + +/** + * 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..47a6cc7c28b4 --- /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) AutoRest 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 { + /** + * Static value Disabled for AutoDiscovery. + */ + public static final AutoDiscovery DISABLED = fromString("Disabled"); + + /** + * Static value Enabled for AutoDiscovery. + */ + public static final AutoDiscovery ENABLED = fromString("Enabled"); + + /** + * Static value NotApplicable for AutoDiscovery. + */ + 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..df4cc349ef70 --- /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) AutoRest 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 { + /** + * Static value On for AutoProvision. + */ + public static final AutoProvision ON = fromString("On"); + + /** + * Static value Off for AutoProvision. + */ + 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..9925a34a0a57 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSetting.java @@ -0,0 +1,114 @@ +// 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.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 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/AutoProvisioningSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java new file mode 100644 index 000000000000..3907bc007f8b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the auto provisioning settings response. + */ +@Fluent +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. + */ + public AutoProvisioningSettingList() { + } + + /** + * Get the value property: List of all the auto provisioning settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of all the auto provisioning settings. + * + * @param value the value value to set. + * @return the AutoProvisioningSettingList object itself. + */ + public AutoProvisioningSettingList withValue(List value) { + this.value = value; + return this; + } + + /** + * 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/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..772fb6f8a28b --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of AutoProvisioningSettings. + */ +public interface AutoProvisioningSettings { + /** + * 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 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); + + /** + * 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/Automation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java new file mode 100644 index 000000000000..1e248cccbe54 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automation.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +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 location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * 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.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Automation definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Automation definition. + */ + interface Blank extends WithLocation { + } + + /** + * 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. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the Automation definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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.WithTags, 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 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 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..18a8278a61e6 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..fb33d6aa348f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..e754ac731116 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..aac427dd8151 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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/AutomationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java new file mode 100644 index 000000000000..ce35d45de9de --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java @@ -0,0 +1,122 @@ +// 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.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. + */ +@Fluent +public final class AutomationList implements JsonSerializable { + /* + * The list of security automations under the given scope. + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of AutomationList class. + */ + public AutomationList() { + } + + /** + * Get the value property: The list of security automations under the given scope. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of security automations under the given scope. + * + * @param value the value value to set. + * @return the AutomationList object itself. + */ + public AutomationList withValue(List value) { + this.value = value; + return this; + } + + /** + * 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) { + 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)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutomationList. + */ + public static AutomationList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationList deserializedAutomationList = new AutomationList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AutomationInner.fromJson(reader1)); + deserializedAutomationList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAutomationList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java new file mode 100644 index 000000000000..9f5b631de0cd --- /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) 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; +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..68d7321c912b --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A 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..12ef328c2f72 --- /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) 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; +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..a4621338eec8 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A 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..74d94bacaafb --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import 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..5aa5b623c85c --- /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) AutoRest 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..6b9a1155a828 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Automations.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.AutomationInner; + +/** + * Resource collection API of Automations. + */ +public interface Automations { + /** + * 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); + + /** + * 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 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 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 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 automations response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves information about the model of a security automation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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 within the user's subscription. 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); + + /** + * 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 within the user's subscription. 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 within the user's subscription. 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/AwAssumeRoleAuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java new file mode 100644 index 000000000000..95880a31e5f5 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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; + +/** + * AWS cloud account connector based assume role, the role enables delegating access to your AWS resources. The role is + * composed of role Amazon Resource Name (ARN) and external ID. For more details, refer to <a + * href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html">Creating a Role to Delegate + * Permissions to an IAM User (write only)</a>. + */ +@Fluent +public final class AwAssumeRoleAuthenticationDetailsProperties extends AuthenticationDetailsProperties { + /* + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. + */ + private AuthenticationType authenticationType = AuthenticationType.AWS_ASSUME_ROLE; + + /* + * The ID of the cloud account + */ + private String accountId; + + /* + * Assumed role ID is an identifier that you can use to create temporary security credentials. + */ + private String awsAssumeRoleArn; + + /* + * A unique identifier that is required when you assume a role in another account. + */ + private String awsExternalId; + + /** + * Creates an instance of AwAssumeRoleAuthenticationDetailsProperties class. + */ + public AwAssumeRoleAuthenticationDetailsProperties() { + } + + /** + * Get the authenticationType property: Connect to your cloud account, for AWS use either account credentials or + * role-based authentication. For GCP use account organization credentials. + * + * @return the authenticationType value. + */ + @Override + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Get the accountId property: The ID of the cloud account. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the awsAssumeRoleArn property: Assumed role ID is an identifier that you can use to create temporary security + * credentials. + * + * @return the awsAssumeRoleArn value. + */ + public String awsAssumeRoleArn() { + return this.awsAssumeRoleArn; + } + + /** + * Set the awsAssumeRoleArn property: Assumed role ID is an identifier that you can use to create temporary security + * credentials. + * + * @param awsAssumeRoleArn the awsAssumeRoleArn value to set. + * @return the AwAssumeRoleAuthenticationDetailsProperties object itself. + */ + public AwAssumeRoleAuthenticationDetailsProperties withAwsAssumeRoleArn(String awsAssumeRoleArn) { + this.awsAssumeRoleArn = awsAssumeRoleArn; + return this; + } + + /** + * Get the awsExternalId property: A unique identifier that is required when you assume a role in another account. + * + * @return the awsExternalId value. + */ + public String awsExternalId() { + return this.awsExternalId; + } + + /** + * Set the awsExternalId property: A unique identifier that is required when you assume a role in another account. + * + * @param awsExternalId the awsExternalId value to set. + * @return the AwAssumeRoleAuthenticationDetailsProperties object itself. + */ + public AwAssumeRoleAuthenticationDetailsProperties withAwsExternalId(String awsExternalId) { + this.awsExternalId = awsExternalId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (awsAssumeRoleArn() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property awsAssumeRoleArn in model AwAssumeRoleAuthenticationDetailsProperties")); + } + if (awsExternalId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property awsExternalId in model AwAssumeRoleAuthenticationDetailsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AwAssumeRoleAuthenticationDetailsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("awsAssumeRoleArn", this.awsAssumeRoleArn); + jsonWriter.writeStringField("awsExternalId", this.awsExternalId); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwAssumeRoleAuthenticationDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwAssumeRoleAuthenticationDetailsProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwAssumeRoleAuthenticationDetailsProperties. + */ + public static AwAssumeRoleAuthenticationDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwAssumeRoleAuthenticationDetailsProperties deserializedAwAssumeRoleAuthenticationDetailsProperties + = new AwAssumeRoleAuthenticationDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationProvisioningState".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.withAuthenticationProvisioningState( + AuthenticationProvisioningState.fromString(reader.getString())); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedAwAssumeRoleAuthenticationDetailsProperties.withGrantedPermissions(grantedPermissions); + } else if ("awsAssumeRoleArn".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.awsAssumeRoleArn = reader.getString(); + } else if ("awsExternalId".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.awsExternalId = reader.getString(); + } else if ("authenticationType".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("accountId".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.accountId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAwAssumeRoleAuthenticationDetailsProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java new file mode 100644 index 000000000000..a1149521222d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java @@ -0,0 +1,184 @@ +// 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; + +/** + * AWS cloud account connector based credentials, the credentials is composed of access key ID and secret key, for more + * details, refer to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">Creating an + * IAM User in Your AWS Account (write only)</a>. + */ +@Fluent +public final class AwsCredsAuthenticationDetailsProperties extends AuthenticationDetailsProperties { + /* + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. + */ + private AuthenticationType authenticationType = AuthenticationType.AWS_CREDS; + + /* + * The ID of the cloud account + */ + private String accountId; + + /* + * Public key element of the AWS credential object (write only) + */ + private String awsAccessKeyId; + + /* + * Secret key element of the AWS credential object (write only) + */ + private String awsSecretAccessKey; + + /** + * Creates an instance of AwsCredsAuthenticationDetailsProperties class. + */ + public AwsCredsAuthenticationDetailsProperties() { + } + + /** + * Get the authenticationType property: Connect to your cloud account, for AWS use either account credentials or + * role-based authentication. For GCP use account organization credentials. + * + * @return the authenticationType value. + */ + @Override + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Get the accountId property: The ID of the cloud account. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the awsAccessKeyId property: Public key element of the AWS credential object (write only). + * + * @return the awsAccessKeyId value. + */ + public String awsAccessKeyId() { + return this.awsAccessKeyId; + } + + /** + * Set the awsAccessKeyId property: Public key element of the AWS credential object (write only). + * + * @param awsAccessKeyId the awsAccessKeyId value to set. + * @return the AwsCredsAuthenticationDetailsProperties object itself. + */ + public AwsCredsAuthenticationDetailsProperties withAwsAccessKeyId(String awsAccessKeyId) { + this.awsAccessKeyId = awsAccessKeyId; + return this; + } + + /** + * Get the awsSecretAccessKey property: Secret key element of the AWS credential object (write only). + * + * @return the awsSecretAccessKey value. + */ + public String awsSecretAccessKey() { + return this.awsSecretAccessKey; + } + + /** + * Set the awsSecretAccessKey property: Secret key element of the AWS credential object (write only). + * + * @param awsSecretAccessKey the awsSecretAccessKey value to set. + * @return the AwsCredsAuthenticationDetailsProperties object itself. + */ + public AwsCredsAuthenticationDetailsProperties withAwsSecretAccessKey(String awsSecretAccessKey) { + this.awsSecretAccessKey = awsSecretAccessKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (awsAccessKeyId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property awsAccessKeyId in model AwsCredsAuthenticationDetailsProperties")); + } + if (awsSecretAccessKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property awsSecretAccessKey in model AwsCredsAuthenticationDetailsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AwsCredsAuthenticationDetailsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("awsAccessKeyId", this.awsAccessKeyId); + jsonWriter.writeStringField("awsSecretAccessKey", this.awsSecretAccessKey); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsCredsAuthenticationDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsCredsAuthenticationDetailsProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwsCredsAuthenticationDetailsProperties. + */ + public static AwsCredsAuthenticationDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsCredsAuthenticationDetailsProperties deserializedAwsCredsAuthenticationDetailsProperties + = new AwsCredsAuthenticationDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationProvisioningState".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.withAuthenticationProvisioningState( + AuthenticationProvisioningState.fromString(reader.getString())); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedAwsCredsAuthenticationDetailsProperties.withGrantedPermissions(grantedPermissions); + } else if ("awsAccessKeyId".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.awsAccessKeyId = reader.getString(); + } else if ("awsSecretAccessKey".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.awsSecretAccessKey = reader.getString(); + } else if ("authenticationType".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("accountId".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.accountId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsCredsAuthenticationDetailsProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsEnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsEnvironmentData.java new file mode 100644 index 000000000000..9fd3c91e8749 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +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..56b92e1a19ed --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..b4184946631c --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +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..1b9943d0a9ce --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..efd6f400d3ca --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Azure DevOps Organization properties. + * + * @return the properties value. + */ + AzureDevOpsOrgProperties properties(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.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..4c7dd6da52da --- /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) AutoRest 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: Gets or sets list of resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: Gets or sets next link to scroll over the results. + * + * @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..8827c31a012f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * 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..8da159b8e50e --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of AzureDevOpsOrgs. + */ +public interface AzureDevOpsOrgs { + /** + * 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 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 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 Azure DevOps organization 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 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 Azure DevOps organization 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 azure DevOps Organization resource. + */ + AzureDevOpsOrg get(String resourceGroupName, String securityConnectorName, String orgName); + + /** + * 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..c8b69c7bd227 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Azure DevOps Project properties. + * + * @return the properties value. + */ + AzureDevOpsProjectProperties properties(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.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 Azure DevOps organization name. + * @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/AzureDevOpsProjectListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectListResponse.java new file mode 100644 index 000000000000..5f1fa3e27758 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectListResponse.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsProjectInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class AzureDevOpsProjectListResponse implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of AzureDevOpsProjectListResponse class. + */ + public AzureDevOpsProjectListResponse() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the AzureDevOpsProjectListResponse object itself. + */ + public AzureDevOpsProjectListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the AzureDevOpsProjectListResponse object itself. + */ + public AzureDevOpsProjectListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsProjectListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsProjectListResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsProjectListResponse. + */ + public static AzureDevOpsProjectListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsProjectListResponse deserializedAzureDevOpsProjectListResponse + = new AzureDevOpsProjectListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AzureDevOpsProjectInner.fromJson(reader1)); + deserializedAzureDevOpsProjectListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAzureDevOpsProjectListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsProjectListResponse; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectProperties.java new file mode 100644 index 000000000000..8fd05fbfa7c4 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * 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..2b5f0629348a --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of AzureDevOpsProjects. + */ +public interface AzureDevOpsProjects { + /** + * 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 Azure DevOps organization 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, 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 Azure DevOps organization 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, String orgName, + 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 Azure DevOps organization name. + * @param projectName The project 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 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 Azure DevOps organization name. + * @param projectName The project 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 azure DevOps Project resource. + */ + AzureDevOpsProject get(String resourceGroupName, String securityConnectorName, String orgName, String projectName); + + /** + * 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..65f560c6266d --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of AzureDevOpsRepos. + */ +public interface AzureDevOpsRepos { + /** + * 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 Azure DevOps organization name. + * @param projectName The project 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, 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 Azure DevOps organization name. + * @param projectName The project 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, String orgName, + String projectName, 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 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 Azure DevOps organization name. + * @param projectName The project name. + * @param repoName The repository 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 azure DevOps Repository resource. + */ + AzureDevOpsRepository get(String resourceGroupName, String securityConnectorName, String orgName, + String projectName, String repoName); + + /** + * 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..7c3114d7c272 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.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 systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Azure DevOps Repository properties. + * + * @return the properties value. + */ + AzureDevOpsRepositoryProperties properties(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.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 Azure DevOps organization name. + * @param projectName The project name. + * @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/AzureDevOpsRepositoryListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryListResponse.java new file mode 100644 index 000000000000..eb3a14b095b9 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryListResponse.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.AzureDevOpsRepositoryInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class AzureDevOpsRepositoryListResponse implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of AzureDevOpsRepositoryListResponse class. + */ + public AzureDevOpsRepositoryListResponse() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the AzureDevOpsRepositoryListResponse object itself. + */ + public AzureDevOpsRepositoryListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the AzureDevOpsRepositoryListResponse object itself. + */ + public AzureDevOpsRepositoryListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsRepositoryListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsRepositoryListResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsRepositoryListResponse. + */ + public static AzureDevOpsRepositoryListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsRepositoryListResponse deserializedAzureDevOpsRepositoryListResponse + = new AzureDevOpsRepositoryListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AzureDevOpsRepositoryInner.fromJson(reader1)); + deserializedAzureDevOpsRepositoryListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAzureDevOpsRepositoryListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsRepositoryListResponse; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryProperties.java new file mode 100644 index 000000000000..391a5e339578 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * 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..1db212ca077b --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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/AzureTrackedResourceLocation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java new file mode 100644 index 000000000000..98f019768ba4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes an Azure resource with location. + */ +@Fluent +public class AzureTrackedResourceLocation implements JsonSerializable { + /* + * Location where the resource is stored + */ + private String location; + + /** + * Creates an instance of AzureTrackedResourceLocation class. + */ + public AzureTrackedResourceLocation() { + } + + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location where the resource is stored. + * + * @param location the location value to set. + * @return the AzureTrackedResourceLocation object itself. + */ + public AzureTrackedResourceLocation withLocation(String location) { + this.location = location; + 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("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureTrackedResourceLocation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureTrackedResourceLocation if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureTrackedResourceLocation. + */ + public static AzureTrackedResourceLocation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureTrackedResourceLocation deserializedAzureTrackedResourceLocation = new AzureTrackedResourceLocation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("location".equals(fieldName)) { + deserializedAzureTrackedResourceLocation.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureTrackedResourceLocation; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java new file mode 100644 index 000000000000..d37d31a3ef70 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Baseline details. + */ +@Fluent +public final class Baseline implements JsonSerializable { + /* + * Expected results. + */ + private List> expectedResults; + + /* + * Baseline update time (UTC). + */ + private OffsetDateTime updatedTime; + + /** + * Creates an instance of Baseline class. + */ + public Baseline() { + } + + /** + * Get the expectedResults property: Expected results. + * + * @return the expectedResults value. + */ + public List> expectedResults() { + return this.expectedResults; + } + + /** + * Set the expectedResults property: Expected results. + * + * @param expectedResults the expectedResults value to set. + * @return the Baseline object itself. + */ + public Baseline withExpectedResults(List> expectedResults) { + this.expectedResults = expectedResults; + return this; + } + + /** + * Get the updatedTime property: Baseline update time (UTC). + * + * @return the updatedTime value. + */ + public OffsetDateTime updatedTime() { + return this.updatedTime; + } + + /** + * Set the updatedTime property: Baseline update time (UTC). + * + * @param updatedTime the updatedTime value to set. + * @return the Baseline object itself. + */ + public Baseline withUpdatedTime(OffsetDateTime updatedTime) { + this.updatedTime = updatedTime; + 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.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..910e46c1aec0 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.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 rule result adjusted with baseline. + */ +@Fluent +public final class BaselineAdjustedResult implements JsonSerializable { + /* + * Baseline details. + */ + private Baseline baseline; + + /* + * The rule result status. + */ + private RuleStatus status; + + /* + * Results the are not in baseline. + */ + private List> resultsNotInBaseline; + + /* + * Results the are in baseline. + */ + private List> resultsOnlyInBaseline; + + /** + * Creates an instance of BaselineAdjustedResult class. + */ + public BaselineAdjustedResult() { + } + + /** + * Get the baseline property: Baseline details. + * + * @return the baseline value. + */ + public Baseline baseline() { + return this.baseline; + } + + /** + * Set the baseline property: Baseline details. + * + * @param baseline the baseline value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withBaseline(Baseline baseline) { + this.baseline = baseline; + return this; + } + + /** + * Get the status property: The rule result status. + * + * @return the status value. + */ + public RuleStatus status() { + return this.status; + } + + /** + * Set the status property: The rule result status. + * + * @param status the status value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withStatus(RuleStatus status) { + this.status = status; + return this; + } + + /** + * Get the resultsNotInBaseline property: Results the are not in baseline. + * + * @return the resultsNotInBaseline value. + */ + public List> resultsNotInBaseline() { + return this.resultsNotInBaseline; + } + + /** + * Set the resultsNotInBaseline property: Results the are not in baseline. + * + * @param resultsNotInBaseline the resultsNotInBaseline value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withResultsNotInBaseline(List> resultsNotInBaseline) { + this.resultsNotInBaseline = resultsNotInBaseline; + return this; + } + + /** + * Get the resultsOnlyInBaseline property: Results the are in baseline. + * + * @return the resultsOnlyInBaseline value. + */ + public List> resultsOnlyInBaseline() { + return this.resultsOnlyInBaseline; + } + + /** + * Set the resultsOnlyInBaseline property: Results the are in baseline. + * + * @param resultsOnlyInBaseline the resultsOnlyInBaseline value to set. + * @return the BaselineAdjustedResult object itself. + */ + public BaselineAdjustedResult withResultsOnlyInBaseline(List> resultsOnlyInBaseline) { + this.resultsOnlyInBaseline = resultsOnlyInBaseline; + return this; + } + + /** + * 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..c51fdc59c1b2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The benchmark references. + */ +@Fluent +public final class BenchmarkReference implements JsonSerializable { + /* + * The benchmark name. + */ + private String benchmark; + + /* + * The benchmark reference. + */ + private String reference; + + /** + * Creates an instance of BenchmarkReference class. + */ + public BenchmarkReference() { + } + + /** + * Get the benchmark property: The benchmark name. + * + * @return the benchmark value. + */ + public String benchmark() { + return this.benchmark; + } + + /** + * Set the benchmark property: The benchmark name. + * + * @param benchmark the benchmark value to set. + * @return the BenchmarkReference object itself. + */ + public BenchmarkReference withBenchmark(String benchmark) { + this.benchmark = benchmark; + return this; + } + + /** + * Get the reference property: The benchmark reference. + * + * @return the reference value. + */ + public String reference() { + return this.reference; + } + + /** + * Set the reference property: The benchmark reference. + * + * @param reference the reference value to set. + * @return the BenchmarkReference object itself. + */ + public BenchmarkReference withReference(String reference) { + this.reference = reference; + 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("benchmark", this.benchmark); + jsonWriter.writeStringField("reference", this.reference); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BenchmarkReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BenchmarkReference if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BenchmarkReference. + */ + public static BenchmarkReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BenchmarkReference deserializedBenchmarkReference = new BenchmarkReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("benchmark".equals(fieldName)) { + deserializedBenchmarkReference.benchmark = reader.getString(); + } else if ("reference".equals(fieldName)) { + deserializedBenchmarkReference.reference = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBenchmarkReference; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java new file mode 100644 index 000000000000..b16f0c4fa795 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A summary of the scan results of the blobs that were scanned. + */ +@Fluent +public final class BlobsScanSummary implements JsonSerializable { + /* + * The total number of blobs that were scanned. + */ + private Long totalBlobsScanned; + + /* + * The number of malicious blobs that were detected during the scan. + */ + private Long maliciousBlobsCount; + + /* + * The number of blobs that were skipped. + */ + private Long skippedBlobsCount; + + /* + * The number of failed blob scans. + */ + private Long failedBlobsCount; + + /* + * The number of gigabytes of data that were scanned. + */ + private Double scannedBlobsInGB; + + /** + * Creates an instance of BlobsScanSummary class. + */ + public BlobsScanSummary() { + } + + /** + * Get the totalBlobsScanned property: The total number of blobs that were scanned. + * + * @return the totalBlobsScanned value. + */ + public Long totalBlobsScanned() { + return this.totalBlobsScanned; + } + + /** + * Set the totalBlobsScanned property: The total number of blobs that were scanned. + * + * @param totalBlobsScanned the totalBlobsScanned value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withTotalBlobsScanned(Long totalBlobsScanned) { + this.totalBlobsScanned = totalBlobsScanned; + return this; + } + + /** + * Get the maliciousBlobsCount property: The number of malicious blobs that were detected during the scan. + * + * @return the maliciousBlobsCount value. + */ + public Long maliciousBlobsCount() { + return this.maliciousBlobsCount; + } + + /** + * Set the maliciousBlobsCount property: The number of malicious blobs that were detected during the scan. + * + * @param maliciousBlobsCount the maliciousBlobsCount value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withMaliciousBlobsCount(Long maliciousBlobsCount) { + this.maliciousBlobsCount = maliciousBlobsCount; + return this; + } + + /** + * Get the skippedBlobsCount property: The number of blobs that were skipped. + * + * @return the skippedBlobsCount value. + */ + public Long skippedBlobsCount() { + return this.skippedBlobsCount; + } + + /** + * Set the skippedBlobsCount property: The number of blobs that were skipped. + * + * @param skippedBlobsCount the skippedBlobsCount value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withSkippedBlobsCount(Long skippedBlobsCount) { + this.skippedBlobsCount = skippedBlobsCount; + return this; + } + + /** + * Get the failedBlobsCount property: The number of failed blob scans. + * + * @return the failedBlobsCount value. + */ + public Long failedBlobsCount() { + return this.failedBlobsCount; + } + + /** + * Set the failedBlobsCount property: The number of failed blob scans. + * + * @param failedBlobsCount the failedBlobsCount value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withFailedBlobsCount(Long failedBlobsCount) { + this.failedBlobsCount = failedBlobsCount; + return this; + } + + /** + * Get the scannedBlobsInGB property: The number of gigabytes of data that were scanned. + * + * @return the scannedBlobsInGB value. + */ + public Double scannedBlobsInGB() { + return this.scannedBlobsInGB; + } + + /** + * Set the scannedBlobsInGB property: The number of gigabytes of data that were scanned. + * + * @param scannedBlobsInGB the scannedBlobsInGB value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withScannedBlobsInGB(Double scannedBlobsInGB) { + this.scannedBlobsInGB = scannedBlobsInGB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("totalBlobsScanned", this.totalBlobsScanned); + jsonWriter.writeNumberField("maliciousBlobsCount", this.maliciousBlobsCount); + jsonWriter.writeNumberField("skippedBlobsCount", this.skippedBlobsCount); + jsonWriter.writeNumberField("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..876c026eb963 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BuiltInInfoType.java @@ -0,0 +1,152 @@ +// 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; +import java.util.Objects; +import java.util.UUID; + +/** + * Pre-configured sensitive information type. + */ +@Fluent +public final class BuiltInInfoType implements JsonSerializable { + /* + * Display name of the info type + */ + private String name; + + /* + * Id of the info type + */ + private UUID id; + + /* + * Category of the built-in info type + */ + private String type; + + /** + * Creates an instance of BuiltInInfoType class. + */ + public BuiltInInfoType() { + } + + /** + * Get the name property: Display name of the info type. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Display name of the info type. + * + * @param name the name value to set. + * @return the BuiltInInfoType object itself. + */ + public BuiltInInfoType withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id property: Id of the info type. + * + * @return the id value. + */ + public UUID id() { + return this.id; + } + + /** + * Set the id property: Id of the info type. + * + * @param id the id value to set. + * @return the BuiltInInfoType object itself. + */ + public BuiltInInfoType withId(UUID id) { + this.id = id; + return this; + } + + /** + * Get the type property: Category of the built-in info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Category of the built-in info type. + * + * @param type the type value to set. + * @return the BuiltInInfoType object itself. + */ + public BuiltInInfoType withType(String 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("name", this.name); + jsonWriter.writeStringField("id", Objects.toString(this.id, null)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BuiltInInfoType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BuiltInInfoType if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BuiltInInfoType. + */ + public static BuiltInInfoType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BuiltInInfoType deserializedBuiltInInfoType = new BuiltInInfoType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedBuiltInInfoType.name = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedBuiltInInfoType.id + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("type".equals(fieldName)) { + deserializedBuiltInInfoType.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBuiltInInfoType; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CategoryConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CategoryConfiguration.java new file mode 100644 index 000000000000..b52a6f04d65c --- /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) 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; + +/** + * 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/CloudName.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudName.java new file mode 100644 index 000000000000..f9a67c24f3f2 --- /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) AutoRest 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 { + /** + * Static value Azure for CloudName. + */ + public static final CloudName AZURE = fromString("Azure"); + + /** + * Static value AWS for CloudName. + */ + public static final CloudName AWS = fromString("AWS"); + + /** + * Static value GCP for CloudName. + */ + public static final CloudName GCP = fromString("GCP"); + + /** + * Static value Github for CloudName. + */ + public static final CloudName GITHUB = fromString("Github"); + + /** + * Static value AzureDevOps for CloudName. + */ + public static final CloudName AZURE_DEV_OPS = fromString("AzureDevOps"); + + /** + * Static value GitLab for CloudName. + */ + public static final CloudName GIT_LAB = fromString("GitLab"); + + /** + * Static value DockerHub for CloudName. + */ + public static final CloudName DOCKER_HUB = fromString("DockerHub"); + + /** + * Static value JFrog for CloudName. + */ + public static final CloudName JFROG = fromString("JFrog"); + + /** + * Creates a new instance of CloudName value. + * + * @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..d6ca88251798 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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/Compliance.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java new file mode 100644 index 000000000000..01358544b4d4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliance.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.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 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/ComplianceList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java new file mode 100644 index 000000000000..009d7add85ea --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.ComplianceInner; +import java.io.IOException; +import java.util.List; + +/** + * List of Compliance objects response. + */ +@Fluent +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. + */ + public ComplianceList() { + } + + /** + * Get the value property: List of Compliance objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Compliance objects. + * + * @param value the value value to set. + * @return the ComplianceList object itself. + */ + public ComplianceList withValue(List value) { + this.value = value; + return this; + } + + /** + * 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 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/ComplianceSegment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java new file mode 100644 index 000000000000..2d1131f322e3 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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. + */ + public 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..9bc6c3f347e1 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Compliances.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Compliances. + */ +public interface Compliances { + /** + * The Compliance scores of the specific management group. + * + * @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 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 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 list of Compliance objects response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope, Context context); + + /** + * Details of a specific Compliance. + * + * @param scope Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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 Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or + * management group (/providers/Microsoft.Management/managementGroups/mgName). + * @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); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSetting.java new file mode 100644 index 000000000000..0542d4b9ef65 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSetting.java @@ -0,0 +1,203 @@ +// 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.Context; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; + +/** + * An immutable client-side representation of ConnectorSetting. + */ +public interface ConnectorSetting { + /** + * 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 hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only + * for Arc autoProvision (Hybrid Compute). + * + * @return the hybridComputeSettings value. + */ + HybridComputeSettingsProperties hybridComputeSettings(); + + /** + * Gets the authenticationDetails property: Settings for authentication management, these settings are relevant only + * for the cloud connector. + * + * @return the authenticationDetails value. + */ + AuthenticationDetailsProperties authenticationDetails(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner object. + * + * @return the inner object. + */ + ConnectorSettingInner innerModel(); + + /** + * The entirety of the ConnectorSetting definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The ConnectorSetting definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ConnectorSetting definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the ConnectorSetting 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.WithHybridComputeSettings, DefinitionStages.WithAuthenticationDetails { + /** + * Executes the create request. + * + * @return the created resource. + */ + ConnectorSetting create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ConnectorSetting create(Context context); + } + + /** + * The stage of the ConnectorSetting definition allowing to specify hybridComputeSettings. + */ + interface WithHybridComputeSettings { + /** + * Specifies the hybridComputeSettings property: Settings for hybrid compute management. These settings are + * relevant only for Arc autoProvision (Hybrid Compute).. + * + * @param hybridComputeSettings Settings for hybrid compute management. These settings are relevant only for + * Arc autoProvision (Hybrid Compute). + * @return the next definition stage. + */ + WithCreate withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings); + } + + /** + * The stage of the ConnectorSetting definition allowing to specify authenticationDetails. + */ + interface WithAuthenticationDetails { + /** + * Specifies the authenticationDetails property: Settings for authentication management, these settings are + * relevant only for the cloud connector.. + * + * @param authenticationDetails Settings for authentication management, these settings are relevant only for + * the cloud connector. + * @return the next definition stage. + */ + WithCreate withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails); + } + } + + /** + * Begins update for the ConnectorSetting resource. + * + * @return the stage of resource update. + */ + ConnectorSetting.Update update(); + + /** + * The template for ConnectorSetting update. + */ + interface Update extends UpdateStages.WithHybridComputeSettings, UpdateStages.WithAuthenticationDetails { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ConnectorSetting apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ConnectorSetting apply(Context context); + } + + /** + * The ConnectorSetting update stages. + */ + interface UpdateStages { + /** + * The stage of the ConnectorSetting update allowing to specify hybridComputeSettings. + */ + interface WithHybridComputeSettings { + /** + * Specifies the hybridComputeSettings property: Settings for hybrid compute management. These settings are + * relevant only for Arc autoProvision (Hybrid Compute).. + * + * @param hybridComputeSettings Settings for hybrid compute management. These settings are relevant only for + * Arc autoProvision (Hybrid Compute). + * @return the next definition stage. + */ + Update withHybridComputeSettings(HybridComputeSettingsProperties hybridComputeSettings); + } + + /** + * The stage of the ConnectorSetting update allowing to specify authenticationDetails. + */ + interface WithAuthenticationDetails { + /** + * Specifies the authenticationDetails property: Settings for authentication management, these settings are + * relevant only for the cloud connector.. + * + * @param authenticationDetails Settings for authentication management, these settings are relevant only for + * the cloud connector. + * @return the next definition stage. + */ + Update withAuthenticationDetails(AuthenticationDetailsProperties authenticationDetails); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ConnectorSetting refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ConnectorSetting refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java new file mode 100644 index 000000000000..38abef3717a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; +import java.io.IOException; +import java.util.List; + +/** + * For a subscription, list of all cloud account connectors and their settings. + */ +@Fluent +public final class ConnectorSettingList implements JsonSerializable { + /* + * List of all the cloud account connector settings + */ + private List value; + + /* + * The URI to fetch the next page. + */ + private String nextLink; + + /** + * Creates an instance of ConnectorSettingList class. + */ + public ConnectorSettingList() { + } + + /** + * Get the value property: List of all the cloud account connector settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of all the cloud account connector settings. + * + * @param value the value value to set. + * @return the ConnectorSettingList object itself. + */ + public ConnectorSettingList withValue(List value) { + this.value = value; + return this; + } + + /** + * 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 ConnectorSettingList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorSettingList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectorSettingList. + */ + public static ConnectorSettingList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorSettingList deserializedConnectorSettingList = new ConnectorSettingList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ConnectorSettingInner.fromJson(reader1)); + deserializedConnectorSettingList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedConnectorSettingList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorSettingList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Connectors.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Connectors.java new file mode 100644 index 000000000000..1d72270a40bd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Connectors.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Connectors. + */ +public interface Connectors { + /** + * Cloud accounts connectors of a 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 for a subscription, list of all cloud account connectors and their settings as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Cloud accounts connectors of a 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 for a subscription, list of all cloud account connectors and their settings as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting along with {@link Response}. + */ + Response getWithResponse(String connectorName, Context context); + + /** + * Details of a specific cloud account connector. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connector setting. + */ + ConnectorSetting get(String connectorName); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 connectorName, Context context); + + /** + * Delete a cloud account connector from a subscription. + * + * @param connectorName Name of the cloud account connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 connectorName); + + /** + * Details of a specific cloud account connector. + * + * @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 connector setting along with {@link Response}. + */ + ConnectorSetting getById(String id); + + /** + * Details of a specific cloud account connector. + * + * @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 connector setting along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a cloud account connector from a subscription. + * + * @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 cloud account connector from a subscription. + * + * @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 ConnectorSetting resource. + * + * @param name resource name. + * @return the first stage of the new ConnectorSetting definition. + */ + ConnectorSetting.DefinitionStages.Blank define(String name); +} 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..8e0819e44c6b --- /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) AutoRest 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. + */ + public 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/CspmMonitorAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOffering.java new file mode 100644 index 000000000000..0a688baca65f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM 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..7c7a762a0c05 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..8996f071e5a6 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM 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..f70f6296ad9e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorDockerHubOffering.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM (Cloud security posture management) monitoring for Docker Hub offering. + */ +@Immutable +public final class CspmMonitorDockerHubOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_DOCKER_HUB; + + /** + * Creates an instance of CspmMonitorDockerHubOffering class. + */ + public CspmMonitorDockerHubOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorDockerHubOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorDockerHubOffering if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorDockerHubOffering. + */ + public static CspmMonitorDockerHubOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorDockerHubOffering deserializedCspmMonitorDockerHubOffering = new CspmMonitorDockerHubOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorDockerHubOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorDockerHubOffering.offeringType = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorDockerHubOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOffering.java new file mode 100644 index 000000000000..2ebdeabdb4cc --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM 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..c2516d111cd0 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..5288592e193c --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM (Cloud security posture management) monitoring for 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..70b32ff71469 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM 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..212e71dc4d33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorJFrogOffering.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM (Cloud security posture management) monitoring for JFrog Artifactory offering. + */ +@Immutable +public final class CspmMonitorJFrogOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_JFROG; + + /** + * Creates an instance of CspmMonitorJFrogOffering class. + */ + public CspmMonitorJFrogOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorJFrogOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorJFrogOffering if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorJFrogOffering. + */ + public static CspmMonitorJFrogOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorJFrogOffering deserializedCspmMonitorJFrogOffering = new CspmMonitorJFrogOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorJFrogOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorJFrogOffering.offeringType = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorJFrogOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomation.java new file mode 100644 index 000000000000..31e7cbdf895b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomation.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationInner; + +/** + * An immutable client-side representation of CustomAssessmentAutomation. + */ +public interface CustomAssessmentAutomation { + /** + * 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 compressedQuery property: GZip encoded KQL query representing the assessment automation results + * required. + * + * @return the compressedQuery value. + */ + String compressedQuery(); + + /** + * Gets the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @return the supportedCloud value. + */ + SupportedCloudEnum supportedCloud(); + + /** + * Gets the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @return the severity value. + */ + SeverityEnum severity(); + + /** + * Gets the displayName property: The display name of the assessments generated by this assessment automation. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @return the remediationDescription value. + */ + String remediationDescription(); + + /** + * Gets the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * assessment automation. + * + * @return the assessmentKey value. + */ + String assessmentKey(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationInner object. + * + * @return the inner object. + */ + CustomAssessmentAutomationInner innerModel(); + + /** + * The entirety of the CustomAssessmentAutomation definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CustomAssessmentAutomation definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CustomAssessmentAutomation definition. + */ + interface Blank extends WithResourceGroup { + } + + /** + * The stage of the CustomAssessmentAutomation definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the CustomAssessmentAutomation 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.WithCompressedQuery, DefinitionStages.WithSupportedCloud, + DefinitionStages.WithSeverity, DefinitionStages.WithDisplayName, DefinitionStages.WithDescription, + DefinitionStages.WithRemediationDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + CustomAssessmentAutomation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CustomAssessmentAutomation create(Context context); + } + + /** + * The stage of the CustomAssessmentAutomation definition allowing to specify compressedQuery. + */ + interface WithCompressedQuery { + /** + * Specifies the compressedQuery property: Base 64 encoded KQL query representing the assessment automation + * results required.. + * + * @param compressedQuery Base 64 encoded KQL query representing the assessment automation results required. + * @return the next definition stage. + */ + WithCreate withCompressedQuery(String compressedQuery); + } + + /** + * The stage of the CustomAssessmentAutomation definition allowing to specify supportedCloud. + */ + interface WithSupportedCloud { + /** + * Specifies the supportedCloud property: Relevant cloud for the custom assessment automation.. + * + * @param supportedCloud Relevant cloud for the custom assessment automation. + * @return the next definition stage. + */ + WithCreate withSupportedCloud(SupportedCloudEnum supportedCloud); + } + + /** + * The stage of the CustomAssessmentAutomation definition allowing to specify severity. + */ + interface WithSeverity { + /** + * Specifies the severity property: The severity to relate to the assessments generated by this assessment + * automation.. + * + * @param severity The severity to relate to the assessments generated by this assessment automation. + * @return the next definition stage. + */ + WithCreate withSeverity(SeverityEnum severity); + } + + /** + * The stage of the CustomAssessmentAutomation definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the assessments generated by this assessment + * automation.. + * + * @param displayName The display name of the assessments generated by this assessment automation. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the CustomAssessmentAutomation definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description to relate to the assessments generated by this + * assessment automation.. + * + * @param description The description to relate to the assessments generated by this assessment automation. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the CustomAssessmentAutomation definition allowing to specify remediationDescription. + */ + interface WithRemediationDescription { + /** + * Specifies the remediationDescription property: The remediation description to relate to the assessments + * generated by this assessment automation.. + * + * @param remediationDescription The remediation description to relate to the assessments generated by this + * assessment automation. + * @return the next definition stage. + */ + WithCreate withRemediationDescription(String remediationDescription); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CustomAssessmentAutomation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CustomAssessmentAutomation refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationRequest.java new file mode 100644 index 000000000000..3de840c60d4f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationRequest.java @@ -0,0 +1,284 @@ +// 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.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationRequestProperties; +import java.io.IOException; + +/** + * Custom Assessment Automation request. + */ +@Fluent +public final class CustomAssessmentAutomationRequest extends ProxyResource { + /* + * describes Custom Assessment Automation request properties. + */ + private CustomAssessmentAutomationRequestProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CustomAssessmentAutomationRequest class. + */ + public CustomAssessmentAutomationRequest() { + } + + /** + * Get the innerProperties property: describes Custom Assessment Automation request properties. + * + * @return the innerProperties value. + */ + private CustomAssessmentAutomationRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the compressedQuery property: Base 64 encoded KQL query representing the assessment automation results + * required. + * + * @return the compressedQuery value. + */ + public String compressedQuery() { + return this.innerProperties() == null ? null : this.innerProperties().compressedQuery(); + } + + /** + * Set the compressedQuery property: Base 64 encoded KQL query representing the assessment automation results + * required. + * + * @param compressedQuery the compressedQuery value to set. + * @return the CustomAssessmentAutomationRequest object itself. + */ + public CustomAssessmentAutomationRequest withCompressedQuery(String compressedQuery) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationRequestProperties(); + } + this.innerProperties().withCompressedQuery(compressedQuery); + return this; + } + + /** + * Get the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @return the supportedCloud value. + */ + public SupportedCloudEnum supportedCloud() { + return this.innerProperties() == null ? null : this.innerProperties().supportedCloud(); + } + + /** + * Set the supportedCloud property: Relevant cloud for the custom assessment automation. + * + * @param supportedCloud the supportedCloud value to set. + * @return the CustomAssessmentAutomationRequest object itself. + */ + public CustomAssessmentAutomationRequest withSupportedCloud(SupportedCloudEnum supportedCloud) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationRequestProperties(); + } + this.innerProperties().withSupportedCloud(supportedCloud); + return this; + } + + /** + * Get the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @return the severity value. + */ + public SeverityEnum severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: The severity to relate to the assessments generated by this assessment automation. + * + * @param severity the severity value to set. + * @return the CustomAssessmentAutomationRequest object itself. + */ + public CustomAssessmentAutomationRequest withSeverity(SeverityEnum severity) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationRequestProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the displayName property: The display name of the assessments generated by this assessment automation. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the assessments generated by this assessment automation. + * + * @param displayName the displayName value to set. + * @return the CustomAssessmentAutomationRequest object itself. + */ + public CustomAssessmentAutomationRequest withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationRequestProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description to relate to the assessments generated by this assessment + * automation. + * + * @param description the description value to set. + * @return the CustomAssessmentAutomationRequest object itself. + */ + public CustomAssessmentAutomationRequest withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationRequestProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.innerProperties() == null ? null : this.innerProperties().remediationDescription(); + } + + /** + * Set the remediationDescription property: The remediation description to relate to the assessments generated by + * this assessment automation. + * + * @param remediationDescription the remediationDescription value to set. + * @return the CustomAssessmentAutomationRequest object itself. + */ + public CustomAssessmentAutomationRequest withRemediationDescription(String remediationDescription) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomAssessmentAutomationRequestProperties(); + } + this.innerProperties().withRemediationDescription(remediationDescription); + 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 CustomAssessmentAutomationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationRequest. + */ + public static CustomAssessmentAutomationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationRequest deserializedCustomAssessmentAutomationRequest + = new CustomAssessmentAutomationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.innerProperties + = CustomAssessmentAutomationRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationRequest; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomations.java new file mode 100644 index 000000000000..664d26aeac33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomations.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CustomAssessmentAutomations. + */ +public interface CustomAssessmentAutomations { + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group along with + * {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String customAssessmentAutomationName, Context context); + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a single custom assessment automation by name for the provided subscription and resource group. + */ + CustomAssessmentAutomation getByResourceGroup(String resourceGroupName, String customAssessmentAutomationName); + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 customAssessmentAutomationName, + Context context); + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customAssessmentAutomationName Name of the Custom Assessment Automation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 customAssessmentAutomationName); + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and 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 a list of Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List custom assessment automations in a subscription and a resource group + * + * List custom assessment automations by provided subscription and resource group. + * + * @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 a list of Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List custom assessment automations in a subscription + * + * List custom assessment automations by provided 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 Custom Assessment Automations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @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 single custom assessment automation by name for the provided subscription and resource group along with + * {@link Response}. + */ + CustomAssessmentAutomation getById(String id); + + /** + * Gets a custom assessment automation + * + * Gets a single custom assessment automation by name for the provided subscription and resource group. + * + * @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 single custom assessment automation by name for the provided subscription and resource group along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @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 custom assessment automation + * + * Deletes a custom assessment automation by name for a provided subscription. + * + * @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 CustomAssessmentAutomation resource. + * + * @param name resource name. + * @return the first stage of the new CustomAssessmentAutomation definition. + */ + CustomAssessmentAutomation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationsListResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationsListResult.java new file mode 100644 index 000000000000..215b4ad6a32c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationsListResult.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of Custom Assessment Automations. + */ +@Fluent +public final class CustomAssessmentAutomationsListResult + implements JsonSerializable { + /* + * Collection of Custom Assessment Automations + */ + private List value; + + /* + * The link used to get the next page of operations. + */ + private String nextLink; + + /** + * Creates an instance of CustomAssessmentAutomationsListResult class. + */ + public CustomAssessmentAutomationsListResult() { + } + + /** + * Get the value property: Collection of Custom Assessment Automations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the CustomAssessmentAutomationsListResult object itself. + */ + public CustomAssessmentAutomationsListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationsListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationsListResult. + */ + public static CustomAssessmentAutomationsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationsListResult deserializedCustomAssessmentAutomationsListResult + = new CustomAssessmentAutomationsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CustomAssessmentAutomationInner.fromJson(reader1)); + deserializedCustomAssessmentAutomationsListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCustomAssessmentAutomationsListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationsListResult; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignment.java new file mode 100644 index 000000000000..0ddee9631222 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignment.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentInner; + +/** + * An immutable client-side representation of CustomEntityStoreAssignment. + */ +public interface CustomEntityStoreAssignment { + /** + * 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 principal property: The principal assigned with entity store. Format of principal is: [AAD + * type]=[PrincipalObjectId];[TenantId]. + * + * @return the principal value. + */ + String principal(); + + /** + * Gets the entityStoreDatabaseLink property: The link to entity store database. + * + * @return the entityStoreDatabaseLink value. + */ + String entityStoreDatabaseLink(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentInner object. + * + * @return the inner object. + */ + CustomEntityStoreAssignmentInner innerModel(); + + /** + * The entirety of the CustomEntityStoreAssignment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CustomEntityStoreAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CustomEntityStoreAssignment definition. + */ + interface Blank extends WithResourceGroup { + } + + /** + * The stage of the CustomEntityStoreAssignment definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the CustomEntityStoreAssignment 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.WithPrincipal { + /** + * Executes the create request. + * + * @return the created resource. + */ + CustomEntityStoreAssignment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CustomEntityStoreAssignment create(Context context); + } + + /** + * The stage of the CustomEntityStoreAssignment definition allowing to specify principal. + */ + interface WithPrincipal { + /** + * Specifies the principal property: The principal assigned with entity store. If not provided, will use + * caller principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + * + * @param principal The principal assigned with entity store. If not provided, will use caller principal. + * Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + * @return the next definition stage. + */ + WithCreate withPrincipal(String principal); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CustomEntityStoreAssignment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CustomEntityStoreAssignment refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentRequest.java new file mode 100644 index 000000000000..cf4393a9b338 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentRequest.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentRequestProperties; +import java.io.IOException; + +/** + * describes the custom entity store assignment request. + */ +@Fluent +public final class CustomEntityStoreAssignmentRequest implements JsonSerializable { + /* + * describes properties of custom entity store assignment request + */ + private CustomEntityStoreAssignmentRequestProperties innerProperties; + + /** + * Creates an instance of CustomEntityStoreAssignmentRequest class. + */ + public CustomEntityStoreAssignmentRequest() { + } + + /** + * Get the innerProperties property: describes properties of custom entity store assignment request. + * + * @return the innerProperties value. + */ + private CustomEntityStoreAssignmentRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the principal property: The principal assigned with entity store. If not provided, will use caller principal. + * Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + * + * @return the principal value. + */ + public String principal() { + return this.innerProperties() == null ? null : this.innerProperties().principal(); + } + + /** + * Set the principal property: The principal assigned with entity store. If not provided, will use caller principal. + * Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + * + * @param principal the principal value to set. + * @return the CustomEntityStoreAssignmentRequest object itself. + */ + public CustomEntityStoreAssignmentRequest withPrincipal(String principal) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomEntityStoreAssignmentRequestProperties(); + } + this.innerProperties().withPrincipal(principal); + 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 CustomEntityStoreAssignmentRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentRequest. + */ + public static CustomEntityStoreAssignmentRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentRequest deserializedCustomEntityStoreAssignmentRequest + = new CustomEntityStoreAssignmentRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentRequest.innerProperties + = CustomEntityStoreAssignmentRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentRequest; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignments.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignments.java new file mode 100644 index 000000000000..5293562f0dda --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignments.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CustomEntityStoreAssignments. + */ +public interface CustomEntityStoreAssignments { + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group along + * with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String customEntityStoreAssignmentName, Context context); + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 single custom entity store assignment by name for the provided subscription and resource group. + */ + CustomEntityStoreAssignment getByResourceGroup(String resourceGroupName, String customEntityStoreAssignmentName); + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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 Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String customEntityStoreAssignmentName, + Context context); + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case + * insensitive. + * @param customEntityStoreAssignmentName Name of the custom entity store assignment. Generated name is 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. + */ + void deleteByResourceGroup(String resourceGroupName, String customEntityStoreAssignmentName); + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and 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 a list of custom entity store assignments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List custom entity store assignments in a subscription and a resource group + * + * List custom entity store assignments by a provided subscription and resource group. + * + * @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 a list of custom entity store assignments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List custom entity store assignments in a subscription + * + * List custom entity store assignments by provided 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 custom entity store assignments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @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 single custom entity store assignment by name for the provided subscription and resource group along + * with {@link Response}. + */ + CustomEntityStoreAssignment getById(String id); + + /** + * Gets a custom entity store assignment + * + * Gets a single custom entity store assignment by name for the provided subscription and resource group. + * + * @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 single custom entity store assignment by name for the provided subscription and resource group along + * with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @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); + + /** + * Deleted a custom entity store assignment + * + * Delete a custom entity store assignment by name for a provided subscription. + * + * @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 CustomEntityStoreAssignment resource. + * + * @param name resource name. + * @return the first stage of the new CustomEntityStoreAssignment definition. + */ + CustomEntityStoreAssignment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentsListResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentsListResult.java new file mode 100644 index 000000000000..f0b33e8a3363 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentsListResult.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of custom entity store assignments. + */ +@Fluent +public final class CustomEntityStoreAssignmentsListResult + implements JsonSerializable { + /* + * Collection of custom entity store assignments + */ + private List value; + + /* + * The link used to get the next page of operations. + */ + private String nextLink; + + /** + * Creates an instance of CustomEntityStoreAssignmentsListResult class. + */ + public CustomEntityStoreAssignmentsListResult() { + } + + /** + * Get the value property: Collection of custom entity store assignments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the CustomEntityStoreAssignmentsListResult object itself. + */ + public CustomEntityStoreAssignmentsListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentsListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentsListResult. + */ + public static CustomEntityStoreAssignmentsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentsListResult deserializedCustomEntityStoreAssignmentsListResult + = new CustomEntityStoreAssignmentsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CustomEntityStoreAssignmentInner.fromJson(reader1)); + deserializedCustomEntityStoreAssignmentsListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentsListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentsListResult; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java new file mode 100644 index 000000000000..581f88351178 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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. + */ + public 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..639415df6549 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * CVSS details. + */ +@Immutable +public final class Cvss implements JsonSerializable { + /* + * CVSS base + */ + private Float base; + + /** + * Creates an instance of Cvss class. + */ + public 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/DefenderCspmAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOffering.java new file mode 100644 index 000000000000..4c8bffb3401d --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM P1 for 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..cf7e53419e40 --- /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) 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; + +/** + * 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..893d3d85a2cc --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defender 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..512ae4041566 --- /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) 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; + +/** + * 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..8e5516889d63 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender 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..1907f6afaae1 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..54a95b90b3b6 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender container 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..3c34b05f5075 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender container image assessment configuration. + */ +@Fluent +public final class 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..25ff31ea103a --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..e4ee07897e28 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmDockerHubOffering.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Defender for CSPM Docker Hub offering configurations. + */ +@Immutable +public final class DefenderCspmDockerHubOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_CSPM_DOCKER_HUB; + + /** + * Creates an instance of DefenderCspmDockerHubOffering class. + */ + public DefenderCspmDockerHubOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmDockerHubOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmDockerHubOffering if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmDockerHubOffering. + */ + public static DefenderCspmDockerHubOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmDockerHubOffering deserializedDefenderCspmDockerHubOffering + = new DefenderCspmDockerHubOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderCspmDockerHubOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderCspmDockerHubOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmDockerHubOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOffering.java new file mode 100644 index 000000000000..3323a65e9d2a --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM P1 for 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..1d97928b6a8c --- /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) 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; + +/** + * 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..6555c0d9cd4c --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender 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..fe9e84390c43 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender Container 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..358eb39260e5 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender Container image assessment configuration. + */ +@Fluent +public final class 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..4edfbaa4f1d7 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..2a7cf3f0b554 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOffering.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM P1 for JFrog Artifactory offering. + */ +@Fluent +public final class DefenderCspmJFrogOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_CSPM_JFROG; + + /* + * The Microsoft Defender Container image assessment configuration + */ + private DefenderCspmJFrogOfferingMdcContainersImageAssessment mdcContainersImageAssessment; + + /** + * Creates an instance of DefenderCspmJFrogOffering class. + */ + public DefenderCspmJFrogOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @return the mdcContainersImageAssessment value. + */ + public DefenderCspmJFrogOfferingMdcContainersImageAssessment mdcContainersImageAssessment() { + return this.mdcContainersImageAssessment; + } + + /** + * Set the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @param mdcContainersImageAssessment the mdcContainersImageAssessment value to set. + * @return the DefenderCspmJFrogOffering object itself. + */ + public DefenderCspmJFrogOffering withMdcContainersImageAssessment( + DefenderCspmJFrogOfferingMdcContainersImageAssessment mdcContainersImageAssessment) { + this.mdcContainersImageAssessment = mdcContainersImageAssessment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (mdcContainersImageAssessment() != null) { + mdcContainersImageAssessment().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("mdcContainersImageAssessment", this.mdcContainersImageAssessment); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmJFrogOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmJFrogOffering if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmJFrogOffering. + */ + public static DefenderCspmJFrogOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmJFrogOffering deserializedDefenderCspmJFrogOffering = new DefenderCspmJFrogOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderCspmJFrogOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderCspmJFrogOffering.offeringType = OfferingType.fromString(reader.getString()); + } else if ("mdcContainersImageAssessment".equals(fieldName)) { + deserializedDefenderCspmJFrogOffering.mdcContainersImageAssessment + = DefenderCspmJFrogOfferingMdcContainersImageAssessment.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmJFrogOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOfferingMdcContainersImageAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOfferingMdcContainersImageAssessment.java new file mode 100644 index 000000000000..fe3bc4d83a11 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOfferingMdcContainersImageAssessment.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender Container image assessment configuration. + */ +@Fluent +public final class DefenderCspmJFrogOfferingMdcContainersImageAssessment + implements JsonSerializable { + /* + * Is Microsoft Defender container image assessment enabled + */ + private Boolean enabled; + + /** + * Creates an instance of DefenderCspmJFrogOfferingMdcContainersImageAssessment class. + */ + public DefenderCspmJFrogOfferingMdcContainersImageAssessment() { + } + + /** + * Get the enabled property: Is Microsoft Defender container image assessment enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender container image assessment enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderCspmJFrogOfferingMdcContainersImageAssessment object itself. + */ + public DefenderCspmJFrogOfferingMdcContainersImageAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmJFrogOfferingMdcContainersImageAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmJFrogOfferingMdcContainersImageAssessment if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmJFrogOfferingMdcContainersImageAssessment. + */ + public static DefenderCspmJFrogOfferingMdcContainersImageAssessment fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmJFrogOfferingMdcContainersImageAssessment deserializedDefenderCspmJFrogOfferingMdcContainersImageAssessment + = new DefenderCspmJFrogOfferingMdcContainersImageAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmJFrogOfferingMdcContainersImageAssessment.enabled + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmJFrogOfferingMdcContainersImageAssessment; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOffering.java new file mode 100644 index 000000000000..757d83ad985a --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..25438c8ebd0b --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..721674780381 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..15acc97c0b77 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..f6da1eed5787 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..79bc50324bd9 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..2922e5aa3dc1 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..29c675ab9cbe --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..75c5df18ba6d --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..b7b825de699f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender container 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..09a69addc3fe --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender container image assessment configuration. + */ +@Fluent +public final class 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..bf1e036f28cb --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..2d9d2d111163 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersDockerHubOffering.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Defender for containers Docker Hub offering configurations. + */ +@Immutable +public final class DefenderForContainersDockerHubOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_DOCKER_HUB; + + /** + * Creates an instance of DefenderForContainersDockerHubOffering class. + */ + public DefenderForContainersDockerHubOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersDockerHubOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersDockerHubOffering if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersDockerHubOffering. + */ + public static DefenderForContainersDockerHubOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersDockerHubOffering deserializedDefenderForContainersDockerHubOffering + = new DefenderForContainersDockerHubOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForContainersDockerHubOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForContainersDockerHubOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersDockerHubOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOffering.java new file mode 100644 index 000000000000..c055f7a2433f --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..7b2a4f4a4afb --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..50966e3b00bf --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender Container 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..d457f2fe0f00 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender Container image assessment configuration. + */ +@Fluent +public final class 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..a62ba7a0a6a8 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..6df48311dfeb --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..d3b69dfcbbac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersJFrogOffering.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Defender for Containers for JFrog Artifactory offering. + */ +@Immutable +public final class DefenderForContainersJFrogOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_JFROG; + + /** + * Creates an instance of DefenderForContainersJFrogOffering class. + */ + public DefenderForContainersJFrogOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersJFrogOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersJFrogOffering if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersJFrogOffering. + */ + public static DefenderForContainersJFrogOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersJFrogOffering deserializedDefenderForContainersJFrogOffering + = new DefenderForContainersJFrogOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForContainersJFrogOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForContainersJFrogOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersJFrogOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOffering.java new file mode 100644 index 000000000000..5b6639145006 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..69aa0273fd57 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..bb52cddda555 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..6cf8056eace7 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..2fb358cfce39 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..eee7509cdef6 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..836747422407 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender 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..1f8749805e47 --- /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) 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; + +/** + * 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..2d542688b8b3 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..784802c2ea54 --- /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) 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; + +/** + * 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..789c49fc3ad9 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..435a62e581e0 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..dd99e18208af --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..b6f2c6288be5 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..5ef35e41a870 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender 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..c9f7fc4d672a --- /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) 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; + +/** + * 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..5c235a8f90df --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..9622ce1c3ab2 --- /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) 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; + +/** + * 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..2430ece553cf --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..6cccb97e328f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSetting.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.Response; +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 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 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + Response startMalwareScanWithResponse(Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + MalwareScan startMalwareScan(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSettingProperties.java new file mode 100644 index 000000000000..ae9ea364c57e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSettingProperties.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defender for Storage resource properties. + */ +@Fluent +public final class DefenderForStorageSettingProperties + implements JsonSerializable { + /* + * Indicates whether Defender for Storage is enabled on this storage account. + */ + private Boolean isEnabled; + + /* + * Properties of Malware Scanning. + */ + private MalwareScanningProperties malwareScanning; + + /* + * Properties of Sensitive Data Discovery. + */ + private SensitiveDataDiscoveryProperties sensitiveDataDiscovery; + + /* + * Indicates whether the settings defined for this storage account should override the settings defined for the + * subscription. + */ + private Boolean overrideSubscriptionLevelSettings; + + /** + * Creates an instance of DefenderForStorageSettingProperties class. + */ + public DefenderForStorageSettingProperties() { + } + + /** + * Get the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. + * + * @param isEnabled the isEnabled value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the malwareScanning property: Properties of Malware Scanning. + * + * @return the malwareScanning value. + */ + public MalwareScanningProperties malwareScanning() { + return this.malwareScanning; + } + + /** + * Set the malwareScanning property: Properties of Malware Scanning. + * + * @param malwareScanning the malwareScanning value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties withMalwareScanning(MalwareScanningProperties malwareScanning) { + this.malwareScanning = malwareScanning; + return this; + } + + /** + * Get the sensitiveDataDiscovery property: Properties of Sensitive Data Discovery. + * + * @return the sensitiveDataDiscovery value. + */ + public SensitiveDataDiscoveryProperties sensitiveDataDiscovery() { + return this.sensitiveDataDiscovery; + } + + /** + * Set the sensitiveDataDiscovery property: Properties of Sensitive Data Discovery. + * + * @param sensitiveDataDiscovery the sensitiveDataDiscovery value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties + withSensitiveDataDiscovery(SensitiveDataDiscoveryProperties sensitiveDataDiscovery) { + this.sensitiveDataDiscovery = sensitiveDataDiscovery; + return this; + } + + /** + * Get the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage + * account should override the settings defined for the subscription. + * + * @return the overrideSubscriptionLevelSettings value. + */ + public Boolean overrideSubscriptionLevelSettings() { + return this.overrideSubscriptionLevelSettings; + } + + /** + * Set the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage + * account should override the settings defined for the subscription. + * + * @param overrideSubscriptionLevelSettings the overrideSubscriptionLevelSettings value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties + withOverrideSubscriptionLevelSettings(Boolean overrideSubscriptionLevelSettings) { + this.overrideSubscriptionLevelSettings = overrideSubscriptionLevelSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (malwareScanning() != null) { + malwareScanning().validate(); + } + if (sensitiveDataDiscovery() != null) { + sensitiveDataDiscovery().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", this.isEnabled); + jsonWriter.writeJsonField("malwareScanning", this.malwareScanning); + jsonWriter.writeJsonField("sensitiveDataDiscovery", this.sensitiveDataDiscovery); + jsonWriter.writeBooleanField("overrideSubscriptionLevelSettings", this.overrideSubscriptionLevelSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForStorageSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForStorageSettingProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForStorageSettingProperties. + */ + public static DefenderForStorageSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForStorageSettingProperties deserializedDefenderForStorageSettingProperties + = new DefenderForStorageSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.isEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("malwareScanning".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.malwareScanning + = MalwareScanningProperties.fromJson(reader); + } else if ("sensitiveDataDiscovery".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.sensitiveDataDiscovery + = SensitiveDataDiscoveryProperties.fromJson(reader); + } else if ("overrideSubscriptionLevelSettings".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.overrideSubscriptionLevelSettings + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForStorageSettingProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java new file mode 100644 index 000000000000..5b0e44c06ed3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.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 identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage settings for the specified storage account along with {@link Response}. + */ + Response getWithResponse(String resourceId, SettingNameAutoGenerated settingName, + Context context); + + /** + * Gets the Defender for Storage settings for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage settings for the specified storage account. + */ + DefenderForStorageSetting get(String resourceId, SettingNameAutoGenerated settingName); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + Response startMalwareScanWithResponse(String resourceId, SettingNameAutoGenerated settingName, + Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + MalwareScan startMalwareScan(String resourceId, SettingNameAutoGenerated settingName); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + Response cancelMalwareScanWithResponse(String resourceId, SettingNameAutoGenerated settingName, + String scanId, Context context); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + MalwareScan cancelMalwareScan(String resourceId, SettingNameAutoGenerated settingName, String scanId); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response}. + */ + Response getMalwareScanWithResponse(String resourceId, SettingNameAutoGenerated settingName, + String scanId, Context context); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource. + */ + MalwareScan getMalwareScan(String resourceId, SettingNameAutoGenerated 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(SettingNameAutoGenerated name); +} 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..c1d35b961cf1 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * 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. + */ + public 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..4b148f082fd3 --- /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) AutoRest 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 systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: DevOps Configuration properties. + * + * @return the properties value. + */ + DevOpsConfigurationProperties properties(); + + /** + * 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/DevOpsConfigurationListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationListResponse.java new file mode 100644 index 000000000000..41ca2e8a5a6f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationListResponse.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class DevOpsConfigurationListResponse implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of DevOpsConfigurationListResponse class. + */ + public DevOpsConfigurationListResponse() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the DevOpsConfigurationListResponse object itself. + */ + public DevOpsConfigurationListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the DevOpsConfigurationListResponse object itself. + */ + public DevOpsConfigurationListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsConfigurationListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsConfigurationListResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsConfigurationListResponse. + */ + public static DevOpsConfigurationListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsConfigurationListResponse deserializedDevOpsConfigurationListResponse + = new DevOpsConfigurationListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DevOpsConfigurationInner.fromJson(reader1)); + deserializedDevOpsConfigurationListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDevOpsConfigurationListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsConfigurationListResponse; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationProperties.java new file mode 100644 index 000000000000..d0b74aaaa5c3 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.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..b1e34bdf9781 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; + +/** + * Resource collection API of DevOpsConfigurations. + */ +public interface DevOpsConfigurations { + /** + * 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); + + /** + * 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); +} 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..da45533089d9 --- /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) AutoRest 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 operation result Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops 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 operation result Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devops 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..723624bcf62c --- /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) AutoRest 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 { + /** + * Static value Succeeded for DevOpsProvisioningState. + */ + public static final DevOpsProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for DevOpsProvisioningState. + */ + public static final DevOpsProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for DevOpsProvisioningState. + */ + public static final DevOpsProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Pending for DevOpsProvisioningState. + */ + public static final DevOpsProvisioningState PENDING = fromString("Pending"); + + /** + * Static value PendingDeletion for DevOpsProvisioningState. + */ + public static final DevOpsProvisioningState PENDING_DELETION = fromString("PendingDeletion"); + + /** + * Static value DeletionSuccess for DevOpsProvisioningState. + */ + public static final DevOpsProvisioningState DELETION_SUCCESS = fromString("DeletionSuccess"); + + /** + * Static value DeletionFailure for DevOpsProvisioningState. + */ + 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/DockerHubEnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DockerHubEnvironmentData.java new file mode 100644 index 000000000000..36dfad75ee63 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DockerHubEnvironmentData.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Docker Hub connector environment data. + */ +@Fluent +public final class DockerHubEnvironmentData extends EnvironmentData { + /* + * The type of the environment data. + */ + private EnvironmentType environmentType = EnvironmentType.DOCKER_HUB_ORGANIZATION; + + /* + * The Docker Hub organization authentication details + */ + private Authentication authentication; + + /* + * Scan interval in hours (value should be between 1-hour to 24-hours) + */ + private Long scanInterval; + + /** + * Creates an instance of DockerHubEnvironmentData class. + */ + public DockerHubEnvironmentData() { + } + + /** + * Get the environmentType property: The type of the environment data. + * + * @return the environmentType value. + */ + @Override + public EnvironmentType environmentType() { + return this.environmentType; + } + + /** + * Get the authentication property: The Docker Hub organization authentication details. + * + * @return the authentication value. + */ + public Authentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: The Docker Hub organization authentication details. + * + * @param authentication the authentication value to set. + * @return the DockerHubEnvironmentData object itself. + */ + public DockerHubEnvironmentData withAuthentication(Authentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours). + * + * @return the scanInterval value. + */ + public Long scanInterval() { + return this.scanInterval; + } + + /** + * Set the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours). + * + * @param scanInterval the scanInterval value to set. + * @return the DockerHubEnvironmentData object itself. + */ + public DockerHubEnvironmentData withScanInterval(Long scanInterval) { + this.scanInterval = scanInterval; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (authentication() != null) { + authentication().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("environmentType", + this.environmentType == null ? null : this.environmentType.toString()); + jsonWriter.writeJsonField("authentication", this.authentication); + jsonWriter.writeNumberField("scanInterval", this.scanInterval); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DockerHubEnvironmentData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DockerHubEnvironmentData if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DockerHubEnvironmentData. + */ + public static DockerHubEnvironmentData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DockerHubEnvironmentData deserializedDockerHubEnvironmentData = new DockerHubEnvironmentData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("environmentType".equals(fieldName)) { + deserializedDockerHubEnvironmentData.environmentType + = EnvironmentType.fromString(reader.getString()); + } else if ("authentication".equals(fieldName)) { + deserializedDockerHubEnvironmentData.authentication = Authentication.fromJson(reader); + } else if ("scanInterval".equals(fieldName)) { + deserializedDockerHubEnvironmentData.scanInterval = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedDockerHubEnvironmentData; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java new file mode 100644 index 000000000000..e86e45fc3a42 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java @@ -0,0 +1,67 @@ +// 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; + +/** + * End of support status. + */ +public final class EndOfSupportStatus extends ExpandableStringEnum { + /** + * Static value None for EndOfSupportStatus. + */ + public static final EndOfSupportStatus NONE = fromString("None"); + + /** + * Static value noLongerSupported for EndOfSupportStatus. + */ + public static final EndOfSupportStatus NO_LONGER_SUPPORTED = fromString("noLongerSupported"); + + /** + * Static value versionNoLongerSupported for EndOfSupportStatus. + */ + public static final EndOfSupportStatus VERSION_NO_LONGER_SUPPORTED = fromString("versionNoLongerSupported"); + + /** + * Static value upcomingNoLongerSupported for EndOfSupportStatus. + */ + public static final EndOfSupportStatus UPCOMING_NO_LONGER_SUPPORTED = fromString("upcomingNoLongerSupported"); + + /** + * Static value upcomingVersionNoLongerSupported for EndOfSupportStatus. + */ + public static final EndOfSupportStatus UPCOMING_VERSION_NO_LONGER_SUPPORTED + = fromString("upcomingVersionNoLongerSupported"); + + /** + * Creates a new instance of EndOfSupportStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EndOfSupportStatus() { + } + + /** + * Creates or finds a EndOfSupportStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EndOfSupportStatus. + */ + public static EndOfSupportStatus fromString(String name) { + return fromString(name, EndOfSupportStatus.class); + } + + /** + * Gets known EndOfSupportStatus values. + * + * @return known EndOfSupportStatus values. + */ + public static Collection values() { + return values(EndOfSupportStatus.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentData.java new file mode 100644 index 000000000000..c74a017309e8 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..36507a405692 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentDetails.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The environment details of the resource. + */ +@Fluent +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. + */ + public 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; + } + + /** + * Set 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). + * + * @param nativeResourceId the nativeResourceId value to set. + * @return the EnvironmentDetails object itself. + */ + public EnvironmentDetails withNativeResourceId(String nativeResourceId) { + this.nativeResourceId = nativeResourceId; + return this; + } + + /** + * 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; + } + + /** + * Set the environmentHierarchyId property: The hierarchy id of the connector (in case of Azure - the subscription + * Id, in case of MC - the hierarchyId id). + * + * @param environmentHierarchyId the environmentHierarchyId value to set. + * @return the EnvironmentDetails object itself. + */ + public EnvironmentDetails withEnvironmentHierarchyId(String environmentHierarchyId) { + this.environmentHierarchyId = environmentHierarchyId; + return this; + } + + /** + * 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; + } + + /** + * Set 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). + * + * @param organizationalHierarchyId the organizationalHierarchyId value to set. + * @return the EnvironmentDetails object itself. + */ + public EnvironmentDetails withOrganizationalHierarchyId(String organizationalHierarchyId) { + this.organizationalHierarchyId = organizationalHierarchyId; + return this; + } + + /** + * Get the subscriptionId property: The subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription Id. + * + * @param subscriptionId the subscriptionId value to set. + * @return the EnvironmentDetails object itself. + */ + public EnvironmentDetails withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the tenantId property: The tenant Id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenant Id. + * + * @param tenantId the tenantId value to set. + * @return the EnvironmentDetails object itself. + */ + public EnvironmentDetails withTenantId(String tenantId) { + this.tenantId = tenantId; + 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("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..85931d7c25f0 --- /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) AutoRest 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 { + /** + * Static value AwsAccount for EnvironmentType. + */ + public static final EnvironmentType AWS_ACCOUNT = fromString("AwsAccount"); + + /** + * Static value GcpProject for EnvironmentType. + */ + public static final EnvironmentType GCP_PROJECT = fromString("GcpProject"); + + /** + * Static value GithubScope for EnvironmentType. + */ + public static final EnvironmentType GITHUB_SCOPE = fromString("GithubScope"); + + /** + * Static value AzureDevOpsScope for EnvironmentType. + */ + public static final EnvironmentType AZURE_DEV_OPS_SCOPE = fromString("AzureDevOpsScope"); + + /** + * Static value GitlabScope for EnvironmentType. + */ + public static final EnvironmentType GITLAB_SCOPE = fromString("GitlabScope"); + + /** + * Static value DockerHubOrganization for EnvironmentType. + */ + public static final EnvironmentType DOCKER_HUB_ORGANIZATION = fromString("DockerHubOrganization"); + + /** + * Static value JFrogArtifactory for EnvironmentType. + */ + public static final EnvironmentType JFROG_ARTIFACTORY = fromString("JFrogArtifactory"); + + /** + * Creates a new instance of EnvironmentType value. + * + * @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/Etag.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java new file mode 100644 index 000000000000..2e694c31bb26 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Entity tag is used for comparing two or more entities from the same requested resource. + */ +@Fluent +public class Etag implements JsonSerializable { + /* + * Entity tag is used for comparing two or more entities from the same requested resource. + */ + private String etag; + + /** + * Creates an instance of Etag class. + */ + public Etag() { + } + + /** + * 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 Etag object itself. + */ + public Etag withEtag(String etag) { + this.etag = etag; + 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("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Etag from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Etag if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Etag. + */ + public static Etag fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Etag deserializedEtag = new Etag(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("etag".equals(fieldName)) { + deserializedEtag.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEtag; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java new file mode 100644 index 000000000000..206d143e8984 --- /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) AutoRest 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 { + /** + * Static value Assessments for EventSource. + */ + public static final EventSource ASSESSMENTS = fromString("Assessments"); + + /** + * Static value AssessmentsSnapshot for EventSource. + */ + public static final EventSource ASSESSMENTS_SNAPSHOT = fromString("AssessmentsSnapshot"); + + /** + * Static value SubAssessments for EventSource. + */ + public static final EventSource SUB_ASSESSMENTS = fromString("SubAssessments"); + + /** + * Static value SubAssessmentsSnapshot for EventSource. + */ + public static final EventSource SUB_ASSESSMENTS_SNAPSHOT = fromString("SubAssessmentsSnapshot"); + + /** + * Static value Alerts for EventSource. + */ + public static final EventSource ALERTS = fromString("Alerts"); + + /** + * Static value SecureScores for EventSource. + */ + public static final EventSource SECURE_SCORES = fromString("SecureScores"); + + /** + * Static value SecureScoresSnapshot for EventSource. + */ + public static final EventSource SECURE_SCORES_SNAPSHOT = fromString("SecureScoresSnapshot"); + + /** + * Static value SecureScoreControls for EventSource. + */ + public static final EventSource SECURE_SCORE_CONTROLS = fromString("SecureScoreControls"); + + /** + * Static value SecureScoreControlsSnapshot for EventSource. + */ + public static final EventSource SECURE_SCORE_CONTROLS_SNAPSHOT = fromString("SecureScoreControlsSnapshot"); + + /** + * Static value RegulatoryComplianceAssessment for EventSource. + */ + public static final EventSource REGULATORY_COMPLIANCE_ASSESSMENT = fromString("RegulatoryComplianceAssessment"); + + /** + * Static value RegulatoryComplianceAssessmentSnapshot for EventSource. + */ + public static final EventSource REGULATORY_COMPLIANCE_ASSESSMENT_SNAPSHOT + = fromString("RegulatoryComplianceAssessmentSnapshot"); + + /** + * Static value AttackPaths for EventSource. + */ + public static final EventSource ATTACK_PATHS = fromString("AttackPaths"); + + /** + * Static value AttackPathsSnapshot for EventSource. + */ + 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..b95c220f8d30 --- /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) 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; + +/** + * 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/GcpCredentialsDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java new file mode 100644 index 000000000000..33a99060890c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java @@ -0,0 +1,464 @@ +// 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; + +/** + * GCP cloud account connector based service to service credentials, the credentials are composed of the organization ID + * and a JSON API key (write only). + */ +@Fluent +public final class GcpCredentialsDetailsProperties extends AuthenticationDetailsProperties { + /* + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. + */ + private AuthenticationType authenticationType = AuthenticationType.GCP_CREDENTIALS; + + /* + * The organization ID of the GCP cloud account + */ + private String organizationId; + + /* + * Type field of the API key (write only) + */ + private String type; + + /* + * Project ID field of the API key (write only) + */ + private String projectId; + + /* + * Private key ID field of the API key (write only) + */ + private String privateKeyId; + + /* + * Private key field of the API key (write only) + */ + private String privateKey; + + /* + * Client email field of the API key (write only) + */ + private String clientEmail; + + /* + * Client ID field of the API key (write only) + */ + private String clientId; + + /* + * Auth URI field of the API key (write only) + */ + private String authUri; + + /* + * Token URI field of the API key (write only) + */ + private String tokenUri; + + /* + * Auth provider x509 certificate URL field of the API key (write only) + */ + private String authProviderX509CertUrl; + + /* + * Client x509 certificate URL field of the API key (write only) + */ + private String clientX509CertUrl; + + /** + * Creates an instance of GcpCredentialsDetailsProperties class. + */ + public GcpCredentialsDetailsProperties() { + } + + /** + * Get the authenticationType property: Connect to your cloud account, for AWS use either account credentials or + * role-based authentication. For GCP use account organization credentials. + * + * @return the authenticationType value. + */ + @Override + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Get the organizationId property: The organization ID of the GCP cloud account. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: The organization ID of the GCP cloud account. + * + * @param organizationId the organizationId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the type property: Type field of the API key (write only). + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type field of the API key (write only). + * + * @param type the type value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the projectId property: Project ID field of the API key (write only). + * + * @return the projectId value. + */ + public String projectId() { + return this.projectId; + } + + /** + * Set the projectId property: Project ID field of the API key (write only). + * + * @param projectId the projectId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Get the privateKeyId property: Private key ID field of the API key (write only). + * + * @return the privateKeyId value. + */ + public String privateKeyId() { + return this.privateKeyId; + } + + /** + * Set the privateKeyId property: Private key ID field of the API key (write only). + * + * @param privateKeyId the privateKeyId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withPrivateKeyId(String privateKeyId) { + this.privateKeyId = privateKeyId; + return this; + } + + /** + * Get the privateKey property: Private key field of the API key (write only). + * + * @return the privateKey value. + */ + public String privateKey() { + return this.privateKey; + } + + /** + * Set the privateKey property: Private key field of the API key (write only). + * + * @param privateKey the privateKey value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withPrivateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Get the clientEmail property: Client email field of the API key (write only). + * + * @return the clientEmail value. + */ + public String clientEmail() { + return this.clientEmail; + } + + /** + * Set the clientEmail property: Client email field of the API key (write only). + * + * @param clientEmail the clientEmail value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withClientEmail(String clientEmail) { + this.clientEmail = clientEmail; + return this; + } + + /** + * Get the clientId property: Client ID field of the API key (write only). + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Client ID field of the API key (write only). + * + * @param clientId the clientId value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the authUri property: Auth URI field of the API key (write only). + * + * @return the authUri value. + */ + public String authUri() { + return this.authUri; + } + + /** + * Set the authUri property: Auth URI field of the API key (write only). + * + * @param authUri the authUri value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withAuthUri(String authUri) { + this.authUri = authUri; + return this; + } + + /** + * Get the tokenUri property: Token URI field of the API key (write only). + * + * @return the tokenUri value. + */ + public String tokenUri() { + return this.tokenUri; + } + + /** + * Set the tokenUri property: Token URI field of the API key (write only). + * + * @param tokenUri the tokenUri value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withTokenUri(String tokenUri) { + this.tokenUri = tokenUri; + return this; + } + + /** + * Get the authProviderX509CertUrl property: Auth provider x509 certificate URL field of the API key (write only). + * + * @return the authProviderX509CertUrl value. + */ + public String authProviderX509CertUrl() { + return this.authProviderX509CertUrl; + } + + /** + * Set the authProviderX509CertUrl property: Auth provider x509 certificate URL field of the API key (write only). + * + * @param authProviderX509CertUrl the authProviderX509CertUrl value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withAuthProviderX509CertUrl(String authProviderX509CertUrl) { + this.authProviderX509CertUrl = authProviderX509CertUrl; + return this; + } + + /** + * Get the clientX509CertUrl property: Client x509 certificate URL field of the API key (write only). + * + * @return the clientX509CertUrl value. + */ + public String clientX509CertUrl() { + return this.clientX509CertUrl; + } + + /** + * Set the clientX509CertUrl property: Client x509 certificate URL field of the API key (write only). + * + * @param clientX509CertUrl the clientX509CertUrl value to set. + * @return the GcpCredentialsDetailsProperties object itself. + */ + public GcpCredentialsDetailsProperties withClientX509CertUrl(String clientX509CertUrl) { + this.clientX509CertUrl = clientX509CertUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (organizationId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property organizationId in model GcpCredentialsDetailsProperties")); + } + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model GcpCredentialsDetailsProperties")); + } + if (projectId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property projectId in model GcpCredentialsDetailsProperties")); + } + if (privateKeyId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privateKeyId in model GcpCredentialsDetailsProperties")); + } + if (privateKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privateKey in model GcpCredentialsDetailsProperties")); + } + if (clientEmail() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property clientEmail in model GcpCredentialsDetailsProperties")); + } + if (clientId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property clientId in model GcpCredentialsDetailsProperties")); + } + if (authUri() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property authUri in model GcpCredentialsDetailsProperties")); + } + if (tokenUri() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tokenUri in model GcpCredentialsDetailsProperties")); + } + if (authProviderX509CertUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property authProviderX509CertUrl in model GcpCredentialsDetailsProperties")); + } + if (clientX509CertUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property clientX509CertUrl in model GcpCredentialsDetailsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GcpCredentialsDetailsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationId", this.organizationId); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("projectId", this.projectId); + jsonWriter.writeStringField("privateKeyId", this.privateKeyId); + jsonWriter.writeStringField("privateKey", this.privateKey); + jsonWriter.writeStringField("clientEmail", this.clientEmail); + jsonWriter.writeStringField("clientId", this.clientId); + jsonWriter.writeStringField("authUri", this.authUri); + jsonWriter.writeStringField("tokenUri", this.tokenUri); + jsonWriter.writeStringField("authProviderX509CertUrl", this.authProviderX509CertUrl); + jsonWriter.writeStringField("clientX509CertUrl", this.clientX509CertUrl); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpCredentialsDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpCredentialsDetailsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GcpCredentialsDetailsProperties. + */ + public static GcpCredentialsDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpCredentialsDetailsProperties deserializedGcpCredentialsDetailsProperties + = new GcpCredentialsDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationProvisioningState".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.withAuthenticationProvisioningState( + AuthenticationProvisioningState.fromString(reader.getString())); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedGcpCredentialsDetailsProperties.withGrantedPermissions(grantedPermissions); + } else if ("organizationId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.organizationId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.type = reader.getString(); + } else if ("projectId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.projectId = reader.getString(); + } else if ("privateKeyId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.privateKeyId = reader.getString(); + } else if ("privateKey".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.privateKey = reader.getString(); + } else if ("clientEmail".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.clientEmail = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.clientId = reader.getString(); + } else if ("authUri".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.authUri = reader.getString(); + } else if ("tokenUri".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.tokenUri = reader.getString(); + } else if ("authProviderX509CertUrl".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.authProviderX509CertUrl = reader.getString(); + } else if ("clientX509CertUrl".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.clientX509CertUrl = reader.getString(); + } else if ("authenticationType".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpCredentialsDetailsProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalData.java new file mode 100644 index 000000000000..258cb7ae1525 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..fcd7170df607 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..2c8c07ef232b --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +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..885ac4f9a2d0 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..9a24e2439a12 --- /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) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The 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..f60c947fad02 --- /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) AutoRest 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..7db855c1ede4 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponse.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.resourcemanager.security.fluent.models.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 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..8d9ded012d3a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponseProperties.java @@ -0,0 +1,201 @@ +// 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; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * The sensitivity settings properties. + */ +@Fluent +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 UUID sensitivityThresholdLabelId; + + /* + * Microsoft information protection built-in and custom information types, labels, and integration status. + */ + private GetSensitivitySettingsResponsePropertiesMipInformation mipInformation; + + /** + * Creates an instance of GetSensitivitySettingsResponseProperties class. + */ + public GetSensitivitySettingsResponseProperties() { + } + + /** + * Get the sensitiveInfoTypesIds property: List of selected sensitive info types' IDs. + * + * @return the sensitiveInfoTypesIds value. + */ + public List sensitiveInfoTypesIds() { + return this.sensitiveInfoTypesIds; + } + + /** + * Set the sensitiveInfoTypesIds property: List of selected sensitive info types' IDs. + * + * @param sensitiveInfoTypesIds the sensitiveInfoTypesIds value to set. + * @return the GetSensitivitySettingsResponseProperties object itself. + */ + public GetSensitivitySettingsResponseProperties withSensitiveInfoTypesIds(List sensitiveInfoTypesIds) { + this.sensitiveInfoTypesIds = sensitiveInfoTypesIds; + return this; + } + + /** + * 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; + } + + /** + * Set 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. + * + * @param sensitivityThresholdLabelOrder the sensitivityThresholdLabelOrder value to set. + * @return the GetSensitivitySettingsResponseProperties object itself. + */ + public GetSensitivitySettingsResponseProperties + withSensitivityThresholdLabelOrder(Float sensitivityThresholdLabelOrder) { + this.sensitivityThresholdLabelOrder = sensitivityThresholdLabelOrder; + return this; + } + + /** + * 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 UUID sensitivityThresholdLabelId() { + return this.sensitivityThresholdLabelId; + } + + /** + * Set the sensitivityThresholdLabelId property: The id of the sensitivity threshold label. Any label at or above + * this rank will be considered sensitive. + * + * @param sensitivityThresholdLabelId the sensitivityThresholdLabelId value to set. + * @return the GetSensitivitySettingsResponseProperties object itself. + */ + public GetSensitivitySettingsResponseProperties withSensitivityThresholdLabelId(UUID sensitivityThresholdLabelId) { + this.sensitivityThresholdLabelId = sensitivityThresholdLabelId; + return this; + } + + /** + * 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; + } + + /** + * Set the mipInformation property: Microsoft information protection built-in and custom information types, labels, + * and integration status. + * + * @param mipInformation the mipInformation value to set. + * @return the GetSensitivitySettingsResponseProperties object itself. + */ + public GetSensitivitySettingsResponseProperties + withMipInformation(GetSensitivitySettingsResponsePropertiesMipInformation mipInformation) { + this.mipInformation = mipInformation; + return this; + } + + /** + * 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(Objects.toString(element, null))); + jsonWriter.writeNumberField("sensitivityThresholdLabelOrder", this.sensitivityThresholdLabelOrder); + jsonWriter.writeStringField("sensitivityThresholdLabelId", + Objects.toString(this.sensitivityThresholdLabelId, null)); + jsonWriter.writeJsonField("mipInformation", this.mipInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetSensitivitySettingsResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetSensitivitySettingsResponseProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GetSensitivitySettingsResponseProperties. + */ + public static GetSensitivitySettingsResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetSensitivitySettingsResponseProperties deserializedGetSensitivitySettingsResponseProperties + = new GetSensitivitySettingsResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sensitiveInfoTypesIds".equals(fieldName)) { + List sensitiveInfoTypesIds = reader.readArray( + reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()))); + deserializedGetSensitivitySettingsResponseProperties.sensitiveInfoTypesIds = sensitiveInfoTypesIds; + } else if ("sensitivityThresholdLabelOrder".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.sensitivityThresholdLabelOrder + = reader.getNullable(JsonReader::getFloat); + } else if ("sensitivityThresholdLabelId".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.sensitivityThresholdLabelId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("mipInformation".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.mipInformation + = GetSensitivitySettingsResponsePropertiesMipInformation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGetSensitivitySettingsResponseProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java new file mode 100644 index 000000000000..b4197d36609d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java @@ -0,0 +1,202 @@ +// 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; +import java.util.List; + +/** + * Microsoft information protection built-in and custom information types, labels, and integration status. + */ +@Fluent +public final class GetSensitivitySettingsResponsePropertiesMipInformation + implements JsonSerializable { + /* + * Microsoft information protection integration status + */ + private MipIntegrationStatus mipIntegrationStatus; + + /* + * List of Microsoft information protection sensitivity labels + */ + private List