From 080a4624ae61fe00670b5b2882d5539a55f78335 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 27 Jan 2021 17:53:21 +0000 Subject: [PATCH] CodeGen from PR 12661 in Azure/azure-rest-api-specs Merge 7dd4b92112946938e1e80c403605af6b238d5271 into 510bbe951a14d183b553ae9b64b514687842c64c --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 99 + .../pom.xml | 62 + .../policyinsights/PolicyInsightsManager.java | 299 + .../fluent/AttestationsClient.java | 431 ++ .../fluent/OperationsClient.java | 36 + .../fluent/PolicyEventsClient.java | 423 ++ .../fluent/PolicyInsightsClient.java | 95 + .../fluent/PolicyMetadatasClient.java | 64 + .../fluent/PolicyRestrictionsClient.java | 72 + .../fluent/PolicyStatesClient.java | 883 +++ .../fluent/PolicyTrackedResourcesClient.java | 123 + .../fluent/RemediationsClient.java | 682 ++ .../fluent/models/AttestationInner.java | 288 + .../models/CheckRestrictionsResultInner.java | 65 + .../models/OperationsListResultsInner.java | 81 + .../fluent/models/PolicyEventInner.java | 907 +++ .../fluent/models/PolicyMetadataInner.java | 191 + .../fluent/models/PolicyStateInner.java | 954 +++ .../models/PolicyTrackedResourceInner.java | 114 + .../models/RemediationDeploymentInner.java | 131 + .../fluent/models/RemediationInner.java | 210 + .../models/SlimPolicyMetadataInner.java | 161 + .../fluent/models/SummarizeResultsInner.java | 111 + .../fluent/models/package-info.java | 6 + .../policyinsights/fluent/package-info.java | 6 + .../implementation/AttestationImpl.java | 204 + .../AttestationsClientImpl.java | 2582 +++++++ .../implementation/AttestationsImpl.java | 284 + .../CheckRestrictionsResultImpl.java | 45 + .../implementation/OperationsClientImpl.java | 157 + .../implementation/OperationsImpl.java | 59 + .../OperationsListResultsImpl.java | 44 + .../implementation/PolicyEventImpl.java | 171 + .../PolicyEventsClientImpl.java | 3827 ++++++++++ .../implementation/PolicyEventsImpl.java | 303 + .../PolicyInsightsClientBuilder.java | 146 + .../PolicyInsightsClientImpl.java | 378 + .../implementation/PolicyMetadataImpl.java | 72 + .../PolicyMetadatasClientImpl.java | 410 + .../implementation/PolicyMetadatasImpl.java | 72 + .../PolicyRestrictionsClientImpl.java | 383 + .../PolicyRestrictionsImpl.java | 88 + .../implementation/PolicyStateImpl.java | 189 + .../PolicyStatesClientImpl.java | 6639 +++++++++++++++++ .../implementation/PolicyStatesImpl.java | 637 ++ .../PolicyTrackedResourceImpl.java | 51 + .../PolicyTrackedResourcesClientImpl.java | 1253 ++++ .../PolicyTrackedResourcesImpl.java | 86 + .../RemediationDeploymentImpl.java | 58 + .../implementation/RemediationImpl.java | 182 + .../RemediationsClientImpl.java | 4925 ++++++++++++ .../implementation/RemediationsImpl.java | 577 ++ .../SlimPolicyMetadataImpl.java | 64 + .../implementation/SummarizeResultsImpl.java | 48 + .../policyinsights/implementation/Utils.java | 67 + .../implementation/package-info.java | 6 + .../policyinsights/models/Attestation.java | 375 + .../models/AttestationEvidence.java | 76 + .../models/AttestationListResult.java | 59 + .../policyinsights/models/Attestations.java | 336 + .../models/CheckRestrictionsRequest.java | 91 + .../CheckRestrictionsResourceDetails.java | 115 + .../models/CheckRestrictionsResult.java | 33 + ...rictionsResultContentEvaluationResult.java | 59 + .../models/ComplianceDetail.java | 76 + .../models/ComplianceState.java | 37 + .../models/ComponentEventDetails.java | 248 + .../models/ComponentStateDetails.java | 193 + .../policyinsights/models/CreatedByType.java | 40 + .../models/ExpressionEvaluationDetails.java | 195 + .../models/FieldRestriction.java | 89 + .../models/FieldRestrictionResult.java | 37 + .../models/FieldRestrictions.java | 71 + .../models/IfNotExistsEvaluationDetails.java | 77 + .../policyinsights/models/Operation.java | 79 + .../models/OperationDisplay.java | 128 + .../policyinsights/models/Operations.java | 31 + .../models/OperationsListResults.java | 32 + .../policyinsights/models/PendingField.java | 88 + .../models/PolicyAssignmentSummary.java | 164 + .../models/PolicyDefinitionSummary.java | 158 + .../policyinsights/models/PolicyDetails.java | 115 + .../models/PolicyEvaluationDetails.java | 83 + .../models/PolicyEvaluationResult.java | 80 + .../policyinsights/models/PolicyEvent.java | 255 + .../policyinsights/models/PolicyEvents.java | 403 + .../models/PolicyEventsQueryResults.java | 137 + .../models/PolicyGroupSummary.java | 79 + .../policyinsights/models/PolicyMetadata.java | 94 + .../models/PolicyMetadataCollection.java | 59 + .../models/PolicyMetadataProperties.java | 56 + .../models/PolicyMetadataSlimProperties.java | 114 + .../models/PolicyMetadatas.java | 56 + .../models/PolicyReference.java | 86 + .../models/PolicyRestrictions.java | 63 + .../policyinsights/models/PolicyState.java | 275 + .../policyinsights/models/PolicyStates.java | 785 ++ .../models/PolicyStatesQueryResults.java | 137 + .../models/PolicyStatesResource.java | 34 + .../models/PolicyTrackedResource.java | 54 + .../models/PolicyTrackedResources.java | 111 + .../PolicyTrackedResourcesQueryResults.java | 59 + .../policyinsights/models/Remediation.java | 284 + .../models/RemediationDeployment.java | 68 + .../models/RemediationDeploymentSummary.java | 71 + .../RemediationDeploymentsListResult.java | 59 + .../models/RemediationFilters.java | 51 + .../models/RemediationListResult.java | 59 + .../policyinsights/models/Remediations.java | 656 ++ .../models/ResourceDiscoveryMode.java | 34 + .../models/SlimPolicyMetadata.java | 80 + .../models/SummarizeResults.java | 40 + .../policyinsights/models/Summary.java | 139 + .../policyinsights/models/SummaryResults.java | 201 + .../policyinsights/models/SystemData.java | 181 + .../TrackedResourceModificationDetails.java | 74 + .../policyinsights/models/TypedErrorInfo.java | 54 + .../policyinsights/models/package-info.java | 6 + .../policyinsights/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/policyinsights/ci.yml | 31 + sdk/policyinsights/pom.xml | 53 + 125 files changed, 38696 insertions(+) create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/README.md create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/AttestationsClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/OperationsClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyEventsClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyInsightsClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyMetadatasClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyRestrictionsClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyStatesClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyTrackedResourcesClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/RemediationsClient.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/AttestationInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/CheckRestrictionsResultInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/OperationsListResultsInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyEventInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyMetadataInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyStateInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyTrackedResourceInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationDeploymentInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SlimPolicyMetadataInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SummarizeResultsInner.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/package-info.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/package-info.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/CheckRestrictionsResultImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsListResultsImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientBuilder.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadataImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStateImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourceImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationDeploymentImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SlimPolicyMetadataImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SummarizeResultsImpl.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/Utils.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/package-info.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestation.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationEvidence.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationListResult.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestations.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsRequest.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResourceDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResult.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResultContentEvaluationResult.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceDetail.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceState.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentEventDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentStateDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CreatedByType.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ExpressionEvaluationDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestriction.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictionResult.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictions.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/IfNotExistsEvaluationDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operation.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationDisplay.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operations.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationsListResults.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PendingField.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyAssignmentSummary.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDefinitionSummary.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationResult.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvent.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvents.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEventsQueryResults.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyGroupSummary.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadata.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataCollection.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataProperties.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataSlimProperties.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadatas.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyReference.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyRestrictions.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyState.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStates.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesQueryResults.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesResource.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResource.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResources.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResourcesQueryResults.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeployment.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentSummary.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentsListResult.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationFilters.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationListResult.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediations.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ResourceDiscoveryMode.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SlimPolicyMetadata.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummarizeResults.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Summary.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummaryResults.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SystemData.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TrackedResourceModificationDetails.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TypedErrorInfo.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/package-info.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/package-info.java create mode 100644 sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/module-info.java create mode 100644 sdk/policyinsights/ci.yml create mode 100644 sdk/policyinsights/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 05707e4f684e..e93a2b6e1495 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -195,6 +195,7 @@ com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthbot;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-confluent;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-policyinsights;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index 0d1c2a17109a..df865ae9279d 100644 --- a/pom.xml +++ b/pom.xml @@ -571,6 +571,7 @@ sdk/metricsadvisor sdk/monitor sdk/mysql + sdk/policyinsights sdk/postgresql sdk/recoveryservices sdk/relay diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md new file mode 100644 index 000000000000..404b7ec52dc6 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-01-27) + +- Azure Resource Manager PolicyInsights client library for Java. This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md new file mode 100644 index 000000000000..e7533eba40a4 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager PolicyInsights client library for Java + +Azure Resource Manager PolicyInsights client library for Java. + +This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-policyinsights;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-policyinsights + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PolicyInsightsManager manager = PolicyInsightsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml new file mode 100644 index 000000000000..c4ded651fbd4 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-policyinsights + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for PolicyInsights Management + This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-01. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core-management + 1.1.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java new file mode 100644 index 000000000000..13a406cbe432 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/PolicyInsightsManager.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +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.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.PolicyInsightsClient; +import com.azure.resourcemanager.policyinsights.implementation.AttestationsImpl; +import com.azure.resourcemanager.policyinsights.implementation.OperationsImpl; +import com.azure.resourcemanager.policyinsights.implementation.PolicyEventsImpl; +import com.azure.resourcemanager.policyinsights.implementation.PolicyInsightsClientBuilder; +import com.azure.resourcemanager.policyinsights.implementation.PolicyMetadatasImpl; +import com.azure.resourcemanager.policyinsights.implementation.PolicyRestrictionsImpl; +import com.azure.resourcemanager.policyinsights.implementation.PolicyStatesImpl; +import com.azure.resourcemanager.policyinsights.implementation.PolicyTrackedResourcesImpl; +import com.azure.resourcemanager.policyinsights.implementation.RemediationsImpl; +import com.azure.resourcemanager.policyinsights.models.Attestations; +import com.azure.resourcemanager.policyinsights.models.Operations; +import com.azure.resourcemanager.policyinsights.models.PolicyEvents; +import com.azure.resourcemanager.policyinsights.models.PolicyMetadatas; +import com.azure.resourcemanager.policyinsights.models.PolicyRestrictions; +import com.azure.resourcemanager.policyinsights.models.PolicyStates; +import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResources; +import com.azure.resourcemanager.policyinsights.models.Remediations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to PolicyInsightsManager. */ +public final class PolicyInsightsManager { + private PolicyTrackedResources policyTrackedResources; + + private Remediations remediations; + + private PolicyEvents policyEvents; + + private PolicyStates policyStates; + + private Operations operations; + + private PolicyMetadatas policyMetadatas; + + private PolicyRestrictions policyRestrictions; + + private Attestations attestations; + + private final PolicyInsightsClient clientObject; + + private PolicyInsightsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new PolicyInsightsClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of PolicyInsights service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PolicyInsights service API instance. + */ + public static PolicyInsightsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create PolicyInsightsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PolicyInsightsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of PolicyInsights service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PolicyInsights service API instance. + */ + public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.policyinsights") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new PolicyInsightsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of PolicyTrackedResources. */ + public PolicyTrackedResources policyTrackedResources() { + if (this.policyTrackedResources == null) { + this.policyTrackedResources = + new PolicyTrackedResourcesImpl(clientObject.getPolicyTrackedResources(), this); + } + return policyTrackedResources; + } + + /** @return Resource collection API of Remediations. */ + public Remediations remediations() { + if (this.remediations == null) { + this.remediations = new RemediationsImpl(clientObject.getRemediations(), this); + } + return remediations; + } + + /** @return Resource collection API of PolicyEvents. */ + public PolicyEvents policyEvents() { + if (this.policyEvents == null) { + this.policyEvents = new PolicyEventsImpl(clientObject.getPolicyEvents(), this); + } + return policyEvents; + } + + /** @return Resource collection API of PolicyStates. */ + public PolicyStates policyStates() { + if (this.policyStates == null) { + this.policyStates = new PolicyStatesImpl(clientObject.getPolicyStates(), this); + } + return policyStates; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of PolicyMetadatas. */ + public PolicyMetadatas policyMetadatas() { + if (this.policyMetadatas == null) { + this.policyMetadatas = new PolicyMetadatasImpl(clientObject.getPolicyMetadatas(), this); + } + return policyMetadatas; + } + + /** @return Resource collection API of PolicyRestrictions. */ + public PolicyRestrictions policyRestrictions() { + if (this.policyRestrictions == null) { + this.policyRestrictions = new PolicyRestrictionsImpl(clientObject.getPolicyRestrictions(), this); + } + return policyRestrictions; + } + + /** @return Resource collection API of Attestations. */ + public Attestations attestations() { + if (this.attestations == null) { + this.attestations = new AttestationsImpl(clientObject.getAttestations(), this); + } + return attestations; + } + + /** + * @return Wrapped service client PolicyInsightsClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public PolicyInsightsClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/AttestationsClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/AttestationsClient.java new file mode 100644 index 000000000000..7529938c55f9 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/AttestationsClient.java @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.models.AttestationInner; + +/** An instance of this class provides access to all the operations defined in AttestationsClient. */ +public interface AttestationsClient { + /** + * Gets all attestations 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 all attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all attestations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, String filter, Context context); + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( + String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( + String attestationName, AttestationInner parameters, Context context); + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner createOrUpdateAtSubscription(String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner createOrUpdateAtSubscription(String attestationName, AttestationInner parameters, Context context); + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner getAtSubscription(String attestationName); + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtSubscriptionWithResponse(String attestationName, Context context); + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteAtSubscription(String attestationName); + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + Response deleteAtSubscriptionWithResponse(String attestationName, Context context); + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context); + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters, Context context); + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner createOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner createOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters, Context context); + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner getByResourceGroup(String resourceGroupName, String attestationName); + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String attestationName, Context context); + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 attestationName); + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + Response deleteWithResponse(String resourceGroupName, String attestationName, Context context); + + /** + * Gets all attestations for a resource. + * + * @param resourceId 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 all attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForResource(String resourceId); + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForResource(String resourceId, Integer top, String filter, Context context); + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters, Context context); + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner createOrUpdateAtResource(String resourceId, String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner createOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters, Context context); + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationInner getAtResource(String resourceId, String attestationName); + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtResourceWithResponse(String resourceId, String attestationName, Context context); + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteAtResource(String resourceId, String attestationName); + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + Response deleteAtResourceWithResponse(String resourceId, String attestationName, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/OperationsClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/OperationsClient.java new file mode 100644 index 000000000000..fd08a116756e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/OperationsClient.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.policyinsights.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.policyinsights.fluent.models.OperationsListResultsInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists available operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationsListResultsInner list(); + + /** + * Lists available operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyEventsClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyEventsClient.java new file mode 100644 index 000000000000..3d264be6c247 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyEventsClient.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.models.PolicyEventInner; +import java.time.OffsetDateTime; + +/** An instance of this class provides access to all the operations defined in PolicyEventsClient. */ +public interface PolicyEventsClient { + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForManagementGroup(String managementGroupName); + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscription(String subscriptionId); + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscription( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName); + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroup( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resource. + * + * @param resourceId 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResource(String resourceId); + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResource( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context); + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, String policySetDefinitionName); + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicyDefinition( + String subscriptionId, String policyDefinitionName); + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicyDefinition( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, String policyAssignmentName); + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName); + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyInsightsClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyInsightsClient.java new file mode 100644 index 000000000000..449fb204e1b5 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyInsightsClient.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.policyinsights.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for PolicyInsightsClient class. */ +public interface PolicyInsightsClient { + /** + * Gets Microsoft Azure subscription ID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the PolicyTrackedResourcesClient object to access its operations. + * + * @return the PolicyTrackedResourcesClient object. + */ + PolicyTrackedResourcesClient getPolicyTrackedResources(); + + /** + * Gets the RemediationsClient object to access its operations. + * + * @return the RemediationsClient object. + */ + RemediationsClient getRemediations(); + + /** + * Gets the PolicyEventsClient object to access its operations. + * + * @return the PolicyEventsClient object. + */ + PolicyEventsClient getPolicyEvents(); + + /** + * Gets the PolicyStatesClient object to access its operations. + * + * @return the PolicyStatesClient object. + */ + PolicyStatesClient getPolicyStates(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PolicyMetadatasClient object to access its operations. + * + * @return the PolicyMetadatasClient object. + */ + PolicyMetadatasClient getPolicyMetadatas(); + + /** + * Gets the PolicyRestrictionsClient object to access its operations. + * + * @return the PolicyRestrictionsClient object. + */ + PolicyRestrictionsClient getPolicyRestrictions(); + + /** + * Gets the AttestationsClient object to access its operations. + * + * @return the AttestationsClient object. + */ + AttestationsClient getAttestations(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyMetadatasClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyMetadatasClient.java new file mode 100644 index 000000000000..9a2b70311eaa --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyMetadatasClient.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.policyinsights.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.policyinsights.fluent.models.PolicyMetadataInner; +import com.azure.resourcemanager.policyinsights.fluent.models.SlimPolicyMetadataInner; + +/** An instance of this class provides access to all the operations defined in PolicyMetadatasClient. */ +public interface PolicyMetadatasClient { + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PolicyMetadataInner getResource(String resourceName); + + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getResourceWithResponse(String resourceName, Context context); + + /** + * Get a list of the policy metadata resources. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of the policy metadata resources. + * + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyRestrictionsClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyRestrictionsClient.java new file mode 100644 index 000000000000..a08ccecbf477 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyRestrictionsClient.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.policyinsights.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.policyinsights.fluent.models.CheckRestrictionsResultInner; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsRequest; + +/** An instance of this class provides access to all the operations defined in PolicyRestrictionsClient. */ +public interface PolicyRestrictionsClient { + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckRestrictionsResultInner checkAtSubscriptionScope(CheckRestrictionsRequest parameters); + + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkAtSubscriptionScopeWithResponse( + CheckRestrictionsRequest parameters, Context context); + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckRestrictionsResultInner checkAtResourceGroupScope( + String resourceGroupName, CheckRestrictionsRequest parameters); + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkAtResourceGroupScopeWithResponse( + String resourceGroupName, CheckRestrictionsRequest parameters, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyStatesClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyStatesClient.java new file mode 100644 index 000000000000..9d59dc2cca76 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyStatesClient.java @@ -0,0 +1,883 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.models.PolicyStateInner; +import com.azure.resourcemanager.policyinsights.fluent.models.SummarizeResultsInner; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; +import java.time.OffsetDateTime; + +/** An instance of this class provides access to all the operations defined in PolicyStatesClient. */ +public interface PolicyStatesClient { + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, String managementGroupName); + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForManagementGroup(String managementGroupName); + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForManagementGroupWithResponse( + String managementGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, String subscriptionId); + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForSubscription(String subscriptionId); + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForSubscriptionWithResponse( + String subscriptionId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context); + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName); + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForResourceGroup(String subscriptionId, String resourceGroupName); + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForResourceGroupWithResponse( + String subscriptionId, + String resourceGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, String resourceId); + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resource. + * + * @param resourceId 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForResource(String resourceId); + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForResourceWithResponse( + String resourceId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context); + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTriggerSubscriptionEvaluation(String subscriptionId); + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTriggerSubscriptionEvaluation(String subscriptionId, Context context); + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerSubscriptionEvaluation(String subscriptionId); + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerSubscriptionEvaluation(String subscriptionId, Context context); + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTriggerResourceGroupEvaluation( + String subscriptionId, String resourceGroupName); + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTriggerResourceGroupEvaluation( + String subscriptionId, String resourceGroupName, Context context); + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName); + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName, Context context); + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName); + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName); + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForPolicySetDefinitionWithResponse( + String subscriptionId, + String policySetDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName); + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName); + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForPolicyDefinitionWithResponse( + String subscriptionId, + String policyDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName); + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment( + String subscriptionId, String policyAssignmentName); + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForSubscriptionLevelPolicyAssignmentWithResponse( + String subscriptionId, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName); + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SummarizeResultsInner summarizeForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName); + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response summarizeForResourceGroupLevelPolicyAssignmentWithResponse( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyTrackedResourcesClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyTrackedResourcesClient.java new file mode 100644 index 000000000000..b5d666030045 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/PolicyTrackedResourcesClient.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.policyinsights.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.policyinsights.fluent.models.PolicyTrackedResourceInner; + +/** An instance of this class provides access to all the operations defined in PolicyTrackedResourcesClient. */ +public interface PolicyTrackedResourcesClient { + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForManagementGroup(String managementGroupName); + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, Integer top, String filter, Context context); + + /** + * Queries policy tracked resources under 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscription(); + + /** + * Queries policy tracked resources under the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForSubscription( + Integer top, String filter, Context context); + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroup(String resourceGroupName); + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResourceGroup( + String resourceGroupName, Integer top, String filter, Context context); + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResource(String resourceId); + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listQueryResultsForResource( + String resourceId, Integer top, String filter, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/RemediationsClient.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/RemediationsClient.java new file mode 100644 index 000000000000..9e0e7fcaf5b8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/RemediationsClient.java @@ -0,0 +1,682 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.models.RemediationDeploymentInner; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; + +/** An instance of this class provides access to all the operations defined in RemediationsClient. */ +public interface RemediationsClient { + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName); + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName, Integer top, Context context); + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner cancelAtManagementGroup(String managementGroupId, String remediationName); + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context); + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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 all remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForManagementGroup(String managementGroupId); + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForManagementGroup( + String managementGroupId, Integer top, String filter, Context context); + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner createOrUpdateAtManagementGroup( + String managementGroupId, String remediationName, RemediationInner parameters); + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateAtManagementGroupWithResponse( + String managementGroupId, String remediationName, RemediationInner parameters, Context context); + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner getAtManagementGroup(String managementGroupId, String remediationName); + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context); + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner deleteAtManagementGroup(String managementGroupId, String remediationName); + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context); + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtSubscription(String remediationName); + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtSubscription( + String remediationName, Integer top, Context context); + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner cancelAtSubscription(String remediationName); + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtSubscriptionWithResponse(String remediationName, Context context); + + /** + * Gets all remediations 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 all remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all remediations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, String filter, Context context); + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner createOrUpdateAtSubscription(String remediationName, RemediationInner parameters); + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateAtSubscriptionWithResponse( + String remediationName, RemediationInner parameters, Context context); + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner getAtSubscription(String remediationName); + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtSubscriptionWithResponse(String remediationName, Context context); + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner deleteAtSubscription(String remediationName); + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteAtSubscriptionWithResponse(String remediationName, Context context); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName, Integer top, Context context); + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner cancelAtResourceGroup(String resourceGroupName, String remediationName); + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context); + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group 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 all remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context); + + /** + * Creates or updates a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner createOrUpdateAtResourceGroup( + String resourceGroupName, String remediationName, RemediationInner parameters); + + /** + * Creates or updates a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateAtResourceGroupWithResponse( + String resourceGroupName, String remediationName, RemediationInner parameters, Context context); + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner getByResourceGroup(String resourceGroupName, String remediationName); + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context); + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner delete(String resourceGroupName, String remediationName); + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String remediationName, Context context); + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtResource(String resourceId, String remediationName); + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeploymentsAtResource( + String resourceId, String remediationName, Integer top, Context context); + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner cancelAtResource(String resourceId, String remediationName); + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelAtResourceWithResponse(String resourceId, String remediationName, Context context); + + /** + * Gets all remediations for a resource. + * + * @param resourceId 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 all remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForResource(String resourceId); + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForResource(String resourceId, Integer top, String filter, Context context); + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner createOrUpdateAtResource(String resourceId, String remediationName, RemediationInner parameters); + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateAtResourceWithResponse( + String resourceId, String remediationName, RemediationInner parameters, Context context); + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner getAtResource(String resourceId, String remediationName); + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAtResourceWithResponse(String resourceId, String remediationName, Context context); + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RemediationInner deleteAtResource(String resourceId, String remediationName); + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteAtResourceWithResponse(String resourceId, String remediationName, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/AttestationInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/AttestationInner.java new file mode 100644 index 000000000000..9c25e9db3e35 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/AttestationInner.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import com.azure.resourcemanager.policyinsights.models.SystemData; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** An attestation resource. */ +@JsonFlatten +@Fluent +public class AttestationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationInner.class); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The resource ID of the policy assignment that the attestation is setting + * the state for. + */ + @JsonProperty(value = "properties.policyAssignmentId", required = true) + private String policyAssignmentId; + + /* + * The policy definition reference ID from a policy set definition that the + * attestation is setting the state for. If the policy assignment assigns a + * policy set definition the attestation can choose a definition within the + * set definition with this property or omit this and set the state for the + * entire set definition. + */ + @JsonProperty(value = "properties.policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /* + * The compliance state that should be set on the resource. + */ + @JsonProperty(value = "properties.complianceState") + private ComplianceState complianceState; + + /* + * The time the compliance state should expire. + */ + @JsonProperty(value = "properties.expiresOn") + private OffsetDateTime expiresOn; + + /* + * The person responsible for setting the state of the resource. This value + * is typically an Azure Active Directory object ID. + */ + @JsonProperty(value = "properties.owner") + private String owner; + + /* + * Comments describing why this attestation was created. + */ + @JsonProperty(value = "properties.comments") + private String comments; + + /* + * The evidence supporting the compliance state set in this attestation. + */ + @JsonProperty(value = "properties.evidence") + private List evidence; + + /* + * The status of the attestation. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The time the compliance state was last changed in this attestation. + */ + @JsonProperty(value = "properties.lastComplianceStateChangeAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastComplianceStateChangeAt; + + /** + * 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 policyAssignmentId property: The resource ID of the policy assignment that the attestation is setting the + * state for. + * + * @return the policyAssignmentId value. + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the policyAssignmentId property: The resource ID of the policy assignment that the attestation is setting the + * state for. + * + * @param policyAssignmentId the policyAssignmentId value to set. + * @return the AttestationInner object itself. + */ + public AttestationInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policyDefinitionReferenceId property: The policy definition reference ID from a policy set definition + * that the attestation is setting the state for. If the policy assignment assigns a policy set definition the + * attestation can choose a definition within the set definition with this property or omit this and set the state + * for the entire set definition. + * + * @return the policyDefinitionReferenceId value. + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policyDefinitionReferenceId property: The policy definition reference ID from a policy set definition + * that the attestation is setting the state for. If the policy assignment assigns a policy set definition the + * attestation can choose a definition within the set definition with this property or omit this and set the state + * for the entire set definition. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set. + * @return the AttestationInner object itself. + */ + public AttestationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the complianceState property: The compliance state that should be set on the resource. + * + * @return the complianceState value. + */ + public ComplianceState complianceState() { + return this.complianceState; + } + + /** + * Set the complianceState property: The compliance state that should be set on the resource. + * + * @param complianceState the complianceState value to set. + * @return the AttestationInner object itself. + */ + public AttestationInner withComplianceState(ComplianceState complianceState) { + this.complianceState = complianceState; + return this; + } + + /** + * Get the expiresOn property: The time the compliance state should expire. + * + * @return the expiresOn value. + */ + public OffsetDateTime expiresOn() { + return this.expiresOn; + } + + /** + * Set the expiresOn property: The time the compliance state should expire. + * + * @param expiresOn the expiresOn value to set. + * @return the AttestationInner object itself. + */ + public AttestationInner withExpiresOn(OffsetDateTime expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Get the owner property: The person responsible for setting the state of the resource. This value is typically an + * Azure Active Directory object ID. + * + * @return the owner value. + */ + public String owner() { + return this.owner; + } + + /** + * Set the owner property: The person responsible for setting the state of the resource. This value is typically an + * Azure Active Directory object ID. + * + * @param owner the owner value to set. + * @return the AttestationInner object itself. + */ + public AttestationInner withOwner(String owner) { + this.owner = owner; + return this; + } + + /** + * Get the comments property: Comments describing why this attestation was created. + * + * @return the comments value. + */ + public String comments() { + return this.comments; + } + + /** + * Set the comments property: Comments describing why this attestation was created. + * + * @param comments the comments value to set. + * @return the AttestationInner object itself. + */ + public AttestationInner withComments(String comments) { + this.comments = comments; + return this; + } + + /** + * Get the evidence property: The evidence supporting the compliance state set in this attestation. + * + * @return the evidence value. + */ + public List evidence() { + return this.evidence; + } + + /** + * Set the evidence property: The evidence supporting the compliance state set in this attestation. + * + * @param evidence the evidence value to set. + * @return the AttestationInner object itself. + */ + public AttestationInner withEvidence(List evidence) { + this.evidence = evidence; + return this; + } + + /** + * Get the provisioningState property: The status of the attestation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastComplianceStateChangeAt property: The time the compliance state was last changed in this attestation. + * + * @return the lastComplianceStateChangeAt value. + */ + public OffsetDateTime lastComplianceStateChangeAt() { + return this.lastComplianceStateChangeAt; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (systemData() != null) { + systemData().validate(); + } + if (policyAssignmentId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property policyAssignmentId in model AttestationInner")); + } + if (evidence() != null) { + evidence().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/CheckRestrictionsResultInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/CheckRestrictionsResultInner.java new file mode 100644 index 000000000000..70ec0ae7e3b4 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/CheckRestrictionsResultInner.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResultContentEvaluationResult; +import com.azure.resourcemanager.policyinsights.models.FieldRestrictions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of a check policy restrictions evaluation on a resource. */ +@Immutable +public final class CheckRestrictionsResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckRestrictionsResultInner.class); + + /* + * The restrictions that will be placed on various fields in the resource + * by policy. + */ + @JsonProperty(value = "fieldRestrictions", access = JsonProperty.Access.WRITE_ONLY) + private List fieldRestrictions; + + /* + * Evaluation results for the provided partial resource content. + */ + @JsonProperty(value = "contentEvaluationResult", access = JsonProperty.Access.WRITE_ONLY) + private CheckRestrictionsResultContentEvaluationResult contentEvaluationResult; + + /** + * Get the fieldRestrictions property: The restrictions that will be placed on various fields in the resource by + * policy. + * + * @return the fieldRestrictions value. + */ + public List fieldRestrictions() { + return this.fieldRestrictions; + } + + /** + * Get the contentEvaluationResult property: Evaluation results for the provided partial resource content. + * + * @return the contentEvaluationResult value. + */ + public CheckRestrictionsResultContentEvaluationResult contentEvaluationResult() { + return this.contentEvaluationResult; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (fieldRestrictions() != null) { + fieldRestrictions().forEach(e -> e.validate()); + } + if (contentEvaluationResult() != null) { + contentEvaluationResult().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/OperationsListResultsInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/OperationsListResultsInner.java new file mode 100644 index 000000000000..dc796d05fa03 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/OperationsListResultsInner.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.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.Operation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of available operations. */ +@Fluent +public final class OperationsListResultsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsListResultsInner.class); + + /* + * OData entity count; represents the number of operations returned. + */ + @JsonProperty(value = "@odata.count") + private Integer odataCount; + + /* + * List of available operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the odataCount property: OData entity count; represents the number of operations returned. + * + * @return the odataCount value. + */ + public Integer odataCount() { + return this.odataCount; + } + + /** + * Set the odataCount property: OData entity count; represents the number of operations returned. + * + * @param odataCount the odataCount value to set. + * @return the OperationsListResultsInner object itself. + */ + public OperationsListResultsInner withOdataCount(Integer odataCount) { + this.odataCount = odataCount; + return this; + } + + /** + * Get the value property: List of available operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of available operations. + * + * @param value the value value to set. + * @return the OperationsListResultsInner object itself. + */ + public OperationsListResultsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyEventInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyEventInner.java new file mode 100644 index 000000000000..06aced09743c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyEventInner.java @@ -0,0 +1,907 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.ComponentEventDetails; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** Policy event record. */ +@Fluent +public final class PolicyEventInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyEventInner.class); + + /* + * OData entity ID; always set to null since policy event records do not + * have an entity ID. + */ + @JsonProperty(value = "@odata.id") + private String odataId; + + /* + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata.context") + private String odataContext; + + /* + * Timestamp for the policy event record. + */ + @JsonProperty(value = "timestamp") + private OffsetDateTime timestamp; + + /* + * Resource ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /* + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /* + * Effective parameters for the policy assignment. + */ + @JsonProperty(value = "effectiveParameters") + private String effectiveParameters; + + /* + * Flag which states whether the resource is compliant against the policy + * assignment it was evaluated against. + */ + @JsonProperty(value = "isCompliant") + private Boolean isCompliant; + + /* + * Subscription ID. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * Resource location. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /* + * Resource group name. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /* + * List of resource tags. + */ + @JsonProperty(value = "resourceTags") + private String resourceTags; + + /* + * Policy assignment name. + */ + @JsonProperty(value = "policyAssignmentName") + private String policyAssignmentName; + + /* + * Policy assignment owner. + */ + @JsonProperty(value = "policyAssignmentOwner") + private String policyAssignmentOwner; + + /* + * Policy assignment parameters. + */ + @JsonProperty(value = "policyAssignmentParameters") + private String policyAssignmentParameters; + + /* + * Policy assignment scope. + */ + @JsonProperty(value = "policyAssignmentScope") + private String policyAssignmentScope; + + /* + * Policy definition name. + */ + @JsonProperty(value = "policyDefinitionName") + private String policyDefinitionName; + + /* + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /* + * Policy definition category. + */ + @JsonProperty(value = "policyDefinitionCategory") + private String policyDefinitionCategory; + + /* + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /* + * Policy set definition name, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionName") + private String policySetDefinitionName; + + /* + * Policy set definition owner, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionOwner") + private String policySetDefinitionOwner; + + /* + * Policy set definition category, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionCategory") + private String policySetDefinitionCategory; + + /* + * Policy set definition parameters, if the policy assignment is for a + * policy set. + */ + @JsonProperty(value = "policySetDefinitionParameters") + private String policySetDefinitionParameters; + + /* + * Comma separated list of management group IDs, which represent the + * hierarchy of the management groups the resource is under. + */ + @JsonProperty(value = "managementGroupIds") + private String managementGroupIds; + + /* + * Reference ID for the policy definition inside the policy set, if the + * policy assignment is for a policy set. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /* + * Compliance state of the resource. + */ + @JsonProperty(value = "complianceState") + private String complianceState; + + /* + * Tenant ID for the policy event record. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * Principal object ID for the user who initiated the resource operation + * that triggered the policy event. + */ + @JsonProperty(value = "principalOid") + private String principalOid; + + /* + * Components events records populated only when URL contains + * $expand=components clause. + */ + @JsonProperty(value = "components") + private List components; + + /* + * Policy event record. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the odataId property: OData entity ID; always set to null since policy event records do not have an entity + * ID. + * + * @return the odataId value. + */ + public String odataId() { + return this.odataId; + } + + /** + * Set the odataId property: OData entity ID; always set to null since policy event records do not have an entity + * ID. + * + * @param odataId the odataId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withOdataId(String odataId) { + this.odataId = odataId; + return this; + } + + /** + * Get the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + public String odataContext() { + return this.odataContext; + } + + /** + * Set the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @param odataContext the odataContext value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withOdataContext(String odataContext) { + this.odataContext = odataContext; + return this; + } + + /** + * Get the timestamp property: Timestamp for the policy event record. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: Timestamp for the policy event record. + * + * @param timestamp the timestamp value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the resourceId property: Resource ID. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Resource ID. + * + * @param resourceId the resourceId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the policyAssignmentId property: Policy assignment ID. + * + * @return the policyAssignmentId value. + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the policyAssignmentId property: Policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policyDefinitionId property: Policy definition ID. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the policyDefinitionId property: Policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the effectiveParameters property: Effective parameters for the policy assignment. + * + * @return the effectiveParameters value. + */ + public String effectiveParameters() { + return this.effectiveParameters; + } + + /** + * Set the effectiveParameters property: Effective parameters for the policy assignment. + * + * @param effectiveParameters the effectiveParameters value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withEffectiveParameters(String effectiveParameters) { + this.effectiveParameters = effectiveParameters; + return this; + } + + /** + * Get the isCompliant property: Flag which states whether the resource is compliant against the policy assignment + * it was evaluated against. + * + * @return the isCompliant value. + */ + public Boolean isCompliant() { + return this.isCompliant; + } + + /** + * Set the isCompliant property: Flag which states whether the resource is compliant against the policy assignment + * it was evaluated against. + * + * @param isCompliant the isCompliant value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withIsCompliant(Boolean isCompliant) { + this.isCompliant = isCompliant; + return this; + } + + /** + * Get the subscriptionId property: Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription ID. + * + * @param subscriptionId the subscriptionId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceType property: Resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Resource type. + * + * @param resourceType the resourceType value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceLocation property: Resource location. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set the resourceLocation property: Resource location. + * + * @param resourceLocation the resourceLocation value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get the resourceGroup property: Resource group name. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: Resource group name. + * + * @param resourceGroup the resourceGroup value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the resourceTags property: List of resource tags. + * + * @return the resourceTags value. + */ + public String resourceTags() { + return this.resourceTags; + } + + /** + * Set the resourceTags property: List of resource tags. + * + * @param resourceTags the resourceTags value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withResourceTags(String resourceTags) { + this.resourceTags = resourceTags; + return this; + } + + /** + * Get the policyAssignmentName property: Policy assignment name. + * + * @return the policyAssignmentName value. + */ + public String policyAssignmentName() { + return this.policyAssignmentName; + } + + /** + * Set the policyAssignmentName property: Policy assignment name. + * + * @param policyAssignmentName the policyAssignmentName value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentName(String policyAssignmentName) { + this.policyAssignmentName = policyAssignmentName; + return this; + } + + /** + * Get the policyAssignmentOwner property: Policy assignment owner. + * + * @return the policyAssignmentOwner value. + */ + public String policyAssignmentOwner() { + return this.policyAssignmentOwner; + } + + /** + * Set the policyAssignmentOwner property: Policy assignment owner. + * + * @param policyAssignmentOwner the policyAssignmentOwner value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentOwner(String policyAssignmentOwner) { + this.policyAssignmentOwner = policyAssignmentOwner; + return this; + } + + /** + * Get the policyAssignmentParameters property: Policy assignment parameters. + * + * @return the policyAssignmentParameters value. + */ + public String policyAssignmentParameters() { + return this.policyAssignmentParameters; + } + + /** + * Set the policyAssignmentParameters property: Policy assignment parameters. + * + * @param policyAssignmentParameters the policyAssignmentParameters value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentParameters(String policyAssignmentParameters) { + this.policyAssignmentParameters = policyAssignmentParameters; + return this; + } + + /** + * Get the policyAssignmentScope property: Policy assignment scope. + * + * @return the policyAssignmentScope value. + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Set the policyAssignmentScope property: Policy assignment scope. + * + * @param policyAssignmentScope the policyAssignmentScope value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyAssignmentScope(String policyAssignmentScope) { + this.policyAssignmentScope = policyAssignmentScope; + return this; + } + + /** + * Get the policyDefinitionName property: Policy definition name. + * + * @return the policyDefinitionName value. + */ + public String policyDefinitionName() { + return this.policyDefinitionName; + } + + /** + * Set the policyDefinitionName property: Policy definition name. + * + * @param policyDefinitionName the policyDefinitionName value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionName(String policyDefinitionName) { + this.policyDefinitionName = policyDefinitionName; + return this; + } + + /** + * Get the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @return the policyDefinitionAction value. + */ + public String policyDefinitionAction() { + return this.policyDefinitionAction; + } + + /** + * Set the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @param policyDefinitionAction the policyDefinitionAction value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + + /** + * Get the policyDefinitionCategory property: Policy definition category. + * + * @return the policyDefinitionCategory value. + */ + public String policyDefinitionCategory() { + return this.policyDefinitionCategory; + } + + /** + * Set the policyDefinitionCategory property: Policy definition category. + * + * @param policyDefinitionCategory the policyDefinitionCategory value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionCategory(String policyDefinitionCategory) { + this.policyDefinitionCategory = policyDefinitionCategory; + return this; + } + + /** + * Get the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value. + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get the policySetDefinitionName property: Policy set definition name, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionName value. + */ + public String policySetDefinitionName() { + return this.policySetDefinitionName; + } + + /** + * Set the policySetDefinitionName property: Policy set definition name, if the policy assignment is for a policy + * set. + * + * @param policySetDefinitionName the policySetDefinitionName value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionName(String policySetDefinitionName) { + this.policySetDefinitionName = policySetDefinitionName; + return this; + } + + /** + * Get the policySetDefinitionOwner property: Policy set definition owner, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionOwner value. + */ + public String policySetDefinitionOwner() { + return this.policySetDefinitionOwner; + } + + /** + * Set the policySetDefinitionOwner property: Policy set definition owner, if the policy assignment is for a policy + * set. + * + * @param policySetDefinitionOwner the policySetDefinitionOwner value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionOwner(String policySetDefinitionOwner) { + this.policySetDefinitionOwner = policySetDefinitionOwner; + return this; + } + + /** + * Get the policySetDefinitionCategory property: Policy set definition category, if the policy assignment is for a + * policy set. + * + * @return the policySetDefinitionCategory value. + */ + public String policySetDefinitionCategory() { + return this.policySetDefinitionCategory; + } + + /** + * Set the policySetDefinitionCategory property: Policy set definition category, if the policy assignment is for a + * policy set. + * + * @param policySetDefinitionCategory the policySetDefinitionCategory value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionCategory(String policySetDefinitionCategory) { + this.policySetDefinitionCategory = policySetDefinitionCategory; + return this; + } + + /** + * Get the policySetDefinitionParameters property: Policy set definition parameters, if the policy assignment is for + * a policy set. + * + * @return the policySetDefinitionParameters value. + */ + public String policySetDefinitionParameters() { + return this.policySetDefinitionParameters; + } + + /** + * Set the policySetDefinitionParameters property: Policy set definition parameters, if the policy assignment is for + * a policy set. + * + * @param policySetDefinitionParameters the policySetDefinitionParameters value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicySetDefinitionParameters(String policySetDefinitionParameters) { + this.policySetDefinitionParameters = policySetDefinitionParameters; + return this; + } + + /** + * Get the managementGroupIds property: Comma separated list of management group IDs, which represent the hierarchy + * of the management groups the resource is under. + * + * @return the managementGroupIds value. + */ + public String managementGroupIds() { + return this.managementGroupIds; + } + + /** + * Set the managementGroupIds property: Comma separated list of management group IDs, which represent the hierarchy + * of the management groups the resource is under. + * + * @param managementGroupIds the managementGroupIds value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withManagementGroupIds(String managementGroupIds) { + this.managementGroupIds = managementGroupIds; + return this; + } + + /** + * Get the policyDefinitionReferenceId property: Reference ID for the policy definition inside the policy set, if + * the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value. + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policyDefinitionReferenceId property: Reference ID for the policy definition inside the policy set, if + * the policy assignment is for a policy set. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the complianceState property: Compliance state of the resource. + * + * @return the complianceState value. + */ + public String complianceState() { + return this.complianceState; + } + + /** + * Set the complianceState property: Compliance state of the resource. + * + * @param complianceState the complianceState value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withComplianceState(String complianceState) { + this.complianceState = complianceState; + return this; + } + + /** + * Get the tenantId property: Tenant ID for the policy event record. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID for the policy event record. + * + * @param tenantId the tenantId value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the principalOid property: Principal object ID for the user who initiated the resource operation that + * triggered the policy event. + * + * @return the principalOid value. + */ + public String principalOid() { + return this.principalOid; + } + + /** + * Set the principalOid property: Principal object ID for the user who initiated the resource operation that + * triggered the policy event. + * + * @param principalOid the principalOid value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withPrincipalOid(String principalOid) { + this.principalOid = principalOid; + return this; + } + + /** + * Get the components property: Components events records populated only when URL contains $expand=components + * clause. + * + * @return the components value. + */ + public List components() { + return this.components; + } + + /** + * Set the components property: Components events records populated only when URL contains $expand=components + * clause. + * + * @param components the components value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withComponents(List components) { + this.components = components; + return this; + } + + /** + * Get the additionalProperties property: Policy event record. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Policy event record. + * + * @param additionalProperties the additionalProperties value to set. + * @return the PolicyEventInner object itself. + */ + public PolicyEventInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (components() != null) { + components().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyMetadataInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyMetadataInner.java new file mode 100644 index 000000000000..1859e8a80795 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyMetadataInner.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.policyinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Policy metadata resource definition. */ +@JsonFlatten +@Immutable +public class PolicyMetadataInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyMetadataInner.class); + + /* + * The ID of the policy metadata. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the policy metadata. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the policy metadata. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The policy metadata identifier. + */ + @JsonProperty(value = "properties.metadataId", access = JsonProperty.Access.WRITE_ONLY) + private String metadataId; + + /* + * The category of the policy metadata. + */ + @JsonProperty(value = "properties.category", access = JsonProperty.Access.WRITE_ONLY) + private String category; + + /* + * The title of the policy metadata. + */ + @JsonProperty(value = "properties.title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * The owner of the policy metadata. + */ + @JsonProperty(value = "properties.owner", access = JsonProperty.Access.WRITE_ONLY) + private String owner; + + /* + * Url for getting additional content about the resource metadata. + */ + @JsonProperty(value = "properties.additionalContentUrl", access = JsonProperty.Access.WRITE_ONLY) + private String additionalContentUrl; + + /* + * Additional metadata. + */ + @JsonProperty(value = "properties.metadata", access = JsonProperty.Access.WRITE_ONLY) + private Object metadata; + + /* + * The description of the policy metadata. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The requirements of the policy metadata. + */ + @JsonProperty(value = "properties.requirements", access = JsonProperty.Access.WRITE_ONLY) + private String requirements; + + /** + * Get the id property: The ID of the policy metadata. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the policy metadata. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the policy metadata. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the metadataId property: The policy metadata identifier. + * + * @return the metadataId value. + */ + public String metadataId() { + return this.metadataId; + } + + /** + * Get the category property: The category of the policy metadata. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Get the title property: The title of the policy metadata. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the owner property: The owner of the policy metadata. + * + * @return the owner value. + */ + public String owner() { + return this.owner; + } + + /** + * Get the additionalContentUrl property: Url for getting additional content about the resource metadata. + * + * @return the additionalContentUrl value. + */ + public String additionalContentUrl() { + return this.additionalContentUrl; + } + + /** + * Get the metadata property: Additional metadata. + * + * @return the metadata value. + */ + public Object metadata() { + return this.metadata; + } + + /** + * Get the description property: The description of the policy metadata. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the requirements property: The requirements of the policy metadata. + * + * @return the requirements value. + */ + public String requirements() { + return this.requirements; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyStateInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyStateInner.java new file mode 100644 index 000000000000..26d0333302e2 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyStateInner.java @@ -0,0 +1,954 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.ComponentStateDetails; +import com.azure.resourcemanager.policyinsights.models.PolicyEvaluationDetails; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** Policy state record. */ +@Fluent +public final class PolicyStateInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyStateInner.class); + + /* + * OData entity ID; always set to null since policy state records do not + * have an entity ID. + */ + @JsonProperty(value = "@odata.id") + private String odataId; + + /* + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata.context") + private String odataContext; + + /* + * Timestamp for the policy state record. + */ + @JsonProperty(value = "timestamp") + private OffsetDateTime timestamp; + + /* + * Resource ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /* + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /* + * Effective parameters for the policy assignment. + */ + @JsonProperty(value = "effectiveParameters") + private String effectiveParameters; + + /* + * Flag which states whether the resource is compliant against the policy + * assignment it was evaluated against. This property is deprecated; please + * use ComplianceState instead. + */ + @JsonProperty(value = "isCompliant") + private Boolean isCompliant; + + /* + * Subscription ID. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * Resource location. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /* + * Resource group name. + */ + @JsonProperty(value = "resourceGroup") + private String resourceGroup; + + /* + * List of resource tags. + */ + @JsonProperty(value = "resourceTags") + private String resourceTags; + + /* + * Policy assignment name. + */ + @JsonProperty(value = "policyAssignmentName") + private String policyAssignmentName; + + /* + * Policy assignment owner. + */ + @JsonProperty(value = "policyAssignmentOwner") + private String policyAssignmentOwner; + + /* + * Policy assignment parameters. + */ + @JsonProperty(value = "policyAssignmentParameters") + private String policyAssignmentParameters; + + /* + * Policy assignment scope. + */ + @JsonProperty(value = "policyAssignmentScope") + private String policyAssignmentScope; + + /* + * Policy definition name. + */ + @JsonProperty(value = "policyDefinitionName") + private String policyDefinitionName; + + /* + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /* + * Policy definition category. + */ + @JsonProperty(value = "policyDefinitionCategory") + private String policyDefinitionCategory; + + /* + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /* + * Policy set definition name, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionName") + private String policySetDefinitionName; + + /* + * Policy set definition owner, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionOwner") + private String policySetDefinitionOwner; + + /* + * Policy set definition category, if the policy assignment is for a policy + * set. + */ + @JsonProperty(value = "policySetDefinitionCategory") + private String policySetDefinitionCategory; + + /* + * Policy set definition parameters, if the policy assignment is for a + * policy set. + */ + @JsonProperty(value = "policySetDefinitionParameters") + private String policySetDefinitionParameters; + + /* + * Comma separated list of management group IDs, which represent the + * hierarchy of the management groups the resource is under. + */ + @JsonProperty(value = "managementGroupIds") + private String managementGroupIds; + + /* + * Reference ID for the policy definition inside the policy set, if the + * policy assignment is for a policy set. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /* + * Compliance state of the resource. + */ + @JsonProperty(value = "complianceState") + private String complianceState; + + /* + * Policy evaluation details. + */ + @JsonProperty(value = "policyEvaluationDetails") + private PolicyEvaluationDetails policyEvaluationDetails; + + /* + * Policy definition group names. + */ + @JsonProperty(value = "policyDefinitionGroupNames") + private List policyDefinitionGroupNames; + + /* + * Components state compliance records populated only when URL contains + * $expand=components clause. + */ + @JsonProperty(value = "components") + private List components; + + /* + * Evaluated policy definition version. + */ + @JsonProperty(value = "policyDefinitionVersion", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionVersion; + + /* + * Evaluated policy set definition version. + */ + @JsonProperty(value = "policySetDefinitionVersion", access = JsonProperty.Access.WRITE_ONLY) + private String policySetDefinitionVersion; + + /* + * Evaluated policy assignment version. + */ + @JsonProperty(value = "policyAssignmentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentVersion; + + /* + * Policy state record. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the odataId property: OData entity ID; always set to null since policy state records do not have an entity + * ID. + * + * @return the odataId value. + */ + public String odataId() { + return this.odataId; + } + + /** + * Set the odataId property: OData entity ID; always set to null since policy state records do not have an entity + * ID. + * + * @param odataId the odataId value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withOdataId(String odataId) { + this.odataId = odataId; + return this; + } + + /** + * Get the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + public String odataContext() { + return this.odataContext; + } + + /** + * Set the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @param odataContext the odataContext value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withOdataContext(String odataContext) { + this.odataContext = odataContext; + return this; + } + + /** + * Get the timestamp property: Timestamp for the policy state record. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: Timestamp for the policy state record. + * + * @param timestamp the timestamp value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the resourceId property: Resource ID. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Resource ID. + * + * @param resourceId the resourceId value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the policyAssignmentId property: Policy assignment ID. + * + * @return the policyAssignmentId value. + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the policyAssignmentId property: Policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policyDefinitionId property: Policy definition ID. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the policyDefinitionId property: Policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the effectiveParameters property: Effective parameters for the policy assignment. + * + * @return the effectiveParameters value. + */ + public String effectiveParameters() { + return this.effectiveParameters; + } + + /** + * Set the effectiveParameters property: Effective parameters for the policy assignment. + * + * @param effectiveParameters the effectiveParameters value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withEffectiveParameters(String effectiveParameters) { + this.effectiveParameters = effectiveParameters; + return this; + } + + /** + * Get the isCompliant property: Flag which states whether the resource is compliant against the policy assignment + * it was evaluated against. This property is deprecated; please use ComplianceState instead. + * + * @return the isCompliant value. + */ + public Boolean isCompliant() { + return this.isCompliant; + } + + /** + * Set the isCompliant property: Flag which states whether the resource is compliant against the policy assignment + * it was evaluated against. This property is deprecated; please use ComplianceState instead. + * + * @param isCompliant the isCompliant value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withIsCompliant(Boolean isCompliant) { + this.isCompliant = isCompliant; + return this; + } + + /** + * Get the subscriptionId property: Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription ID. + * + * @param subscriptionId the subscriptionId value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceType property: Resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Resource type. + * + * @param resourceType the resourceType value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceLocation property: Resource location. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set the resourceLocation property: Resource location. + * + * @param resourceLocation the resourceLocation value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get the resourceGroup property: Resource group name. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: Resource group name. + * + * @param resourceGroup the resourceGroup value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the resourceTags property: List of resource tags. + * + * @return the resourceTags value. + */ + public String resourceTags() { + return this.resourceTags; + } + + /** + * Set the resourceTags property: List of resource tags. + * + * @param resourceTags the resourceTags value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withResourceTags(String resourceTags) { + this.resourceTags = resourceTags; + return this; + } + + /** + * Get the policyAssignmentName property: Policy assignment name. + * + * @return the policyAssignmentName value. + */ + public String policyAssignmentName() { + return this.policyAssignmentName; + } + + /** + * Set the policyAssignmentName property: Policy assignment name. + * + * @param policyAssignmentName the policyAssignmentName value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentName(String policyAssignmentName) { + this.policyAssignmentName = policyAssignmentName; + return this; + } + + /** + * Get the policyAssignmentOwner property: Policy assignment owner. + * + * @return the policyAssignmentOwner value. + */ + public String policyAssignmentOwner() { + return this.policyAssignmentOwner; + } + + /** + * Set the policyAssignmentOwner property: Policy assignment owner. + * + * @param policyAssignmentOwner the policyAssignmentOwner value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentOwner(String policyAssignmentOwner) { + this.policyAssignmentOwner = policyAssignmentOwner; + return this; + } + + /** + * Get the policyAssignmentParameters property: Policy assignment parameters. + * + * @return the policyAssignmentParameters value. + */ + public String policyAssignmentParameters() { + return this.policyAssignmentParameters; + } + + /** + * Set the policyAssignmentParameters property: Policy assignment parameters. + * + * @param policyAssignmentParameters the policyAssignmentParameters value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentParameters(String policyAssignmentParameters) { + this.policyAssignmentParameters = policyAssignmentParameters; + return this; + } + + /** + * Get the policyAssignmentScope property: Policy assignment scope. + * + * @return the policyAssignmentScope value. + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Set the policyAssignmentScope property: Policy assignment scope. + * + * @param policyAssignmentScope the policyAssignmentScope value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyAssignmentScope(String policyAssignmentScope) { + this.policyAssignmentScope = policyAssignmentScope; + return this; + } + + /** + * Get the policyDefinitionName property: Policy definition name. + * + * @return the policyDefinitionName value. + */ + public String policyDefinitionName() { + return this.policyDefinitionName; + } + + /** + * Set the policyDefinitionName property: Policy definition name. + * + * @param policyDefinitionName the policyDefinitionName value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionName(String policyDefinitionName) { + this.policyDefinitionName = policyDefinitionName; + return this; + } + + /** + * Get the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @return the policyDefinitionAction value. + */ + public String policyDefinitionAction() { + return this.policyDefinitionAction; + } + + /** + * Set the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @param policyDefinitionAction the policyDefinitionAction value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + + /** + * Get the policyDefinitionCategory property: Policy definition category. + * + * @return the policyDefinitionCategory value. + */ + public String policyDefinitionCategory() { + return this.policyDefinitionCategory; + } + + /** + * Set the policyDefinitionCategory property: Policy definition category. + * + * @param policyDefinitionCategory the policyDefinitionCategory value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionCategory(String policyDefinitionCategory) { + this.policyDefinitionCategory = policyDefinitionCategory; + return this; + } + + /** + * Get the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value. + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get the policySetDefinitionName property: Policy set definition name, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionName value. + */ + public String policySetDefinitionName() { + return this.policySetDefinitionName; + } + + /** + * Set the policySetDefinitionName property: Policy set definition name, if the policy assignment is for a policy + * set. + * + * @param policySetDefinitionName the policySetDefinitionName value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionName(String policySetDefinitionName) { + this.policySetDefinitionName = policySetDefinitionName; + return this; + } + + /** + * Get the policySetDefinitionOwner property: Policy set definition owner, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionOwner value. + */ + public String policySetDefinitionOwner() { + return this.policySetDefinitionOwner; + } + + /** + * Set the policySetDefinitionOwner property: Policy set definition owner, if the policy assignment is for a policy + * set. + * + * @param policySetDefinitionOwner the policySetDefinitionOwner value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionOwner(String policySetDefinitionOwner) { + this.policySetDefinitionOwner = policySetDefinitionOwner; + return this; + } + + /** + * Get the policySetDefinitionCategory property: Policy set definition category, if the policy assignment is for a + * policy set. + * + * @return the policySetDefinitionCategory value. + */ + public String policySetDefinitionCategory() { + return this.policySetDefinitionCategory; + } + + /** + * Set the policySetDefinitionCategory property: Policy set definition category, if the policy assignment is for a + * policy set. + * + * @param policySetDefinitionCategory the policySetDefinitionCategory value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionCategory(String policySetDefinitionCategory) { + this.policySetDefinitionCategory = policySetDefinitionCategory; + return this; + } + + /** + * Get the policySetDefinitionParameters property: Policy set definition parameters, if the policy assignment is for + * a policy set. + * + * @return the policySetDefinitionParameters value. + */ + public String policySetDefinitionParameters() { + return this.policySetDefinitionParameters; + } + + /** + * Set the policySetDefinitionParameters property: Policy set definition parameters, if the policy assignment is for + * a policy set. + * + * @param policySetDefinitionParameters the policySetDefinitionParameters value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicySetDefinitionParameters(String policySetDefinitionParameters) { + this.policySetDefinitionParameters = policySetDefinitionParameters; + return this; + } + + /** + * Get the managementGroupIds property: Comma separated list of management group IDs, which represent the hierarchy + * of the management groups the resource is under. + * + * @return the managementGroupIds value. + */ + public String managementGroupIds() { + return this.managementGroupIds; + } + + /** + * Set the managementGroupIds property: Comma separated list of management group IDs, which represent the hierarchy + * of the management groups the resource is under. + * + * @param managementGroupIds the managementGroupIds value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withManagementGroupIds(String managementGroupIds) { + this.managementGroupIds = managementGroupIds; + return this; + } + + /** + * Get the policyDefinitionReferenceId property: Reference ID for the policy definition inside the policy set, if + * the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value. + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policyDefinitionReferenceId property: Reference ID for the policy definition inside the policy set, if + * the policy assignment is for a policy set. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the complianceState property: Compliance state of the resource. + * + * @return the complianceState value. + */ + public String complianceState() { + return this.complianceState; + } + + /** + * Set the complianceState property: Compliance state of the resource. + * + * @param complianceState the complianceState value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withComplianceState(String complianceState) { + this.complianceState = complianceState; + return this; + } + + /** + * Get the policyEvaluationDetails property: Policy evaluation details. + * + * @return the policyEvaluationDetails value. + */ + public PolicyEvaluationDetails policyEvaluationDetails() { + return this.policyEvaluationDetails; + } + + /** + * Set the policyEvaluationDetails property: Policy evaluation details. + * + * @param policyEvaluationDetails the policyEvaluationDetails value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyEvaluationDetails(PolicyEvaluationDetails policyEvaluationDetails) { + this.policyEvaluationDetails = policyEvaluationDetails; + return this; + } + + /** + * Get the policyDefinitionGroupNames property: Policy definition group names. + * + * @return the policyDefinitionGroupNames value. + */ + public List policyDefinitionGroupNames() { + return this.policyDefinitionGroupNames; + } + + /** + * Set the policyDefinitionGroupNames property: Policy definition group names. + * + * @param policyDefinitionGroupNames the policyDefinitionGroupNames value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withPolicyDefinitionGroupNames(List policyDefinitionGroupNames) { + this.policyDefinitionGroupNames = policyDefinitionGroupNames; + return this; + } + + /** + * Get the components property: Components state compliance records populated only when URL contains + * $expand=components clause. + * + * @return the components value. + */ + public List components() { + return this.components; + } + + /** + * Set the components property: Components state compliance records populated only when URL contains + * $expand=components clause. + * + * @param components the components value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withComponents(List components) { + this.components = components; + return this; + } + + /** + * Get the policyDefinitionVersion property: Evaluated policy definition version. + * + * @return the policyDefinitionVersion value. + */ + public String policyDefinitionVersion() { + return this.policyDefinitionVersion; + } + + /** + * Get the policySetDefinitionVersion property: Evaluated policy set definition version. + * + * @return the policySetDefinitionVersion value. + */ + public String policySetDefinitionVersion() { + return this.policySetDefinitionVersion; + } + + /** + * Get the policyAssignmentVersion property: Evaluated policy assignment version. + * + * @return the policyAssignmentVersion value. + */ + public String policyAssignmentVersion() { + return this.policyAssignmentVersion; + } + + /** + * Get the additionalProperties property: Policy state record. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Policy state record. + * + * @param additionalProperties the additionalProperties value to set. + * @return the PolicyStateInner object itself. + */ + public PolicyStateInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyEvaluationDetails() != null) { + policyEvaluationDetails().validate(); + } + if (components() != null) { + components().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyTrackedResourceInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyTrackedResourceInner.java new file mode 100644 index 000000000000..30d61cb870c4 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyTrackedResourceInner.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.policyinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.PolicyDetails; +import com.azure.resourcemanager.policyinsights.models.TrackedResourceModificationDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Policy tracked resource record. */ +@Immutable +public final class PolicyTrackedResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyTrackedResourceInner.class); + + /* + * The ID of the policy tracked resource. + */ + @JsonProperty(value = "trackedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String trackedResourceId; + + /* + * The details of the policy that require the tracked resource. + */ + @JsonProperty(value = "policyDetails", access = JsonProperty.Access.WRITE_ONLY) + private PolicyDetails policyDetails; + + /* + * The details of the policy triggered deployment that created the tracked + * resource. + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private TrackedResourceModificationDetails createdBy; + + /* + * The details of the policy triggered deployment that modified the tracked + * resource. + */ + @JsonProperty(value = "lastModifiedBy", access = JsonProperty.Access.WRITE_ONLY) + private TrackedResourceModificationDetails lastModifiedBy; + + /* + * Timestamp of the last update to the tracked resource. + */ + @JsonProperty(value = "lastUpdateUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdateUtc; + + /** + * Get the trackedResourceId property: The ID of the policy tracked resource. + * + * @return the trackedResourceId value. + */ + public String trackedResourceId() { + return this.trackedResourceId; + } + + /** + * Get the policyDetails property: The details of the policy that require the tracked resource. + * + * @return the policyDetails value. + */ + public PolicyDetails policyDetails() { + return this.policyDetails; + } + + /** + * Get the createdBy property: The details of the policy triggered deployment that created the tracked resource. + * + * @return the createdBy value. + */ + public TrackedResourceModificationDetails createdBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedBy property: The details of the policy triggered deployment that modified the tracked + * resource. + * + * @return the lastModifiedBy value. + */ + public TrackedResourceModificationDetails lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get the lastUpdateUtc property: Timestamp of the last update to the tracked resource. + * + * @return the lastUpdateUtc value. + */ + public OffsetDateTime lastUpdateUtc() { + return this.lastUpdateUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyDetails() != null) { + policyDetails().validate(); + } + if (createdBy() != null) { + createdBy().validate(); + } + if (lastModifiedBy() != null) { + lastModifiedBy().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationDeploymentInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationDeploymentInner.java new file mode 100644 index 000000000000..ce34b4798317 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationDeploymentInner.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.policyinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Details of a single deployment created by the remediation. */ +@Immutable +public final class RemediationDeploymentInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationDeploymentInner.class); + + /* + * Resource ID of the resource that is being remediated by the deployment. + */ + @JsonProperty(value = "remediatedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String remediatedResourceId; + + /* + * Resource ID of the template deployment that will remediate the resource. + */ + @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentId; + + /* + * Status of the remediation deployment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Location of the resource that is being remediated. + */ + @JsonProperty(value = "resourceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String resourceLocation; + + /* + * Error encountered while remediated the resource. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ManagementError error; + + /* + * The time at which the remediation was created. + */ + @JsonProperty(value = "createdOn", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdOn; + + /* + * The time at which the remediation deployment was last updated. + */ + @JsonProperty(value = "lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedOn; + + /** + * Get the remediatedResourceId property: Resource ID of the resource that is being remediated by the deployment. + * + * @return the remediatedResourceId value. + */ + public String remediatedResourceId() { + return this.remediatedResourceId; + } + + /** + * Get the deploymentId property: Resource ID of the template deployment that will remediate the resource. + * + * @return the deploymentId value. + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Get the status property: Status of the remediation deployment. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the resourceLocation property: Location of the resource that is being remediated. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Get the error property: Error encountered while remediated the resource. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Get the createdOn property: The time at which the remediation was created. + * + * @return the createdOn value. + */ + public OffsetDateTime createdOn() { + return this.createdOn; + } + + /** + * Get the lastUpdatedOn property: The time at which the remediation deployment was last updated. + * + * @return the lastUpdatedOn value. + */ + public OffsetDateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java new file mode 100644 index 000000000000..94d55a1a361d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.RemediationDeploymentSummary; +import com.azure.resourcemanager.policyinsights.models.RemediationFilters; +import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The remediation definition. */ +@JsonFlatten +@Fluent +public class RemediationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationInner.class); + + /* + * The resource ID of the policy assignment that should be remediated. + */ + @JsonProperty(value = "properties.policyAssignmentId") + private String policyAssignmentId; + + /* + * The policy definition reference ID of the individual definition that + * should be remediated. Required when the policy assignment being + * remediated assigns a policy set definition. + */ + @JsonProperty(value = "properties.policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /* + * The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified. + */ + @JsonProperty(value = "properties.resourceDiscoveryMode") + private ResourceDiscoveryMode resourceDiscoveryMode; + + /* + * The status of the remediation. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The time at which the remediation was created. + */ + @JsonProperty(value = "properties.createdOn", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdOn; + + /* + * The time at which the remediation was last updated. + */ + @JsonProperty(value = "properties.lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedOn; + + /* + * The filters that will be applied to determine which resources to + * remediate. + */ + @JsonProperty(value = "properties.filters") + private RemediationFilters filters; + + /* + * The deployment status summary for all deployments created by the + * remediation. + */ + @JsonProperty(value = "properties.deploymentStatus", access = JsonProperty.Access.WRITE_ONLY) + private RemediationDeploymentSummary deploymentStatus; + + /** + * Get the policyAssignmentId property: The resource ID of the policy assignment that should be remediated. + * + * @return the policyAssignmentId value. + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the policyAssignmentId property: The resource ID of the policy assignment that should be remediated. + * + * @param policyAssignmentId the policyAssignmentId value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policyDefinitionReferenceId property: The policy definition reference ID of the individual definition + * that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. + * + * @return the policyDefinitionReferenceId value. + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policyDefinitionReferenceId property: The policy definition reference ID of the individual definition + * that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified. + * + * @return the resourceDiscoveryMode value. + */ + public ResourceDiscoveryMode resourceDiscoveryMode() { + return this.resourceDiscoveryMode; + } + + /** + * Set the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified. + * + * @param resourceDiscoveryMode the resourceDiscoveryMode value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode) { + this.resourceDiscoveryMode = resourceDiscoveryMode; + return this; + } + + /** + * Get the provisioningState property: The status of the remediation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the createdOn property: The time at which the remediation was created. + * + * @return the createdOn value. + */ + public OffsetDateTime createdOn() { + return this.createdOn; + } + + /** + * Get the lastUpdatedOn property: The time at which the remediation was last updated. + * + * @return the lastUpdatedOn value. + */ + public OffsetDateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Get the filters property: The filters that will be applied to determine which resources to remediate. + * + * @return the filters value. + */ + public RemediationFilters filters() { + return this.filters; + } + + /** + * Set the filters property: The filters that will be applied to determine which resources to remediate. + * + * @param filters the filters value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withFilters(RemediationFilters filters) { + this.filters = filters; + return this; + } + + /** + * Get the deploymentStatus property: The deployment status summary for all deployments created by the remediation. + * + * @return the deploymentStatus value. + */ + public RemediationDeploymentSummary deploymentStatus() { + return this.deploymentStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filters() != null) { + filters().validate(); + } + if (deploymentStatus() != null) { + deploymentStatus().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SlimPolicyMetadataInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SlimPolicyMetadataInner.java new file mode 100644 index 000000000000..ec28ced5383f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SlimPolicyMetadataInner.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.policyinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Slim version of policy metadata resource definition, excluding properties with large strings. */ +@JsonFlatten +@Immutable +public class SlimPolicyMetadataInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SlimPolicyMetadataInner.class); + + /* + * The ID of the policy metadata. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the policy metadata. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the policy metadata. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The policy metadata identifier. + */ + @JsonProperty(value = "properties.metadataId", access = JsonProperty.Access.WRITE_ONLY) + private String metadataId; + + /* + * The category of the policy metadata. + */ + @JsonProperty(value = "properties.category", access = JsonProperty.Access.WRITE_ONLY) + private String category; + + /* + * The title of the policy metadata. + */ + @JsonProperty(value = "properties.title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * The owner of the policy metadata. + */ + @JsonProperty(value = "properties.owner", access = JsonProperty.Access.WRITE_ONLY) + private String owner; + + /* + * Url for getting additional content about the resource metadata. + */ + @JsonProperty(value = "properties.additionalContentUrl", access = JsonProperty.Access.WRITE_ONLY) + private String additionalContentUrl; + + /* + * Additional metadata. + */ + @JsonProperty(value = "properties.metadata", access = JsonProperty.Access.WRITE_ONLY) + private Object metadata; + + /** + * Get the id property: The ID of the policy metadata. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the policy metadata. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the policy metadata. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the metadataId property: The policy metadata identifier. + * + * @return the metadataId value. + */ + public String metadataId() { + return this.metadataId; + } + + /** + * Get the category property: The category of the policy metadata. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Get the title property: The title of the policy metadata. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the owner property: The owner of the policy metadata. + * + * @return the owner value. + */ + public String owner() { + return this.owner; + } + + /** + * Get the additionalContentUrl property: Url for getting additional content about the resource metadata. + * + * @return the additionalContentUrl value. + */ + public String additionalContentUrl() { + return this.additionalContentUrl; + } + + /** + * Get the metadata property: Additional metadata. + * + * @return the metadata value. + */ + public Object metadata() { + return this.metadata; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SummarizeResultsInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SummarizeResultsInner.java new file mode 100644 index 000000000000..bb2301c080c5 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/SummarizeResultsInner.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.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.Summary; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Summarize action results. */ +@Fluent +public final class SummarizeResultsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SummarizeResultsInner.class); + + /* + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata.context") + private String odataContext; + + /* + * OData entity count; represents the number of summaries returned; always + * set to 1. + */ + @JsonProperty(value = "@odata.count") + private Integer odataCount; + + /* + * Summarize action results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + public String odataContext() { + return this.odataContext; + } + + /** + * Set the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @param odataContext the odataContext value to set. + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withOdataContext(String odataContext) { + this.odataContext = odataContext; + return this; + } + + /** + * Get the odataCount property: OData entity count; represents the number of summaries returned; always set to 1. + * + * @return the odataCount value. + */ + public Integer odataCount() { + return this.odataCount; + } + + /** + * Set the odataCount property: OData entity count; represents the number of summaries returned; always set to 1. + * + * @param odataCount the odataCount value to set. + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withOdataCount(Integer odataCount) { + this.odataCount = odataCount; + return this; + } + + /** + * Get the value property: Summarize action results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Summarize action results. + * + * @param value the value value to set. + * @return the SummarizeResultsInner object itself. + */ + public SummarizeResultsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/package-info.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/package-info.java new file mode 100644 index 000000000000..e1e5b5f26b28 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for PolicyInsightsClient. null. */ +package com.azure.resourcemanager.policyinsights.fluent.models; diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/package-info.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/package-info.java new file mode 100644 index 000000000000..b96dc4f7e115 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for PolicyInsightsClient. null. */ +package com.azure.resourcemanager.policyinsights.fluent; diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationImpl.java new file mode 100644 index 000000000000..41d37c1cfcab --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationImpl.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.policyinsights.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.azure.resourcemanager.policyinsights.models.Attestation; +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import com.azure.resourcemanager.policyinsights.models.SystemData; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class AttestationImpl implements Attestation, Attestation.Definition, Attestation.Update { + private AttestationInner innerObject; + + private final PolicyInsightsManager 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 policyAssignmentId() { + return this.innerModel().policyAssignmentId(); + } + + public String policyDefinitionReferenceId() { + return this.innerModel().policyDefinitionReferenceId(); + } + + public ComplianceState complianceState() { + return this.innerModel().complianceState(); + } + + public OffsetDateTime expiresOn() { + return this.innerModel().expiresOn(); + } + + public String owner() { + return this.innerModel().owner(); + } + + public String comments() { + return this.innerModel().comments(); + } + + public List evidence() { + List inner = this.innerModel().evidence(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime lastComplianceStateChangeAt() { + return this.innerModel().lastComplianceStateChangeAt(); + } + + public AttestationInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String attestationName; + + public AttestationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Attestation create() { + this.innerObject = + serviceManager + .serviceClient() + .getAttestations() + .createOrUpdateAtResourceGroup(resourceGroupName, attestationName, this.innerModel(), Context.NONE); + return this; + } + + public Attestation create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttestations() + .createOrUpdateAtResourceGroup(resourceGroupName, attestationName, this.innerModel(), context); + return this; + } + + AttestationImpl(String name, PolicyInsightsManager serviceManager) { + this.innerObject = new AttestationInner(); + this.serviceManager = serviceManager; + this.attestationName = name; + } + + public AttestationImpl update() { + return this; + } + + public Attestation apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAttestations() + .createOrUpdateAtResourceGroup(resourceGroupName, attestationName, this.innerModel(), Context.NONE); + return this; + } + + public Attestation apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttestations() + .createOrUpdateAtResourceGroup(resourceGroupName, attestationName, this.innerModel(), context); + return this; + } + + AttestationImpl(AttestationInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.attestationName = Utils.getValueFromIdByName(innerObject.id(), "attestations"); + } + + public Attestation refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAttestations() + .getByResourceGroupWithResponse(resourceGroupName, attestationName, Context.NONE) + .getValue(); + return this; + } + + public Attestation refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttestations() + .getByResourceGroupWithResponse(resourceGroupName, attestationName, context) + .getValue(); + return this; + } + + public AttestationImpl withPolicyAssignmentId(String policyAssignmentId) { + this.innerModel().withPolicyAssignmentId(policyAssignmentId); + return this; + } + + public AttestationImpl withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.innerModel().withPolicyDefinitionReferenceId(policyDefinitionReferenceId); + return this; + } + + public AttestationImpl withComplianceState(ComplianceState complianceState) { + this.innerModel().withComplianceState(complianceState); + return this; + } + + public AttestationImpl withExpiresOn(OffsetDateTime expiresOn) { + this.innerModel().withExpiresOn(expiresOn); + return this; + } + + public AttestationImpl withOwner(String owner) { + this.innerModel().withOwner(owner); + return this; + } + + public AttestationImpl withComments(String comments) { + this.innerModel().withComments(comments); + return this; + } + + public AttestationImpl withEvidence(List evidence) { + this.innerModel().withEvidence(evidence); + return this; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsClientImpl.java new file mode 100644 index 000000000000..cdfffdb16d8e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsClientImpl.java @@ -0,0 +1,2582 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.policyinsights.fluent.AttestationsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.azure.resourcemanager.policyinsights.models.AttestationListResult; +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 AttestationsClient. */ +public final class AttestationsClientImpl implements AttestationsClient { + private final ClientLogger logger = new ClientLogger(AttestationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AttestationsService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of AttestationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AttestationsClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy.create(AttestationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientAttestations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface AttestationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AttestationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/attestations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/attestations/{attestationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateAtResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AttestationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/attestations/{attestationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/attestations/{attestationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.PolicyInsights/attestations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdateAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AttestationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("attestationName") String attestationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForSubscriptionNext( + @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> listForResourceGroupNext( + @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> listForResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all attestations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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 = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + top, + filter, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all attestations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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 = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), top, filter, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all attestations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, filter), nextLink -> listForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all attestations 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 all attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(top, filter), nextLink -> listForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all attestations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, filter, context), + nextLink -> listForSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all attestations 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 all attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listAsync(top, filter)); + } + + /** + * Gets all attestations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, String filter, Context context) { + return new PagedIterable<>(listAsync(top, filter, context)); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtSubscriptionWithResponseAsync( + String attestationName, AttestationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdateAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + attestationName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtSubscriptionWithResponseAsync( + String attestationName, AttestationInner parameters, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdateAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + attestationName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AttestationInner> beginCreateOrUpdateAtSubscriptionAsync( + String attestationName, AttestationInner parameters) { + Mono>> mono = + createOrUpdateAtSubscriptionWithResponseAsync(attestationName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AttestationInner.class, AttestationInner.class, Context.NONE); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AttestationInner> beginCreateOrUpdateAtSubscriptionAsync( + String attestationName, AttestationInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateAtSubscriptionWithResponseAsync(attestationName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AttestationInner.class, AttestationInner.class, context); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( + String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtSubscriptionAsync(attestationName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( + String attestationName, AttestationInner parameters, Context context) { + return beginCreateOrUpdateAtSubscriptionAsync(attestationName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtSubscriptionAsync( + String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtSubscriptionAsync(attestationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtSubscriptionAsync( + String attestationName, AttestationInner parameters, Context context) { + return beginCreateOrUpdateAtSubscriptionAsync(attestationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner createOrUpdateAtSubscription(String attestationName, AttestationInner parameters) { + return createOrUpdateAtSubscriptionAsync(attestationName, parameters).block(); + } + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner createOrUpdateAtSubscription( + String attestationName, AttestationInner parameters, Context context) { + return createOrUpdateAtSubscriptionAsync(attestationName, parameters, context).block(); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionWithResponseAsync(String attestationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + attestationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionWithResponseAsync( + String attestationName, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + attestationName, + apiVersion, + accept, + context); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtSubscriptionAsync(String attestationName) { + return getAtSubscriptionWithResponseAsync(attestationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner getAtSubscription(String attestationName) { + return getAtSubscriptionAsync(attestationName).block(); + } + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtSubscriptionWithResponse(String attestationName, Context context) { + return getAtSubscriptionWithResponseAsync(attestationName, context).block(); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtSubscriptionWithResponseAsync(String attestationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + attestationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtSubscriptionWithResponseAsync(String attestationName, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + attestationName, + apiVersion, + accept, + context); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtSubscriptionAsync(String attestationName) { + return deleteAtSubscriptionWithResponseAsync(attestationName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteAtSubscription(String attestationName) { + deleteAtSubscriptionAsync(attestationName).block(); + } + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Response deleteAtSubscriptionWithResponse(String attestationName, Context context) { + return deleteAtSubscriptionWithResponseAsync(attestationName, context).block(); + } + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + filter, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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 = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + filter, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, filter), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, filter), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, filter, context), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, filter)); + } + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for the resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, filter, context)); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtResourceGroupWithResponseAsync( + String resourceGroupName, String attestationName, AttestationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdateAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + attestationName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtResourceGroupWithResponseAsync( + String resourceGroupName, String attestationName, AttestationInner parameters, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdateAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + attestationName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceGroupAsync( + String resourceGroupName, String attestationName, AttestationInner parameters) { + Mono>> mono = + createOrUpdateAtResourceGroupWithResponseAsync(resourceGroupName, attestationName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AttestationInner.class, AttestationInner.class, Context.NONE); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceGroupAsync( + String resourceGroupName, String attestationName, AttestationInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateAtResourceGroupWithResponseAsync(resourceGroupName, attestationName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AttestationInner.class, AttestationInner.class, context); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters, Context context) { + return beginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtResourceGroupAsync( + String resourceGroupName, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtResourceGroupAsync( + String resourceGroupName, String attestationName, AttestationInner parameters, Context context) { + return beginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner createOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters) { + return createOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters).block(); + } + + /** + * Creates or updates an attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner createOrUpdateAtResourceGroup( + String resourceGroupName, String attestationName, AttestationInner parameters, Context context) { + return createOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters, context).block(); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String attestationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + attestationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String attestationName, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + attestationName, + apiVersion, + accept, + context); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String attestationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, attestationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner getByResourceGroup(String resourceGroupName, String attestationName) { + return getByResourceGroupAsync(resourceGroupName, attestationName).block(); + } + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String attestationName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, attestationName, context).block(); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String attestationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + attestationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String attestationName, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + attestationName, + apiVersion, + accept, + context); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String attestationName) { + return deleteWithResponseAsync(resourceGroupName, attestationName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 attestationName) { + deleteAsync(resourceGroupName, attestationName).block(); + } + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Response deleteWithResponse(String resourceGroupName, String attestationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, attestationName, context).block(); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceSinglePageAsync( + String resourceId, Integer top, String filter) { + 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 = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listForResource( + this.client.getEndpoint(), resourceId, top, filter, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceSinglePageAsync( + String resourceId, Integer top, 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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResource(this.client.getEndpoint(), resourceId, top, filter, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync(String resourceId, Integer top, String filter) { + return new PagedFlux<>( + () -> listForResourceSinglePageAsync(resourceId, top, filter), + nextLink -> listForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource 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 all attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync(String resourceId) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listForResourceSinglePageAsync(resourceId, top, filter), + nextLink -> listForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync( + String resourceId, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listForResourceSinglePageAsync(resourceId, top, filter, context), + nextLink -> listForResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource 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 all attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForResource(String resourceId) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listForResourceAsync(resourceId, top, filter)); + } + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForResource( + String resourceId, Integer top, String filter, Context context) { + return new PagedIterable<>(listForResourceAsync(resourceId, top, filter, context)); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtResourceWithResponseAsync( + String resourceId, String attestationName, AttestationInner parameters) { + 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdateAtResource( + this.client.getEndpoint(), + resourceId, + attestationName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateAtResourceWithResponseAsync( + String resourceId, String attestationName, AttestationInner parameters, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdateAtResource( + this.client.getEndpoint(), resourceId, attestationName, apiVersion, parameters, accept, context); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceAsync( + String resourceId, String attestationName, AttestationInner parameters) { + Mono>> mono = + createOrUpdateAtResourceWithResponseAsync(resourceId, attestationName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AttestationInner.class, AttestationInner.class, Context.NONE); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceAsync( + String resourceId, String attestationName, AttestationInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateAtResourceWithResponseAsync(resourceId, attestationName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AttestationInner.class, AttestationInner.class, context); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceAsync(resourceId, attestationName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters, Context context) { + return beginCreateOrUpdateAtResourceAsync(resourceId, attestationName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtResourceAsync( + String resourceId, String attestationName, AttestationInner parameters) { + return beginCreateOrUpdateAtResourceAsync(resourceId, attestationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtResourceAsync( + String resourceId, String attestationName, AttestationInner parameters, Context context) { + return beginCreateOrUpdateAtResourceAsync(resourceId, attestationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner createOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters) { + return createOrUpdateAtResourceAsync(resourceId, attestationName, parameters).block(); + } + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 attestation resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner createOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters, Context context) { + return createOrUpdateAtResourceAsync(resourceId, attestationName, parameters, context).block(); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtResourceWithResponseAsync(String resourceId, String attestationName) { + 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtResource( + this.client.getEndpoint(), resourceId, attestationName, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtResourceWithResponseAsync( + String resourceId, String attestationName, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtResource(this.client.getEndpoint(), resourceId, attestationName, apiVersion, accept, context); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtResourceAsync(String resourceId, String attestationName) { + return getAtResourceWithResponseAsync(resourceId, attestationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationInner getAtResource(String resourceId, String attestationName) { + return getAtResourceAsync(resourceId, attestationName).block(); + } + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing attestation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtResourceWithResponse( + String resourceId, String attestationName, Context context) { + return getAtResourceWithResponseAsync(resourceId, attestationName, context).block(); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtResourceWithResponseAsync(String resourceId, String attestationName) { + 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtResource( + this.client.getEndpoint(), resourceId, attestationName, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtResourceWithResponseAsync( + String resourceId, String attestationName, 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 (attestationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter attestationName is required and cannot be null.")); + } + final String apiVersion = "2021-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtResource(this.client.getEndpoint(), resourceId, attestationName, apiVersion, accept, context); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtResourceAsync(String resourceId, String attestationName) { + return deleteAtResourceWithResponseAsync(resourceId, attestationName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteAtResource(String resourceId, String attestationName) { + deleteAtResourceAsync(resourceId, attestationName).block(); + } + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Response deleteAtResourceWithResponse(String resourceId, String attestationName, Context context) { + return deleteAtResourceWithResponseAsync(resourceId, attestationName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of attestations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForSubscriptionNextSinglePageAsync(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.listForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of attestations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of attestations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceGroupNextSinglePageAsync(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.listForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of attestations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of attestations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceNextSinglePageAsync(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.listForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of attestations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsImpl.java new file mode 100644 index 000000000000..f41bae7b556b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsImpl.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.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.AttestationsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.azure.resourcemanager.policyinsights.models.Attestation; +import com.azure.resourcemanager.policyinsights.models.Attestations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AttestationsImpl implements Attestations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationsImpl.class); + + private final AttestationsClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public AttestationsImpl(AttestationsClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new AttestationImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(top, filter, context); + return inner.mapPage(inner1 -> new AttestationImpl(inner1, this.manager())); + } + + public Attestation createOrUpdateAtSubscription(String attestationName, AttestationInner parameters) { + AttestationInner inner = this.serviceClient().createOrUpdateAtSubscription(attestationName, parameters); + if (inner != null) { + return new AttestationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Attestation createOrUpdateAtSubscription( + String attestationName, AttestationInner parameters, Context context) { + AttestationInner inner = + this.serviceClient().createOrUpdateAtSubscription(attestationName, parameters, context); + if (inner != null) { + return new AttestationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Attestation getAtSubscription(String attestationName) { + AttestationInner inner = this.serviceClient().getAtSubscription(attestationName); + if (inner != null) { + return new AttestationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtSubscriptionWithResponse(String attestationName, Context context) { + Response inner = this.serviceClient().getAtSubscriptionWithResponse(attestationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteAtSubscription(String attestationName) { + this.serviceClient().deleteAtSubscription(attestationName); + } + + public Response deleteAtSubscriptionWithResponse(String attestationName, Context context) { + return this.serviceClient().deleteAtSubscriptionWithResponse(attestationName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new AttestationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, top, filter, context); + return inner.mapPage(inner1 -> new AttestationImpl(inner1, this.manager())); + } + + public Attestation getByResourceGroup(String resourceGroupName, String attestationName) { + AttestationInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, attestationName); + if (inner != null) { + return new AttestationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String attestationName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, attestationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String attestationName) { + this.serviceClient().delete(resourceGroupName, attestationName); + } + + public Response deleteWithResponse(String resourceGroupName, String attestationName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, attestationName, context); + } + + public PagedIterable listForResource(String resourceId) { + PagedIterable inner = this.serviceClient().listForResource(resourceId); + return inner.mapPage(inner1 -> new AttestationImpl(inner1, this.manager())); + } + + public PagedIterable listForResource(String resourceId, Integer top, String filter, Context context) { + PagedIterable inner = this.serviceClient().listForResource(resourceId, top, filter, context); + return inner.mapPage(inner1 -> new AttestationImpl(inner1, this.manager())); + } + + public Attestation createOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters) { + AttestationInner inner = this.serviceClient().createOrUpdateAtResource(resourceId, attestationName, parameters); + if (inner != null) { + return new AttestationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Attestation createOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters, Context context) { + AttestationInner inner = + this.serviceClient().createOrUpdateAtResource(resourceId, attestationName, parameters, context); + if (inner != null) { + return new AttestationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Attestation getAtResource(String resourceId, String attestationName) { + AttestationInner inner = this.serviceClient().getAtResource(resourceId, attestationName); + if (inner != null) { + return new AttestationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtResourceWithResponse(String resourceId, String attestationName, Context context) { + Response inner = + this.serviceClient().getAtResourceWithResponse(resourceId, attestationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteAtResource(String resourceId, String attestationName) { + this.serviceClient().deleteAtResource(resourceId, attestationName); + } + + public Response deleteAtResourceWithResponse(String resourceId, String attestationName, Context context) { + return this.serviceClient().deleteAtResourceWithResponse(resourceId, attestationName, context); + } + + public Attestation getById(String id) { + String resourceGroupName = Utils.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 attestationName = Utils.getValueFromIdByName(id, "attestations"); + if (attestationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'attestations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, attestationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 attestationName = Utils.getValueFromIdByName(id, "attestations"); + if (attestationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'attestations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, attestationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 attestationName = Utils.getValueFromIdByName(id, "attestations"); + if (attestationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'attestations'.", id))); + } + this.deleteWithResponse(resourceGroupName, attestationName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 attestationName = Utils.getValueFromIdByName(id, "attestations"); + if (attestationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'attestations'.", id))); + } + return this.deleteWithResponse(resourceGroupName, attestationName, context); + } + + private AttestationsClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } + + public AttestationImpl define(String name) { + return new AttestationImpl(name, this.manager()); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/CheckRestrictionsResultImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/CheckRestrictionsResultImpl.java new file mode 100644 index 000000000000..781f525f866d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/CheckRestrictionsResultImpl.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.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.CheckRestrictionsResultInner; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResult; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResultContentEvaluationResult; +import com.azure.resourcemanager.policyinsights.models.FieldRestrictions; +import java.util.Collections; +import java.util.List; + +public final class CheckRestrictionsResultImpl implements CheckRestrictionsResult { + private CheckRestrictionsResultInner innerObject; + + private final PolicyInsightsManager serviceManager; + + CheckRestrictionsResultImpl(CheckRestrictionsResultInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List fieldRestrictions() { + List inner = this.innerModel().fieldRestrictions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CheckRestrictionsResultContentEvaluationResult contentEvaluationResult() { + return this.innerModel().contentEvaluationResult(); + } + + public CheckRestrictionsResultInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..d224a5035921 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsClientImpl.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.policyinsights.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.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.policyinsights.fluent.OperationsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.OperationsListResultsInner; +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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.PolicyInsights/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists available operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + @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 = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists available operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, accept, context); + } + + /** + * Lists available operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists available operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationsListResultsInner list() { + return listAsync().block(); + } + + /** + * Lists available operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b0735e104133 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsImpl.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.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.OperationsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.OperationsListResultsInner; +import com.azure.resourcemanager.policyinsights.models.Operations; +import com.azure.resourcemanager.policyinsights.models.OperationsListResults; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationsListResults list() { + OperationsListResultsInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationsListResultsImpl(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 OperationsListResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsListResultsImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsListResultsImpl.java new file mode 100644 index 000000000000..1ff3ed2242f8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/OperationsListResultsImpl.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.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.OperationsListResultsInner; +import com.azure.resourcemanager.policyinsights.models.Operation; +import com.azure.resourcemanager.policyinsights.models.OperationsListResults; +import java.util.Collections; +import java.util.List; + +public final class OperationsListResultsImpl implements OperationsListResults { + private OperationsListResultsInner innerObject; + + private final PolicyInsightsManager serviceManager; + + OperationsListResultsImpl(OperationsListResultsInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer odataCount() { + return this.innerModel().odataCount(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OperationsListResultsInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventImpl.java new file mode 100644 index 000000000000..223a61d2c86f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyEventInner; +import com.azure.resourcemanager.policyinsights.models.ComponentEventDetails; +import com.azure.resourcemanager.policyinsights.models.PolicyEvent; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class PolicyEventImpl implements PolicyEvent { + private PolicyEventInner innerObject; + + private final PolicyInsightsManager serviceManager; + + PolicyEventImpl(PolicyEventInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String odataId() { + return this.innerModel().odataId(); + } + + public String odataContext() { + return this.innerModel().odataContext(); + } + + public OffsetDateTime timestamp() { + return this.innerModel().timestamp(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String policyAssignmentId() { + return this.innerModel().policyAssignmentId(); + } + + public String policyDefinitionId() { + return this.innerModel().policyDefinitionId(); + } + + public String effectiveParameters() { + return this.innerModel().effectiveParameters(); + } + + public Boolean isCompliant() { + return this.innerModel().isCompliant(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String resourceLocation() { + return this.innerModel().resourceLocation(); + } + + public String resourceGroup() { + return this.innerModel().resourceGroup(); + } + + public String resourceTags() { + return this.innerModel().resourceTags(); + } + + public String policyAssignmentName() { + return this.innerModel().policyAssignmentName(); + } + + public String policyAssignmentOwner() { + return this.innerModel().policyAssignmentOwner(); + } + + public String policyAssignmentParameters() { + return this.innerModel().policyAssignmentParameters(); + } + + public String policyAssignmentScope() { + return this.innerModel().policyAssignmentScope(); + } + + public String policyDefinitionName() { + return this.innerModel().policyDefinitionName(); + } + + public String policyDefinitionAction() { + return this.innerModel().policyDefinitionAction(); + } + + public String policyDefinitionCategory() { + return this.innerModel().policyDefinitionCategory(); + } + + public String policySetDefinitionId() { + return this.innerModel().policySetDefinitionId(); + } + + public String policySetDefinitionName() { + return this.innerModel().policySetDefinitionName(); + } + + public String policySetDefinitionOwner() { + return this.innerModel().policySetDefinitionOwner(); + } + + public String policySetDefinitionCategory() { + return this.innerModel().policySetDefinitionCategory(); + } + + public String policySetDefinitionParameters() { + return this.innerModel().policySetDefinitionParameters(); + } + + public String managementGroupIds() { + return this.innerModel().managementGroupIds(); + } + + public String policyDefinitionReferenceId() { + return this.innerModel().policyDefinitionReferenceId(); + } + + public String complianceState() { + return this.innerModel().complianceState(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String principalOid() { + return this.innerModel().principalOid(); + } + + public List components() { + List inner = this.innerModel().components(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map additionalProperties() { + Map inner = this.innerModel().additionalProperties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public PolicyEventInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java new file mode 100644 index 000000000000..cefc4a41a312 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsClientImpl.java @@ -0,0 +1,3827 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.PolicyEventsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyEventInner; +import com.azure.resourcemanager.policyinsights.models.PolicyEventsQueryResults; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PolicyEventsClient. */ +public final class PolicyEventsClientImpl implements PolicyEventsClient { + private final ClientLogger logger = new ClientLogger(PolicyEventsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PolicyEventsService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyEventsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PolicyEventsClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy.create(PolicyEventsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientPolicyEvents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface PolicyEventsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers" + + "/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupName") String managementGroupName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForSubscription( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/policyEvents/{policyEventsResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResource( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$expand") String expand, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions" + + "/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForPolicySetDefinition( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policySetDefinitionName") String policySetDefinitionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions" + + "/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForPolicyDefinition( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyDefinitionName") String policyDefinitionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments" + + "/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForSubscriptionLevelPolicyAssignment( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyAssignmentName") String policyAssignmentName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}" + + "/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents" + + "/{policyEventsResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResourceGroupLevelPolicyAssignment( + @HostParam("$host") String endpoint, + @PathParam("policyEventsResource") String policyEventsResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyAssignmentName") String policyAssignmentName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForManagementGroupNext( + @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> listQueryResultsForSubscriptionNext( + @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> listQueryResultsForResourceGroupNext( + @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> listQueryResultsForResourceNext( + @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> listQueryResultsForPolicySetDefinitionNext( + @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> listQueryResultsForPolicyDefinitionNext( + @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> listQueryResultsForSubscriptionLevelPolicyAssignmentNext( + @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> listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupSinglePageAsync( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForManagementGroup( + this.client.getEndpoint(), + policyEventsResource, + managementGroupsNamespace, + managementGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupSinglePageAsync( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForManagementGroup( + this.client.getEndpoint(), + policyEventsResource, + managementGroupsNamespace, + managementGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForManagementGroupSinglePageAsync( + managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync(String managementGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForManagementGroupSinglePageAsync( + managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForManagementGroupSinglePageAsync( + managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken, context), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForManagementGroup(String managementGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForManagementGroupAsync( + managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForManagementGroupAsync( + managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken, context)); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionSinglePageAsync( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForSubscription( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionSinglePageAsync( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscription( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionSinglePageAsync( + subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync(String subscriptionId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionSinglePageAsync( + subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionSinglePageAsync( + subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken, context), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscription(String subscriptionId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForSubscriptionAsync( + subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscription( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForSubscriptionAsync( + subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken, context)); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupSinglePageAsync( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResourceGroup( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + resourceGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupSinglePageAsync( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroup( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + resourceGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupSinglePageAsync( + subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + String subscriptionId, String resourceGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupSinglePageAsync( + subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupSinglePageAsync( + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroup( + String subscriptionId, String resourceGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForResourceGroupAsync( + subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroup( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForResourceGroupAsync( + subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken, context)); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceSinglePageAsync( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken) { + 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 policyEventsResource = "default"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResource( + this.client.getEndpoint(), + policyEventsResource, + resourceId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + expand, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceSinglePageAsync( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + 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 policyEventsResource = "default"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResource( + this.client.getEndpoint(), + policyEventsResource, + resourceId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + expand, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceSinglePageAsync( + resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync(String resourceId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String expand = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForResourceSinglePageAsync( + resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceSinglePageAsync( + resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken, context), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResource(String resourceId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String expand = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForResourceAsync( + resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken)); + } + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResource( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForResourceAsync( + resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken, context)); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionSinglePageAsync( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policySetDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForPolicySetDefinition( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + authorizationNamespace, + policySetDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionSinglePageAsync( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policySetDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicySetDefinition( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + authorizationNamespace, + policySetDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicySetDefinitionAsync( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicySetDefinitionSinglePageAsync( + subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicySetDefinitionAsync( + String subscriptionId, String policySetDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForPolicySetDefinitionSinglePageAsync( + subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicySetDefinitionAsync( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicySetDefinitionSinglePageAsync( + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, String policySetDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForPolicySetDefinitionAsync( + subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForPolicySetDefinitionAsync( + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionSinglePageAsync( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForPolicyDefinition( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + authorizationNamespace, + policyDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionSinglePageAsync( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicyDefinition( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + authorizationNamespace, + policyDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicyDefinitionAsync( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicyDefinitionSinglePageAsync( + subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicyDefinitionAsync( + String subscriptionId, String policyDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForPolicyDefinitionSinglePageAsync( + subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicyDefinitionAsync( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicyDefinitionSinglePageAsync( + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicyDefinition( + String subscriptionId, String policyDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForPolicyDefinitionAsync( + subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicyDefinition( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForPolicyDefinitionAsync( + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForSubscriptionLevelPolicyAssignment( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscriptionLevelPolicyAssignment( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + String subscriptionId, String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResourceGroupLevelPolicyAssignment( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + resourceGroupName, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyEventsResource = "default"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroupLevelPolicyAssignment( + this.client.getEndpoint(), + policyEventsResource, + subscriptionId, + resourceGroupName, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + String subscriptionId, String resourceGroupName, String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken)); + } + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( + 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 + .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionNextSinglePageAsync(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.listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupNextSinglePageAsync(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.listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceNextSinglePageAsync(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.listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( + 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 + .listQueryResultsForPolicySetDefinitionNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicySetDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( + 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 + .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(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 + .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(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 + .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsImpl.java new file mode 100644 index 000000000000..1194dac2955a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyEventsImpl.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.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.PolicyEventsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyEventInner; +import com.azure.resourcemanager.policyinsights.models.PolicyEvent; +import com.azure.resourcemanager.policyinsights.models.PolicyEvents; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +public final class PolicyEventsImpl implements PolicyEvents { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyEventsImpl.class); + + private final PolicyEventsClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public PolicyEventsImpl(PolicyEventsClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listQueryResultsForManagementGroup(String managementGroupName) { + PagedIterable inner = + this.serviceClient().listQueryResultsForManagementGroup(managementGroupName); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForManagementGroup( + managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken, context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscription(String subscriptionId) { + PagedIterable inner = this.serviceClient().listQueryResultsForSubscription(subscriptionId); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscription( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForSubscription( + subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken, context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroup( + String subscriptionId, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listQueryResultsForResourceGroup(subscriptionId, resourceGroupName); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroup( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResourceGroup( + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResource(String resourceId) { + PagedIterable inner = this.serviceClient().listQueryResultsForResource(resourceId); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResource( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResource( + resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken, context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, String policySetDefinitionName) { + PagedIterable inner = + this.serviceClient().listQueryResultsForPolicySetDefinition(subscriptionId, policySetDefinitionName); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForPolicySetDefinition( + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForPolicyDefinition( + String subscriptionId, String policyDefinitionName) { + PagedIterable inner = + this.serviceClient().listQueryResultsForPolicyDefinition(subscriptionId, policyDefinitionName); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForPolicyDefinition( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForPolicyDefinition( + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, String policyAssignmentName) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForSubscriptionLevelPolicyAssignment(subscriptionId, policyAssignmentName); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + subscriptionId, resourceGroupName, policyAssignmentName); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyEventImpl(inner1, this.manager())); + } + + private PolicyEventsClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientBuilder.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientBuilder.java new file mode 100644 index 000000000000..e11a30c78ed2 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the PolicyInsightsClientImpl type. */ +@ServiceClientBuilder(serviceClients = {PolicyInsightsClientImpl.class}) +public final class PolicyInsightsClientBuilder { + /* + * Microsoft Azure subscription ID. + */ + private String subscriptionId; + + /** + * Sets Microsoft Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the PolicyInsightsClientBuilder. + */ + public PolicyInsightsClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the PolicyInsightsClientBuilder. + */ + public PolicyInsightsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the PolicyInsightsClientBuilder. + */ + public PolicyInsightsClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the PolicyInsightsClientBuilder. + */ + public PolicyInsightsClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PolicyInsightsClientBuilder. + */ + public PolicyInsightsClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the PolicyInsightsClientBuilder. + */ + public PolicyInsightsClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PolicyInsightsClientImpl with the provided parameters. + * + * @return an instance of PolicyInsightsClientImpl. + */ + public PolicyInsightsClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + PolicyInsightsClientImpl client = + new PolicyInsightsClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientImpl.java new file mode 100644 index 000000000000..2e218e91d166 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyInsightsClientImpl.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +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.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.policyinsights.fluent.AttestationsClient; +import com.azure.resourcemanager.policyinsights.fluent.OperationsClient; +import com.azure.resourcemanager.policyinsights.fluent.PolicyEventsClient; +import com.azure.resourcemanager.policyinsights.fluent.PolicyInsightsClient; +import com.azure.resourcemanager.policyinsights.fluent.PolicyMetadatasClient; +import com.azure.resourcemanager.policyinsights.fluent.PolicyRestrictionsClient; +import com.azure.resourcemanager.policyinsights.fluent.PolicyStatesClient; +import com.azure.resourcemanager.policyinsights.fluent.PolicyTrackedResourcesClient; +import com.azure.resourcemanager.policyinsights.fluent.RemediationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the PolicyInsightsClientImpl type. */ +@ServiceClient(builder = PolicyInsightsClientBuilder.class) +public final class PolicyInsightsClientImpl implements PolicyInsightsClient { + private final ClientLogger logger = new ClientLogger(PolicyInsightsClientImpl.class); + + /** Microsoft Azure subscription ID. */ + private final String subscriptionId; + + /** + * Gets Microsoft Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The PolicyTrackedResourcesClient object to access its operations. */ + private final PolicyTrackedResourcesClient policyTrackedResources; + + /** + * Gets the PolicyTrackedResourcesClient object to access its operations. + * + * @return the PolicyTrackedResourcesClient object. + */ + public PolicyTrackedResourcesClient getPolicyTrackedResources() { + return this.policyTrackedResources; + } + + /** The RemediationsClient object to access its operations. */ + private final RemediationsClient remediations; + + /** + * Gets the RemediationsClient object to access its operations. + * + * @return the RemediationsClient object. + */ + public RemediationsClient getRemediations() { + return this.remediations; + } + + /** The PolicyEventsClient object to access its operations. */ + private final PolicyEventsClient policyEvents; + + /** + * Gets the PolicyEventsClient object to access its operations. + * + * @return the PolicyEventsClient object. + */ + public PolicyEventsClient getPolicyEvents() { + return this.policyEvents; + } + + /** The PolicyStatesClient object to access its operations. */ + private final PolicyStatesClient policyStates; + + /** + * Gets the PolicyStatesClient object to access its operations. + * + * @return the PolicyStatesClient object. + */ + public PolicyStatesClient getPolicyStates() { + return this.policyStates; + } + + /** 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 PolicyMetadatasClient object to access its operations. */ + private final PolicyMetadatasClient policyMetadatas; + + /** + * Gets the PolicyMetadatasClient object to access its operations. + * + * @return the PolicyMetadatasClient object. + */ + public PolicyMetadatasClient getPolicyMetadatas() { + return this.policyMetadatas; + } + + /** The PolicyRestrictionsClient object to access its operations. */ + private final PolicyRestrictionsClient policyRestrictions; + + /** + * Gets the PolicyRestrictionsClient object to access its operations. + * + * @return the PolicyRestrictionsClient object. + */ + public PolicyRestrictionsClient getPolicyRestrictions() { + return this.policyRestrictions; + } + + /** The AttestationsClient object to access its operations. */ + private final AttestationsClient attestations; + + /** + * Gets the AttestationsClient object to access its operations. + * + * @return the AttestationsClient object. + */ + public AttestationsClient getAttestations() { + return this.attestations; + } + + /** + * Initializes an instance of PolicyInsightsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Microsoft Azure subscription ID. + * @param endpoint server parameter. + */ + PolicyInsightsClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.policyTrackedResources = new PolicyTrackedResourcesClientImpl(this); + this.remediations = new RemediationsClientImpl(this); + this.policyEvents = new PolicyEventsClientImpl(this); + this.policyStates = new PolicyStatesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.policyMetadatas = new PolicyMetadatasClientImpl(this); + this.policyRestrictions = new PolicyRestrictionsClientImpl(this); + this.attestations = new AttestationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadataImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadataImpl.java new file mode 100644 index 000000000000..b553bbb2b254 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadataImpl.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.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyMetadataInner; +import com.azure.resourcemanager.policyinsights.models.PolicyMetadata; + +public final class PolicyMetadataImpl implements PolicyMetadata { + private PolicyMetadataInner innerObject; + + private final PolicyInsightsManager serviceManager; + + PolicyMetadataImpl(PolicyMetadataInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String metadataId() { + return this.innerModel().metadataId(); + } + + public String category() { + return this.innerModel().category(); + } + + public String title() { + return this.innerModel().title(); + } + + public String owner() { + return this.innerModel().owner(); + } + + public String additionalContentUrl() { + return this.innerModel().additionalContentUrl(); + } + + public Object metadata() { + return this.innerModel().metadata(); + } + + public String description() { + return this.innerModel().description(); + } + + public String requirements() { + return this.innerModel().requirements(); + } + + public PolicyMetadataInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasClientImpl.java new file mode 100644 index 000000000000..40b8005102eb --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasClientImpl.java @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.PolicyMetadatasClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyMetadataInner; +import com.azure.resourcemanager.policyinsights.fluent.models.SlimPolicyMetadataInner; +import com.azure.resourcemanager.policyinsights.models.PolicyMetadataCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PolicyMetadatasClient. */ +public final class PolicyMetadatasClientImpl implements PolicyMetadatasClient { + private final ClientLogger logger = new ClientLogger(PolicyMetadatasClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PolicyMetadatasService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyMetadatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PolicyMetadatasClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy.create(PolicyMetadatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientPolicyMetadatas to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface PolicyMetadatasService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.PolicyInsights/policyMetadata/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceName", encoded = true) String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.PolicyInsights/policyMetadata") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceWithResponseAsync(String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getResource(this.client.getEndpoint(), resourceName, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getResourceWithResponseAsync(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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getResource(this.client.getEndpoint(), resourceName, apiVersion, accept, context); + } + + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getResourceAsync(String resourceName) { + return getResourceWithResponseAsync(resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PolicyMetadataInner getResource(String resourceName) { + return getResourceAsync(resourceName).block(); + } + + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceWithResponse(String resourceName, Context context) { + return getResourceWithResponseAsync(resourceName, context).block(); + } + + /** + * Get a list of the policy metadata resources. + * + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, top, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a list of the policy metadata resources. + * + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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 = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, top, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of the policy metadata resources. + * + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of the policy metadata resources. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + return new PagedFlux<>(() -> listSinglePageAsync(top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of the policy metadata resources. + * + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of the policy metadata resources. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + return new PagedIterable<>(listAsync(top)); + } + + /** + * Get a list of the policy metadata resources. + * + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Context context) { + return new PagedIterable<>(listAsync(top, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of policy metadata resources. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of policy metadata resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasImpl.java new file mode 100644 index 000000000000..7c0425904c62 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyMetadatasImpl.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.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.PolicyMetadatasClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyMetadataInner; +import com.azure.resourcemanager.policyinsights.fluent.models.SlimPolicyMetadataInner; +import com.azure.resourcemanager.policyinsights.models.PolicyMetadata; +import com.azure.resourcemanager.policyinsights.models.PolicyMetadatas; +import com.azure.resourcemanager.policyinsights.models.SlimPolicyMetadata; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PolicyMetadatasImpl implements PolicyMetadatas { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyMetadatasImpl.class); + + private final PolicyMetadatasClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public PolicyMetadatasImpl(PolicyMetadatasClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PolicyMetadata getResource(String resourceName) { + PolicyMetadataInner inner = this.serviceClient().getResource(resourceName); + if (inner != null) { + return new PolicyMetadataImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getResourceWithResponse(String resourceName, Context context) { + Response inner = this.serviceClient().getResourceWithResponse(resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PolicyMetadataImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new SlimPolicyMetadataImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(top, context); + return inner.mapPage(inner1 -> new SlimPolicyMetadataImpl(inner1, this.manager())); + } + + private PolicyMetadatasClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsClientImpl.java new file mode 100644 index 000000000000..f40dd211552d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsClientImpl.java @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.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.policyinsights.fluent.PolicyRestrictionsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.CheckRestrictionsResultInner; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PolicyRestrictionsClient. */ +public final class PolicyRestrictionsClientImpl implements PolicyRestrictionsClient { + private final ClientLogger logger = new ClientLogger(PolicyRestrictionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PolicyRestrictionsService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyRestrictionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PolicyRestrictionsClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy.create(PolicyRestrictionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientPolicyRestrictions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface PolicyRestrictionsService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkAtSubscriptionScope( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckRestrictionsRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/checkPolicyRestrictions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkAtResourceGroupScope( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckRestrictionsRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAtSubscriptionScopeWithResponseAsync( + CheckRestrictionsRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkAtSubscriptionScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAtSubscriptionScopeWithResponseAsync( + CheckRestrictionsRequest parameters, 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkAtSubscriptionScope( + this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, parameters, accept, context); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkAtSubscriptionScopeAsync(CheckRestrictionsRequest parameters) { + return checkAtSubscriptionScopeWithResponseAsync(parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckRestrictionsResultInner checkAtSubscriptionScope(CheckRestrictionsRequest parameters) { + return checkAtSubscriptionScopeAsync(parameters).block(); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkAtSubscriptionScopeWithResponse( + CheckRestrictionsRequest parameters, Context context) { + return checkAtSubscriptionScopeWithResponseAsync(parameters, context).block(); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAtResourceGroupScopeWithResponseAsync( + String resourceGroupName, CheckRestrictionsRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkAtResourceGroupScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAtResourceGroupScopeWithResponseAsync( + String resourceGroupName, CheckRestrictionsRequest parameters, 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkAtResourceGroupScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkAtResourceGroupScopeAsync( + String resourceGroupName, CheckRestrictionsRequest parameters) { + return checkAtResourceGroupScopeWithResponseAsync(resourceGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckRestrictionsResultInner checkAtResourceGroupScope( + String resourceGroupName, CheckRestrictionsRequest parameters) { + return checkAtResourceGroupScopeAsync(resourceGroupName, parameters).block(); + } + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkAtResourceGroupScopeWithResponse( + String resourceGroupName, CheckRestrictionsRequest parameters, Context context) { + return checkAtResourceGroupScopeWithResponseAsync(resourceGroupName, parameters, context).block(); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsImpl.java new file mode 100644 index 000000000000..3c106bcc5b3d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyRestrictionsImpl.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.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.PolicyRestrictionsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.CheckRestrictionsResultInner; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsRequest; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResult; +import com.azure.resourcemanager.policyinsights.models.PolicyRestrictions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PolicyRestrictionsImpl implements PolicyRestrictions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyRestrictionsImpl.class); + + private final PolicyRestrictionsClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public PolicyRestrictionsImpl(PolicyRestrictionsClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckRestrictionsResult checkAtSubscriptionScope(CheckRestrictionsRequest parameters) { + CheckRestrictionsResultInner inner = this.serviceClient().checkAtSubscriptionScope(parameters); + if (inner != null) { + return new CheckRestrictionsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkAtSubscriptionScopeWithResponse( + CheckRestrictionsRequest parameters, Context context) { + Response inner = + this.serviceClient().checkAtSubscriptionScopeWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckRestrictionsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckRestrictionsResult checkAtResourceGroupScope( + String resourceGroupName, CheckRestrictionsRequest parameters) { + CheckRestrictionsResultInner inner = + this.serviceClient().checkAtResourceGroupScope(resourceGroupName, parameters); + if (inner != null) { + return new CheckRestrictionsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkAtResourceGroupScopeWithResponse( + String resourceGroupName, CheckRestrictionsRequest parameters, Context context) { + Response inner = + this.serviceClient().checkAtResourceGroupScopeWithResponse(resourceGroupName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckRestrictionsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PolicyRestrictionsClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStateImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStateImpl.java new file mode 100644 index 000000000000..9741730fe1a7 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStateImpl.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.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyStateInner; +import com.azure.resourcemanager.policyinsights.models.ComponentStateDetails; +import com.azure.resourcemanager.policyinsights.models.PolicyEvaluationDetails; +import com.azure.resourcemanager.policyinsights.models.PolicyState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class PolicyStateImpl implements PolicyState { + private PolicyStateInner innerObject; + + private final PolicyInsightsManager serviceManager; + + PolicyStateImpl(PolicyStateInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String odataId() { + return this.innerModel().odataId(); + } + + public String odataContext() { + return this.innerModel().odataContext(); + } + + public OffsetDateTime timestamp() { + return this.innerModel().timestamp(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String policyAssignmentId() { + return this.innerModel().policyAssignmentId(); + } + + public String policyDefinitionId() { + return this.innerModel().policyDefinitionId(); + } + + public String effectiveParameters() { + return this.innerModel().effectiveParameters(); + } + + public Boolean isCompliant() { + return this.innerModel().isCompliant(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String resourceLocation() { + return this.innerModel().resourceLocation(); + } + + public String resourceGroup() { + return this.innerModel().resourceGroup(); + } + + public String resourceTags() { + return this.innerModel().resourceTags(); + } + + public String policyAssignmentName() { + return this.innerModel().policyAssignmentName(); + } + + public String policyAssignmentOwner() { + return this.innerModel().policyAssignmentOwner(); + } + + public String policyAssignmentParameters() { + return this.innerModel().policyAssignmentParameters(); + } + + public String policyAssignmentScope() { + return this.innerModel().policyAssignmentScope(); + } + + public String policyDefinitionName() { + return this.innerModel().policyDefinitionName(); + } + + public String policyDefinitionAction() { + return this.innerModel().policyDefinitionAction(); + } + + public String policyDefinitionCategory() { + return this.innerModel().policyDefinitionCategory(); + } + + public String policySetDefinitionId() { + return this.innerModel().policySetDefinitionId(); + } + + public String policySetDefinitionName() { + return this.innerModel().policySetDefinitionName(); + } + + public String policySetDefinitionOwner() { + return this.innerModel().policySetDefinitionOwner(); + } + + public String policySetDefinitionCategory() { + return this.innerModel().policySetDefinitionCategory(); + } + + public String policySetDefinitionParameters() { + return this.innerModel().policySetDefinitionParameters(); + } + + public String managementGroupIds() { + return this.innerModel().managementGroupIds(); + } + + public String policyDefinitionReferenceId() { + return this.innerModel().policyDefinitionReferenceId(); + } + + public String complianceState() { + return this.innerModel().complianceState(); + } + + public PolicyEvaluationDetails policyEvaluationDetails() { + return this.innerModel().policyEvaluationDetails(); + } + + public List policyDefinitionGroupNames() { + List inner = this.innerModel().policyDefinitionGroupNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List components() { + List inner = this.innerModel().components(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String policyDefinitionVersion() { + return this.innerModel().policyDefinitionVersion(); + } + + public String policySetDefinitionVersion() { + return this.innerModel().policySetDefinitionVersion(); + } + + public String policyAssignmentVersion() { + return this.innerModel().policyAssignmentVersion(); + } + + public Map additionalProperties() { + Map inner = this.innerModel().additionalProperties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public PolicyStateInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java new file mode 100644 index 000000000000..af0a39facf7d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesClientImpl.java @@ -0,0 +1,6639 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.policyinsights.fluent.PolicyStatesClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyStateInner; +import com.azure.resourcemanager.policyinsights.fluent.models.SummarizeResultsInner; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesQueryResults; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; +import java.nio.ByteBuffer; +import java.time.OffsetDateTime; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PolicyStatesClient. */ +public final class PolicyStatesClientImpl implements PolicyStatesClient { + private final ClientLogger logger = new ClientLogger(PolicyStatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PolicyStatesService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyStatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PolicyStatesClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy.create(PolicyStatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientPolicyStates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface PolicyStatesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers" + + "/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupName") String managementGroupName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers" + + "/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupName") String managementGroupName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForSubscription( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates" + + "/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForSubscription( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/policyStates/{policyStatesResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/policyStates/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResource( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$expand") String expand, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForResource( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> triggerSubscriptionEvaluation( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/policyStates/latest/triggerEvaluation") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> triggerResourceGroupEvaluation( + @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"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions" + + "/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForPolicySetDefinition( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policySetDefinitionName") String policySetDefinitionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions" + + "/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates" + + "/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForPolicySetDefinition( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policySetDefinitionName") String policySetDefinitionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions" + + "/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForPolicyDefinition( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyDefinitionName") String policyDefinitionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions" + + "/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates" + + "/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForPolicyDefinition( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyDefinitionName") String policyDefinitionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments" + + "/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForSubscriptionLevelPolicyAssignment( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyAssignmentName") String policyAssignmentName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments" + + "/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates" + + "/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForSubscriptionLevelPolicyAssignment( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyAssignmentName") String policyAssignmentName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}" + + "/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates" + + "/{policyStatesResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResourceGroupLevelPolicyAssignment( + @HostParam("$host") String endpoint, + @PathParam("policyStatesResource") PolicyStatesResource policyStatesResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyAssignmentName") String policyAssignmentName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderBy, + @QueryParam("$select") String select, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @QueryParam("$apply") String apply, + @QueryParam("$skiptoken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}" + + "/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates" + + "/{policyStatesSummaryResource}/summarize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> summarizeForResourceGroupLevelPolicyAssignment( + @HostParam("$host") String endpoint, + @PathParam("policyStatesSummaryResource") String policyStatesSummaryResource, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("authorizationNamespace") String authorizationNamespace, + @PathParam("policyAssignmentName") String policyAssignmentName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$from") OffsetDateTime from, + @QueryParam("$to") OffsetDateTime to, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForManagementGroupNext( + @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> listQueryResultsForSubscriptionNext( + @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> listQueryResultsForResourceGroupNext( + @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> listQueryResultsForResourceNext( + @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> listQueryResultsForPolicySetDefinitionNext( + @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> listQueryResultsForPolicyDefinitionNext( + @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> listQueryResultsForSubscriptionLevelPolicyAssignmentNext( + @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> listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupSinglePageAsync( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForManagementGroup( + this.client.getEndpoint(), + policyStatesResource, + managementGroupsNamespace, + managementGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupSinglePageAsync( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForManagementGroup( + this.client.getEndpoint(), + policyStatesResource, + managementGroupsNamespace, + managementGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForManagementGroupSinglePageAsync( + policyStatesResource, + managementGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync( + PolicyStatesResource policyStatesResource, String managementGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForManagementGroupSinglePageAsync( + policyStatesResource, + managementGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForManagementGroupSinglePageAsync( + policyStatesResource, + managementGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, String managementGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForManagementGroupAsync( + policyStatesResource, managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForManagementGroupAsync( + policyStatesResource, + managementGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForManagementGroupWithResponseAsync( + String managementGroupName, Integer top, OffsetDateTime from, OffsetDateTime to, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForManagementGroup( + this.client.getEndpoint(), + policyStatesSummaryResource, + managementGroupsNamespace, + managementGroupName, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForManagementGroupWithResponseAsync( + String managementGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + 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 (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForManagementGroup( + this.client.getEndpoint(), + policyStatesSummaryResource, + managementGroupsNamespace, + managementGroupName, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForManagementGroupAsync( + String managementGroupName, Integer top, OffsetDateTime from, OffsetDateTime to, String filter) { + return summarizeForManagementGroupWithResponseAsync(managementGroupName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForManagementGroupAsync(String managementGroupName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForManagementGroupWithResponseAsync(managementGroupName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForManagementGroup(String managementGroupName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForManagementGroupAsync(managementGroupName, top, from, to, filter).block(); + } + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForManagementGroupWithResponse( + String managementGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + return summarizeForManagementGroupWithResponseAsync(managementGroupName, top, from, to, filter, context) + .block(); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForSubscription( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscription( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionSinglePageAsync( + policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync( + PolicyStatesResource policyStatesResource, String subscriptionId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionSinglePageAsync( + policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionSinglePageAsync( + policyStatesResource, + subscriptionId, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, String subscriptionId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForSubscriptionAsync( + policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken)); + } + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForSubscriptionAsync( + policyStatesResource, + subscriptionId, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForSubscriptionWithResponseAsync( + String subscriptionId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForSubscription( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForSubscriptionWithResponseAsync( + String subscriptionId, Integer top, OffsetDateTime from, OffsetDateTime to, 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForSubscription( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForSubscriptionAsync( + String subscriptionId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter) { + return summarizeForSubscriptionWithResponseAsync(subscriptionId, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForSubscriptionAsync(String subscriptionId) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForSubscriptionWithResponseAsync(subscriptionId, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForSubscription(String subscriptionId) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForSubscriptionAsync(subscriptionId, top, from, to, filter).block(); + } + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForSubscriptionWithResponse( + String subscriptionId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context) { + return summarizeForSubscriptionWithResponseAsync(subscriptionId, top, from, to, filter, context).block(); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId 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-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResourceGroup( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + resourceGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId 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-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroup( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + resourceGroupName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupSinglePageAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupSinglePageAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupSinglePageAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForResourceGroupAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken)); + } + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForResourceGroupAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForResourceGroupWithResponseAsync( + String subscriptionId, + String resourceGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForResourceGroup( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + resourceGroupName, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForResourceGroupWithResponseAsync( + String subscriptionId, + String resourceGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForResourceGroup( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + resourceGroupName, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForResourceGroupAsync( + String subscriptionId, + String resourceGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + return summarizeForResourceGroupWithResponseAsync(subscriptionId, resourceGroupName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForResourceGroupAsync( + String subscriptionId, String resourceGroupName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForResourceGroupWithResponseAsync(subscriptionId, resourceGroupName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForResourceGroup(String subscriptionId, String resourceGroupName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForResourceGroupAsync(subscriptionId, resourceGroupName, top, from, to, filter).block(); + } + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForResourceGroupWithResponse( + String subscriptionId, + String resourceGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + return summarizeForResourceGroupWithResponseAsync( + subscriptionId, resourceGroupName, top, from, to, filter, context) + .block(); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceSinglePageAsync( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource 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-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResource( + this.client.getEndpoint(), + policyStatesResource, + resourceId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + expand, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceSinglePageAsync( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource 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-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResource( + this.client.getEndpoint(), + policyStatesResource, + resourceId, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + expand, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceSinglePageAsync( + policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync( + PolicyStatesResource policyStatesResource, String resourceId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String expand = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForResourceSinglePageAsync( + policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceSinglePageAsync( + policyStatesResource, + resourceId, + top, + orderBy, + select, + from, + to, + filter, + apply, + expand, + skipToken, + context), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, String resourceId) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String expand = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForResourceAsync( + policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken)); + } + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForResourceAsync( + policyStatesResource, + resourceId, + top, + orderBy, + select, + from, + to, + filter, + apply, + expand, + skipToken, + context)); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForResourceWithResponseAsync( + String resourceId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter) { + 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 policyStatesSummaryResource = "latest"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForResource( + this.client.getEndpoint(), + policyStatesSummaryResource, + resourceId, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForResourceWithResponseAsync( + String resourceId, Integer top, OffsetDateTime from, OffsetDateTime to, 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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForResource( + this.client.getEndpoint(), + policyStatesSummaryResource, + resourceId, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForResourceAsync( + String resourceId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter) { + return summarizeForResourceWithResponseAsync(resourceId, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForResourceAsync(String resourceId) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForResourceWithResponseAsync(resourceId, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForResource(String resourceId) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForResourceAsync(resourceId, top, from, to, filter).block(); + } + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForResourceWithResponse( + String resourceId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context) { + return summarizeForResourceWithResponseAsync(resourceId, top, from, to, filter, context).block(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerSubscriptionEvaluationWithResponseAsync(String subscriptionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .triggerSubscriptionEvaluation( + this.client.getEndpoint(), subscriptionId, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerSubscriptionEvaluationWithResponseAsync( + String subscriptionId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .triggerSubscriptionEvaluation(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerSubscriptionEvaluationAsync(String subscriptionId) { + Mono>> mono = triggerSubscriptionEvaluationWithResponseAsync(subscriptionId); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerSubscriptionEvaluationAsync( + String subscriptionId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = triggerSubscriptionEvaluationWithResponseAsync(subscriptionId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTriggerSubscriptionEvaluation(String subscriptionId) { + return beginTriggerSubscriptionEvaluationAsync(subscriptionId).getSyncPoller(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTriggerSubscriptionEvaluation( + String subscriptionId, Context context) { + return beginTriggerSubscriptionEvaluationAsync(subscriptionId, context).getSyncPoller(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerSubscriptionEvaluationAsync(String subscriptionId) { + return beginTriggerSubscriptionEvaluationAsync(subscriptionId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerSubscriptionEvaluationAsync(String subscriptionId, Context context) { + return beginTriggerSubscriptionEvaluationAsync(subscriptionId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerSubscriptionEvaluation(String subscriptionId) { + triggerSubscriptionEvaluationAsync(subscriptionId).block(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerSubscriptionEvaluation(String subscriptionId, Context context) { + triggerSubscriptionEvaluationAsync(subscriptionId, context).block(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerResourceGroupEvaluationWithResponseAsync( + String subscriptionId, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId 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-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .triggerResourceGroupEvaluation( + this.client.getEndpoint(), subscriptionId, resourceGroupName, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerResourceGroupEvaluationWithResponseAsync( + String subscriptionId, 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId 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-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .triggerResourceGroupEvaluation( + this.client.getEndpoint(), subscriptionId, resourceGroupName, apiVersion, accept, context); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerResourceGroupEvaluationAsync( + String subscriptionId, String resourceGroupName) { + Mono>> mono = + triggerResourceGroupEvaluationWithResponseAsync(subscriptionId, resourceGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTriggerResourceGroupEvaluationAsync( + String subscriptionId, String resourceGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + triggerResourceGroupEvaluationWithResponseAsync(subscriptionId, resourceGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTriggerResourceGroupEvaluation( + String subscriptionId, String resourceGroupName) { + return beginTriggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName).getSyncPoller(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTriggerResourceGroupEvaluation( + String subscriptionId, String resourceGroupName, Context context) { + return beginTriggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName, context).getSyncPoller(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerResourceGroupEvaluationAsync(String subscriptionId, String resourceGroupName) { + return beginTriggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerResourceGroupEvaluationAsync( + String subscriptionId, String resourceGroupName, Context context) { + return beginTriggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName) { + triggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName).block(); + } + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName, Context context) { + triggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName, context).block(); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policySetDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForPolicySetDefinition( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + authorizationNamespace, + policySetDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policySetDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicySetDefinition( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + authorizationNamespace, + policySetDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicySetDefinitionAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicySetDefinitionSinglePageAsync( + policyStatesResource, + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicySetDefinitionAsync( + PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForPolicySetDefinitionSinglePageAsync( + policyStatesResource, + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicySetDefinitionAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicySetDefinitionSinglePageAsync( + policyStatesResource, + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForPolicySetDefinitionAsync( + policyStatesResource, + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken)); + } + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForPolicySetDefinitionAsync( + policyStatesResource, + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForPolicySetDefinitionWithResponseAsync( + String subscriptionId, + String policySetDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policySetDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForPolicySetDefinition( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + authorizationNamespace, + policySetDefinitionName, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForPolicySetDefinitionWithResponseAsync( + String subscriptionId, + String policySetDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policySetDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForPolicySetDefinition( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + authorizationNamespace, + policySetDefinitionName, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForPolicySetDefinitionAsync( + String subscriptionId, + String policySetDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + return summarizeForPolicySetDefinitionWithResponseAsync( + subscriptionId, policySetDefinitionName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForPolicySetDefinitionAsync( + String subscriptionId, String policySetDefinitionName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForPolicySetDefinitionWithResponseAsync( + subscriptionId, policySetDefinitionName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForPolicySetDefinition( + String subscriptionId, String policySetDefinitionName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForPolicySetDefinitionAsync(subscriptionId, policySetDefinitionName, top, from, to, filter) + .block(); + } + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForPolicySetDefinitionWithResponse( + String subscriptionId, + String policySetDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + return summarizeForPolicySetDefinitionWithResponseAsync( + subscriptionId, policySetDefinitionName, top, from, to, filter, context) + .block(); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForPolicyDefinition( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + authorizationNamespace, + policyDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicyDefinition( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + authorizationNamespace, + policyDefinitionName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicyDefinitionAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicyDefinitionSinglePageAsync( + policyStatesResource, + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicyDefinitionAsync( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForPolicyDefinitionSinglePageAsync( + policyStatesResource, + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForPolicyDefinitionAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForPolicyDefinitionSinglePageAsync( + policyStatesResource, + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForPolicyDefinitionAsync( + policyStatesResource, + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken)); + } + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForPolicyDefinitionAsync( + policyStatesResource, + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForPolicyDefinitionWithResponseAsync( + String subscriptionId, + String policyDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForPolicyDefinition( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + authorizationNamespace, + policyDefinitionName, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForPolicyDefinitionWithResponseAsync( + String subscriptionId, + String policyDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForPolicyDefinition( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + authorizationNamespace, + policyDefinitionName, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForPolicyDefinitionAsync( + String subscriptionId, + String policyDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + return summarizeForPolicyDefinitionWithResponseAsync( + subscriptionId, policyDefinitionName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForPolicyDefinitionAsync( + String subscriptionId, String policyDefinitionName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForPolicyDefinitionWithResponseAsync( + subscriptionId, policyDefinitionName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForPolicyDefinitionAsync(subscriptionId, policyDefinitionName, top, from, to, filter).block(); + } + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForPolicyDefinitionWithResponse( + String subscriptionId, + String policyDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + return summarizeForPolicyDefinitionWithResponseAsync( + subscriptionId, policyDefinitionName, top, from, to, filter, context) + .block(); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForSubscriptionLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscriptionLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + policyStatesResource, + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + policyStatesResource, + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( + policyStatesResource, + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + policyStatesResource, + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken)); + } + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForSubscriptionLevelPolicyAssignmentAsync( + policyStatesResource, + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForSubscriptionLevelPolicyAssignmentWithResponseAsync( + String subscriptionId, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForSubscriptionLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForSubscriptionLevelPolicyAssignmentWithResponseAsync( + String subscriptionId, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForSubscriptionLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForSubscriptionLevelPolicyAssignmentAsync( + String subscriptionId, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + return summarizeForSubscriptionLevelPolicyAssignmentWithResponseAsync( + subscriptionId, policyAssignmentName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForSubscriptionLevelPolicyAssignmentAsync( + String subscriptionId, String policyAssignmentName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForSubscriptionLevelPolicyAssignmentWithResponseAsync( + subscriptionId, policyAssignmentName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForSubscriptionLevelPolicyAssignment( + String subscriptionId, String policyAssignmentName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForSubscriptionLevelPolicyAssignmentAsync( + subscriptionId, policyAssignmentName, top, from, to, filter) + .block(); + } + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForSubscriptionLevelPolicyAssignmentWithResponse( + String subscriptionId, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + return summarizeForSubscriptionLevelPolicyAssignmentWithResponseAsync( + subscriptionId, policyAssignmentName, top, from, to, filter, context) + .block(); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResourceGroupLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + resourceGroupName, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (policyStatesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyStatesResource is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroupLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesResource, + subscriptionId, + resourceGroupName, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken), + nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listQueryResultsForResourceGroupLevelPolicyAssignmentSinglePageAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context), + nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName) { + final Integer top = null; + final String orderBy = null; + final String select = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + final String apply = null; + final String skipToken = null; + return new PagedIterable<>( + listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken)); + } + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + return new PagedIterable<>( + listQueryResultsForResourceGroupLevelPolicyAssignmentAsync( + policyStatesResource, + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context)); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForResourceGroupLevelPolicyAssignmentWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .summarizeForResourceGroupLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + resourceGroupName, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + from, + to, + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> summarizeForResourceGroupLevelPolicyAssignmentWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (policyAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + } + final String policyStatesSummaryResource = "latest"; + final String authorizationNamespace = "Microsoft.Authorization"; + final String apiVersion = "2019-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .summarizeForResourceGroupLevelPolicyAssignment( + this.client.getEndpoint(), + policyStatesSummaryResource, + subscriptionId, + resourceGroupName, + authorizationNamespace, + policyAssignmentName, + apiVersion, + top, + from, + to, + filter, + accept, + context); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForResourceGroupLevelPolicyAssignmentAsync( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter) { + return summarizeForResourceGroupLevelPolicyAssignmentWithResponseAsync( + subscriptionId, resourceGroupName, policyAssignmentName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono summarizeForResourceGroupLevelPolicyAssignmentAsync( + String subscriptionId, String resourceGroupName, String policyAssignmentName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForResourceGroupLevelPolicyAssignmentWithResponseAsync( + subscriptionId, resourceGroupName, policyAssignmentName, top, from, to, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SummarizeResultsInner summarizeForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName) { + final Integer top = null; + final OffsetDateTime from = null; + final OffsetDateTime to = null; + final String filter = null; + return summarizeForResourceGroupLevelPolicyAssignmentAsync( + subscriptionId, resourceGroupName, policyAssignmentName, top, from, to, filter) + .block(); + } + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response summarizeForResourceGroupLevelPolicyAssignmentWithResponse( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + return summarizeForResourceGroupLevelPolicyAssignmentWithResponseAsync( + subscriptionId, resourceGroupName, policyAssignmentName, top, from, to, filter, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( + 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 + .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionNextSinglePageAsync(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.listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupNextSinglePageAsync(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.listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceNextSinglePageAsync(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.listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( + 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 + .listQueryResultsForPolicySetDefinitionNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicySetDefinitionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicySetDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( + 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 + .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForPolicyDefinitionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForPolicyDefinitionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(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 + .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscriptionLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(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 + .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroupLevelPolicyAssignmentNext( + nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesImpl.java new file mode 100644 index 000000000000..793e971d4ed9 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyStatesImpl.java @@ -0,0 +1,637 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.PolicyStatesClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyStateInner; +import com.azure.resourcemanager.policyinsights.fluent.models.SummarizeResultsInner; +import com.azure.resourcemanager.policyinsights.models.PolicyState; +import com.azure.resourcemanager.policyinsights.models.PolicyStates; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; +import com.azure.resourcemanager.policyinsights.models.SummarizeResults; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +public final class PolicyStatesImpl implements PolicyStates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyStatesImpl.class); + + private final PolicyStatesClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public PolicyStatesImpl(PolicyStatesClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, String managementGroupName) { + PagedIterable inner = + this.serviceClient().listQueryResultsForManagementGroup(policyStatesResource, managementGroupName); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForManagementGroup( + policyStatesResource, + managementGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForManagementGroup(String managementGroupName) { + SummarizeResultsInner inner = this.serviceClient().summarizeForManagementGroup(managementGroupName); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForManagementGroupWithResponse( + String managementGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + Response inner = + this + .serviceClient() + .summarizeForManagementGroupWithResponse(managementGroupName, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, String subscriptionId) { + PagedIterable inner = + this.serviceClient().listQueryResultsForSubscription(policyStatesResource, subscriptionId); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForSubscription( + policyStatesResource, + subscriptionId, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForSubscription(String subscriptionId) { + SummarizeResultsInner inner = this.serviceClient().summarizeForSubscription(subscriptionId); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForSubscriptionWithResponse( + String subscriptionId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context) { + Response inner = + this.serviceClient().summarizeForSubscriptionWithResponse(subscriptionId, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResourceGroup(policyStatesResource, subscriptionId, resourceGroupName); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResourceGroup( + policyStatesResource, + subscriptionId, + resourceGroupName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForResourceGroup(String subscriptionId, String resourceGroupName) { + SummarizeResultsInner inner = this.serviceClient().summarizeForResourceGroup(subscriptionId, resourceGroupName); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForResourceGroupWithResponse( + String subscriptionId, + String resourceGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + Response inner = + this + .serviceClient() + .summarizeForResourceGroupWithResponse( + subscriptionId, resourceGroupName, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, String resourceId) { + PagedIterable inner = + this.serviceClient().listQueryResultsForResource(policyStatesResource, resourceId); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResource( + policyStatesResource, + resourceId, + top, + orderBy, + select, + from, + to, + filter, + apply, + expand, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForResource(String resourceId) { + SummarizeResultsInner inner = this.serviceClient().summarizeForResource(resourceId); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForResourceWithResponse( + String resourceId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context) { + Response inner = + this.serviceClient().summarizeForResourceWithResponse(resourceId, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void triggerSubscriptionEvaluation(String subscriptionId) { + this.serviceClient().triggerSubscriptionEvaluation(subscriptionId); + } + + public void triggerSubscriptionEvaluation(String subscriptionId, Context context) { + this.serviceClient().triggerSubscriptionEvaluation(subscriptionId, context); + } + + public void triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName) { + this.serviceClient().triggerResourceGroupEvaluation(subscriptionId, resourceGroupName); + } + + public void triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName, Context context) { + this.serviceClient().triggerResourceGroupEvaluation(subscriptionId, resourceGroupName, context); + } + + public PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForPolicySetDefinition(policyStatesResource, subscriptionId, policySetDefinitionName); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForPolicySetDefinition( + policyStatesResource, + subscriptionId, + policySetDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { + SummarizeResultsInner inner = + this.serviceClient().summarizeForPolicySetDefinition(subscriptionId, policySetDefinitionName); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForPolicySetDefinitionWithResponse( + String subscriptionId, + String policySetDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + Response inner = + this + .serviceClient() + .summarizeForPolicySetDefinitionWithResponse( + subscriptionId, policySetDefinitionName, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForPolicyDefinition(policyStatesResource, subscriptionId, policyDefinitionName); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForPolicyDefinition( + policyStatesResource, + subscriptionId, + policyDefinitionName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName) { + SummarizeResultsInner inner = + this.serviceClient().summarizeForPolicyDefinition(subscriptionId, policyDefinitionName); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForPolicyDefinitionWithResponse( + String subscriptionId, + String policyDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + Response inner = + this + .serviceClient() + .summarizeForPolicyDefinitionWithResponse( + subscriptionId, policyDefinitionName, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + policyStatesResource, subscriptionId, policyAssignmentName); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + policyStatesResource, + subscriptionId, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForSubscriptionLevelPolicyAssignment( + String subscriptionId, String policyAssignmentName) { + SummarizeResultsInner inner = + this.serviceClient().summarizeForSubscriptionLevelPolicyAssignment(subscriptionId, policyAssignmentName); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForSubscriptionLevelPolicyAssignmentWithResponse( + String subscriptionId, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + Response inner = + this + .serviceClient() + .summarizeForSubscriptionLevelPolicyAssignmentWithResponse( + subscriptionId, policyAssignmentName, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + policyStatesResource, + subscriptionId, + resourceGroupName, + policyAssignmentName, + top, + orderBy, + select, + from, + to, + filter, + apply, + skipToken, + context); + return inner.mapPage(inner1 -> new PolicyStateImpl(inner1, this.manager())); + } + + public SummarizeResults summarizeForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName) { + SummarizeResultsInner inner = + this + .serviceClient() + .summarizeForResourceGroupLevelPolicyAssignment( + subscriptionId, resourceGroupName, policyAssignmentName); + if (inner != null) { + return new SummarizeResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response summarizeForResourceGroupLevelPolicyAssignmentWithResponse( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context) { + Response inner = + this + .serviceClient() + .summarizeForResourceGroupLevelPolicyAssignmentWithResponse( + subscriptionId, resourceGroupName, policyAssignmentName, top, from, to, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SummarizeResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PolicyStatesClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourceImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourceImpl.java new file mode 100644 index 000000000000..2e4013b68b92 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourceImpl.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.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyTrackedResourceInner; +import com.azure.resourcemanager.policyinsights.models.PolicyDetails; +import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResource; +import com.azure.resourcemanager.policyinsights.models.TrackedResourceModificationDetails; +import java.time.OffsetDateTime; + +public final class PolicyTrackedResourceImpl implements PolicyTrackedResource { + private PolicyTrackedResourceInner innerObject; + + private final PolicyInsightsManager serviceManager; + + PolicyTrackedResourceImpl(PolicyTrackedResourceInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String trackedResourceId() { + return this.innerModel().trackedResourceId(); + } + + public PolicyDetails policyDetails() { + return this.innerModel().policyDetails(); + } + + public TrackedResourceModificationDetails createdBy() { + return this.innerModel().createdBy(); + } + + public TrackedResourceModificationDetails lastModifiedBy() { + return this.innerModel().lastModifiedBy(); + } + + public OffsetDateTime lastUpdateUtc() { + return this.innerModel().lastUpdateUtc(); + } + + public PolicyTrackedResourceInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesClientImpl.java new file mode 100644 index 000000000000..cfa894f40e78 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesClientImpl.java @@ -0,0 +1,1253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.PolicyTrackedResourcesClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyTrackedResourceInner; +import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResourcesQueryResults; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PolicyTrackedResourcesClient. */ +public final class PolicyTrackedResourcesClientImpl implements PolicyTrackedResourcesClient { + private final ClientLogger logger = new ClientLogger(PolicyTrackedResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PolicyTrackedResourcesService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of PolicyTrackedResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PolicyTrackedResourcesClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy + .create(PolicyTrackedResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientPolicyTrackedResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface PolicyTrackedResourcesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers" + + "/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupName") String managementGroupName, + @PathParam("policyTrackedResourcesResource") String policyTrackedResourcesResource, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources" + + "/{policyTrackedResourcesResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForSubscription( + @HostParam("$host") String endpoint, + @PathParam("policyTrackedResourcesResource") String policyTrackedResourcesResource, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/policyTrackedResources/{policyTrackedResourcesResource}/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("policyTrackedResourcesResource") String policyTrackedResourcesResource, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}" + + "/queryResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("policyTrackedResourcesResource") String policyTrackedResourcesResource, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listQueryResultsForManagementGroupNext( + @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> listQueryResultsForSubscriptionNext( + @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> listQueryResultsForResourceGroupNext( + @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> listQueryResultsForResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupSinglePageAsync( + String managementGroupName, Integer top, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupName, + policyTrackedResourcesResource, + top, + filter, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupSinglePageAsync( + String managementGroupName, Integer top, 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 (managementGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupName, + policyTrackedResourcesResource, + top, + filter, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync( + String managementGroupName, Integer top, String filter) { + return new PagedFlux<>( + () -> listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, top, filter), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync(String managementGroupName) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, top, filter), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForManagementGroupAsync( + String managementGroupName, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listQueryResultsForManagementGroupSinglePageAsync(managementGroupName, top, filter, context), + nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForManagementGroup(String managementGroupName) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listQueryResultsForManagementGroupAsync(managementGroupName, top, filter)); + } + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, Integer top, String filter, Context context) { + return new PagedIterable<>(listQueryResultsForManagementGroupAsync(managementGroupName, top, filter, context)); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionSinglePageAsync( + Integer top, 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 policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForSubscription( + this.client.getEndpoint(), + policyTrackedResourcesResource, + top, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionSinglePageAsync( + Integer top, 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 policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscription( + this.client.getEndpoint(), + policyTrackedResourcesResource, + top, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync(Integer top, String filter) { + return new PagedFlux<>( + () -> listQueryResultsForSubscriptionSinglePageAsync(top, filter), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync() { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listQueryResultsForSubscriptionSinglePageAsync(top, filter), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForSubscriptionAsync( + Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listQueryResultsForSubscriptionSinglePageAsync(top, filter, context), + nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy tracked resources under 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscription() { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listQueryResultsForSubscriptionAsync(top, filter)); + } + + /** + * Queries policy tracked resources under the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForSubscription( + Integer top, String filter, Context context) { + return new PagedIterable<>(listQueryResultsForSubscriptionAsync(top, filter, context)); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required 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 policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + policyTrackedResourcesResource, + top, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required 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 policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + policyTrackedResourcesResource, + top, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + String resourceGroupName, Integer top, String filter) { + return new PagedFlux<>( + () -> listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, top, filter), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, top, filter), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceGroupAsync( + String resourceGroupName, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listQueryResultsForResourceGroupSinglePageAsync(resourceGroupName, top, filter, context), + nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroup(String resourceGroupName) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listQueryResultsForResourceGroupAsync(resourceGroupName, top, filter)); + } + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResourceGroup( + String resourceGroupName, Integer top, String filter, Context context) { + return new PagedIterable<>(listQueryResultsForResourceGroupAsync(resourceGroupName, top, filter, context)); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceSinglePageAsync( + String resourceId, Integer top, String filter) { + 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 policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listQueryResultsForResource( + this.client.getEndpoint(), + resourceId, + policyTrackedResourcesResource, + top, + filter, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceSinglePageAsync( + String resourceId, Integer top, 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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String policyTrackedResourcesResource = "default"; + final String apiVersion = "2018-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResource( + this.client.getEndpoint(), + resourceId, + policyTrackedResourcesResource, + top, + filter, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync( + String resourceId, Integer top, String filter) { + return new PagedFlux<>( + () -> listQueryResultsForResourceSinglePageAsync(resourceId, top, filter), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync(String resourceId) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listQueryResultsForResourceSinglePageAsync(resourceId, top, filter), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listQueryResultsForResourceAsync( + String resourceId, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listQueryResultsForResourceSinglePageAsync(resourceId, top, filter, context), + nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource 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 query results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResource(String resourceId) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listQueryResultsForResourceAsync(resourceId, top, filter)); + } + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listQueryResultsForResource( + String resourceId, Integer top, String filter, Context context) { + return new PagedIterable<>(listQueryResultsForResourceAsync(resourceId, top, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( + 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 + .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForManagementGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionNextSinglePageAsync( + 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.listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupNextSinglePageAsync( + 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.listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceNextSinglePageAsync( + 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.listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listQueryResultsForResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listQueryResultsForResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesImpl.java new file mode 100644 index 000000000000..085933870455 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/PolicyTrackedResourcesImpl.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.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.PolicyTrackedResourcesClient; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyTrackedResourceInner; +import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResource; +import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PolicyTrackedResourcesImpl implements PolicyTrackedResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyTrackedResourcesImpl.class); + + private final PolicyTrackedResourcesClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public PolicyTrackedResourcesImpl(PolicyTrackedResourcesClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listQueryResultsForManagementGroup(String managementGroupName) { + PagedIterable inner = + this.serviceClient().listQueryResultsForManagementGroup(managementGroupName); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, Integer top, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listQueryResultsForManagementGroup(managementGroupName, top, filter, context); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscription() { + PagedIterable inner = this.serviceClient().listQueryResultsForSubscription(); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForSubscription( + Integer top, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listQueryResultsForSubscription(top, filter, context); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listQueryResultsForResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResourceGroup( + String resourceGroupName, Integer top, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listQueryResultsForResourceGroup(resourceGroupName, top, filter, context); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResource(String resourceId) { + PagedIterable inner = this.serviceClient().listQueryResultsForResource(resourceId); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listQueryResultsForResource( + String resourceId, Integer top, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listQueryResultsForResource(resourceId, top, filter, context); + return inner.mapPage(inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager())); + } + + private PolicyTrackedResourcesClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationDeploymentImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationDeploymentImpl.java new file mode 100644 index 000000000000..bb0e9b9a5c71 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationDeploymentImpl.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.policyinsights.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationDeploymentInner; +import com.azure.resourcemanager.policyinsights.models.RemediationDeployment; +import java.time.OffsetDateTime; + +public final class RemediationDeploymentImpl implements RemediationDeployment { + private RemediationDeploymentInner innerObject; + + private final PolicyInsightsManager serviceManager; + + RemediationDeploymentImpl(RemediationDeploymentInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String remediatedResourceId() { + return this.innerModel().remediatedResourceId(); + } + + public String deploymentId() { + return this.innerModel().deploymentId(); + } + + public String status() { + return this.innerModel().status(); + } + + public String resourceLocation() { + return this.innerModel().resourceLocation(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public OffsetDateTime createdOn() { + return this.innerModel().createdOn(); + } + + public OffsetDateTime lastUpdatedOn() { + return this.innerModel().lastUpdatedOn(); + } + + public RemediationDeploymentInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.java new file mode 100644 index 000000000000..57bfc9a11927 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationImpl.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.policyinsights.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; +import com.azure.resourcemanager.policyinsights.models.Remediation; +import com.azure.resourcemanager.policyinsights.models.RemediationDeploymentSummary; +import com.azure.resourcemanager.policyinsights.models.RemediationFilters; +import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode; +import java.time.OffsetDateTime; + +public final class RemediationImpl implements Remediation, Remediation.Definition, Remediation.Update { + private RemediationInner innerObject; + + private final PolicyInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String policyAssignmentId() { + return this.innerModel().policyAssignmentId(); + } + + public String policyDefinitionReferenceId() { + return this.innerModel().policyDefinitionReferenceId(); + } + + public ResourceDiscoveryMode resourceDiscoveryMode() { + return this.innerModel().resourceDiscoveryMode(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime createdOn() { + return this.innerModel().createdOn(); + } + + public OffsetDateTime lastUpdatedOn() { + return this.innerModel().lastUpdatedOn(); + } + + public RemediationFilters filters() { + return this.innerModel().filters(); + } + + public RemediationDeploymentSummary deploymentStatus() { + return this.innerModel().deploymentStatus(); + } + + public RemediationInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String remediationName; + + public RemediationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Remediation create() { + this.innerObject = + serviceManager + .serviceClient() + .getRemediations() + .createOrUpdateAtResourceGroupWithResponse( + resourceGroupName, remediationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Remediation create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRemediations() + .createOrUpdateAtResourceGroupWithResponse( + resourceGroupName, remediationName, this.innerModel(), context) + .getValue(); + return this; + } + + RemediationImpl(String name, PolicyInsightsManager serviceManager) { + this.innerObject = new RemediationInner(); + this.serviceManager = serviceManager; + this.remediationName = name; + } + + public RemediationImpl update() { + return this; + } + + public Remediation apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRemediations() + .createOrUpdateAtResourceGroupWithResponse( + resourceGroupName, remediationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Remediation apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRemediations() + .createOrUpdateAtResourceGroupWithResponse( + resourceGroupName, remediationName, this.innerModel(), context) + .getValue(); + return this; + } + + RemediationImpl(RemediationInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.remediationName = Utils.getValueFromIdByName(innerObject.id(), "remediations"); + } + + public Remediation refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRemediations() + .getByResourceGroupWithResponse(resourceGroupName, remediationName, Context.NONE) + .getValue(); + return this; + } + + public Remediation refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRemediations() + .getByResourceGroupWithResponse(resourceGroupName, remediationName, context) + .getValue(); + return this; + } + + public RemediationImpl withPolicyAssignmentId(String policyAssignmentId) { + this.innerModel().withPolicyAssignmentId(policyAssignmentId); + return this; + } + + public RemediationImpl withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.innerModel().withPolicyDefinitionReferenceId(policyDefinitionReferenceId); + return this; + } + + public RemediationImpl withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode) { + this.innerModel().withResourceDiscoveryMode(resourceDiscoveryMode); + return this; + } + + public RemediationImpl withFilters(RemediationFilters filters) { + this.innerModel().withFilters(filters); + return this; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java new file mode 100644 index 000000000000..6ed99500ce52 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsClientImpl.java @@ -0,0 +1,4925 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.RemediationsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationDeploymentInner; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; +import com.azure.resourcemanager.policyinsights.models.RemediationDeploymentsListResult; +import com.azure.resourcemanager.policyinsights.models.RemediationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RemediationsClient. */ +public final class RemediationsClientImpl implements RemediationsClient { + private final ClientLogger logger = new ClientLogger(RemediationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RemediationsService service; + + /** The service client containing this operation class. */ + private final PolicyInsightsClientImpl client; + + /** + * Initializes an instance of RemediationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RemediationsClientImpl(PolicyInsightsClientImpl client) { + this.service = + RestProxy.create(RemediationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PolicyInsightsClientRemediations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PolicyInsightsClient") + private interface RemediationsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers" + + "/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeploymentsAtManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("remediationName") String remediationName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers" + + "/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers" + + "/Microsoft.PolicyInsights/remediations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupId") String managementGroupId, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers" + + "/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateAtManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RemediationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers" + + "/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers" + + "/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteAtManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("managementGroupsNamespace") String managementGroupsNamespace, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}" + + "/listDeployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeploymentsAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("remediationName") String remediationName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RemediationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteAtSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/remediations/{remediationName}/listDeployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeploymentsAtResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("remediationName") String remediationName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/remediations/{remediationName}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/remediations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/remediations/{remediationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateAtResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RemediationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/remediations/{remediationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights" + + "/remediations/{remediationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeploymentsAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("remediationName") String remediationName, + @QueryParam("$top") Integer top, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.PolicyInsights/remediations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @QueryParam("$top") Integer top, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RemediationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteAtResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("remediationName") String remediationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeploymentsAtManagementGroupNext( + @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> listForManagementGroupNext( + @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> listDeploymentsAtSubscriptionNext( + @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> listForSubscriptionNext( + @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> listDeploymentsAtResourceGroupNext( + @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> listForResourceGroupNext( + @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> listDeploymentsAtResourceNext( + @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> listForResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtManagementGroupSinglePageAsync( + String managementGroupId, String remediationName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDeploymentsAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + top, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtManagementGroupSinglePageAsync( + String managementGroupId, String remediationName, 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 (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + top, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtManagementGroupAsync( + String managementGroupId, String remediationName, Integer top) { + return new PagedFlux<>( + () -> listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, top), + nextLink -> listDeploymentsAtManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtManagementGroupAsync( + String managementGroupId, String remediationName) { + final Integer top = null; + return new PagedFlux<>( + () -> listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, top), + nextLink -> listDeploymentsAtManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtManagementGroupAsync( + String managementGroupId, String remediationName, Integer top, Context context) { + return new PagedFlux<>( + () -> listDeploymentsAtManagementGroupSinglePageAsync(managementGroupId, remediationName, top, context), + nextLink -> listDeploymentsAtManagementGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName) { + final Integer top = null; + return new PagedIterable<>(listDeploymentsAtManagementGroupAsync(managementGroupId, remediationName, top)); + } + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName, Integer top, Context context) { + return new PagedIterable<>( + listDeploymentsAtManagementGroupAsync(managementGroupId, remediationName, top, context)); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancelAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancelAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + accept, + context); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtManagementGroupAsync(String managementGroupId, String remediationName) { + return cancelAtManagementGroupWithResponseAsync(managementGroupId, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner cancelAtManagementGroup(String managementGroupId, String remediationName) { + return cancelAtManagementGroupAsync(managementGroupId, remediationName).block(); + } + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context) { + return cancelAtManagementGroupWithResponseAsync(managementGroupId, remediationName, context).block(); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForManagementGroupSinglePageAsync( + String managementGroupId, Integer top, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listForManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + top, + filter, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForManagementGroupSinglePageAsync( + String managementGroupId, Integer top, 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 (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + top, + filter, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForManagementGroupAsync( + String managementGroupId, Integer top, String filter) { + return new PagedFlux<>( + () -> listForManagementGroupSinglePageAsync(managementGroupId, top, filter), + nextLink -> listForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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 all remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForManagementGroupAsync(String managementGroupId) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listForManagementGroupSinglePageAsync(managementGroupId, top, filter), + nextLink -> listForManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForManagementGroupAsync( + String managementGroupId, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listForManagementGroupSinglePageAsync(managementGroupId, top, filter, context), + nextLink -> listForManagementGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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 all remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForManagementGroup(String managementGroupId) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listForManagementGroupAsync(managementGroupId, top, filter)); + } + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForManagementGroup( + String managementGroupId, Integer top, String filter, Context context) { + return new PagedIterable<>(listForManagementGroupAsync(managementGroupId, top, filter, context)); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName, RemediationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdateAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName, RemediationInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdateAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtManagementGroupAsync( + String managementGroupId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtManagementGroupWithResponseAsync(managementGroupId, remediationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner createOrUpdateAtManagementGroup( + String managementGroupId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtManagementGroupAsync(managementGroupId, remediationName, parameters).block(); + } + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAtManagementGroupWithResponse( + String managementGroupId, String remediationName, RemediationInner parameters, Context context) { + return createOrUpdateAtManagementGroupWithResponseAsync(managementGroupId, remediationName, parameters, context) + .block(); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + accept, + context); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtManagementGroupAsync(String managementGroupId, String remediationName) { + return getAtManagementGroupWithResponseAsync(managementGroupId, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner getAtManagementGroup(String managementGroupId, String remediationName) { + return getAtManagementGroupAsync(managementGroupId, remediationName).block(); + } + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at management group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context) { + return getAtManagementGroupWithResponseAsync(managementGroupId, remediationName, context).block(); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtManagementGroupWithResponseAsync( + String managementGroupId, String remediationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String managementGroupsNamespace = "Microsoft.Management"; + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtManagementGroup( + this.client.getEndpoint(), + managementGroupsNamespace, + managementGroupId, + remediationName, + apiVersion, + accept, + context); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtManagementGroupAsync(String managementGroupId, String remediationName) { + return deleteAtManagementGroupWithResponseAsync(managementGroupId, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner deleteAtManagementGroup(String managementGroupId, String remediationName) { + return deleteAtManagementGroupAsync(managementGroupId, remediationName).block(); + } + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context) { + return deleteAtManagementGroupWithResponseAsync(managementGroupId, remediationName, context).block(); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtSubscriptionSinglePageAsync( + String remediationName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDeploymentsAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + top, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtSubscriptionSinglePageAsync( + String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + top, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtSubscriptionAsync( + String remediationName, Integer top) { + return new PagedFlux<>( + () -> listDeploymentsAtSubscriptionSinglePageAsync(remediationName, top), + nextLink -> listDeploymentsAtSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtSubscriptionAsync(String remediationName) { + final Integer top = null; + return new PagedFlux<>( + () -> listDeploymentsAtSubscriptionSinglePageAsync(remediationName, top), + nextLink -> listDeploymentsAtSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtSubscriptionAsync( + String remediationName, Integer top, Context context) { + return new PagedFlux<>( + () -> listDeploymentsAtSubscriptionSinglePageAsync(remediationName, top, context), + nextLink -> listDeploymentsAtSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtSubscription(String remediationName) { + final Integer top = null; + return new PagedIterable<>(listDeploymentsAtSubscriptionAsync(remediationName, top)); + } + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtSubscription( + String remediationName, Integer top, Context context) { + return new PagedIterable<>(listDeploymentsAtSubscriptionAsync(remediationName, top, context)); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtSubscriptionWithResponseAsync(String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancelAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtSubscriptionWithResponseAsync( + String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancelAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + accept, + context); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtSubscriptionAsync(String remediationName) { + return cancelAtSubscriptionWithResponseAsync(remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner cancelAtSubscription(String remediationName) { + return cancelAtSubscriptionAsync(remediationName).block(); + } + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtSubscriptionWithResponse(String remediationName, Context context) { + return cancelAtSubscriptionWithResponseAsync(remediationName, context).block(); + } + + /** + * Gets all remediations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + top, + filter, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all remediations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), top, filter, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all remediations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, filter), nextLink -> listForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations 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 all remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(top, filter), nextLink -> listForSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, filter, context), + nextLink -> listForSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all remediations 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 all remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listAsync(top, filter)); + } + + /** + * Gets all remediations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, String filter, Context context) { + return new PagedIterable<>(listAsync(top, filter, context)); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtSubscriptionWithResponseAsync( + String remediationName, RemediationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdateAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtSubscriptionWithResponseAsync( + String remediationName, RemediationInner parameters, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdateAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtSubscriptionAsync( + String remediationName, RemediationInner parameters) { + return createOrUpdateAtSubscriptionWithResponseAsync(remediationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner createOrUpdateAtSubscription(String remediationName, RemediationInner parameters) { + return createOrUpdateAtSubscriptionAsync(remediationName, parameters).block(); + } + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAtSubscriptionWithResponse( + String remediationName, RemediationInner parameters, Context context) { + return createOrUpdateAtSubscriptionWithResponseAsync(remediationName, parameters, context).block(); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionWithResponseAsync(String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtSubscriptionWithResponseAsync( + String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + accept, + context); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtSubscriptionAsync(String remediationName) { + return getAtSubscriptionWithResponseAsync(remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner getAtSubscription(String remediationName) { + return getAtSubscriptionAsync(remediationName).block(); + } + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at subscription scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtSubscriptionWithResponse(String remediationName, Context context) { + return getAtSubscriptionWithResponseAsync(remediationName, context).block(); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtSubscriptionWithResponseAsync(String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtSubscriptionWithResponseAsync( + String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + remediationName, + apiVersion, + accept, + context); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtSubscriptionAsync(String remediationName) { + return deleteAtSubscriptionWithResponseAsync(remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner deleteAtSubscription(String remediationName) { + return deleteAtSubscriptionAsync(remediationName).block(); + } + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAtSubscriptionWithResponse(String remediationName, Context context) { + return deleteAtSubscriptionWithResponseAsync(remediationName, context).block(); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceGroupSinglePageAsync( + String resourceGroupName, String remediationName, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDeploymentsAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + top, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceGroupSinglePageAsync( + String resourceGroupName, String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + top, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtResourceGroupAsync( + String resourceGroupName, String remediationName, Integer top) { + return new PagedFlux<>( + () -> listDeploymentsAtResourceGroupSinglePageAsync(resourceGroupName, remediationName, top), + nextLink -> listDeploymentsAtResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtResourceGroupAsync( + String resourceGroupName, String remediationName) { + final Integer top = null; + return new PagedFlux<>( + () -> listDeploymentsAtResourceGroupSinglePageAsync(resourceGroupName, remediationName, top), + nextLink -> listDeploymentsAtResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtResourceGroupAsync( + String resourceGroupName, String remediationName, Integer top, Context context) { + return new PagedFlux<>( + () -> listDeploymentsAtResourceGroupSinglePageAsync(resourceGroupName, remediationName, top, context), + nextLink -> listDeploymentsAtResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName) { + final Integer top = null; + return new PagedIterable<>(listDeploymentsAtResourceGroupAsync(resourceGroupName, remediationName, top)); + } + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName, Integer top, Context context) { + return new PagedIterable<>( + listDeploymentsAtResourceGroupAsync(resourceGroupName, remediationName, top, context)); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtResourceGroupWithResponseAsync( + String resourceGroupName, String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancelAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtResourceGroupWithResponseAsync( + String resourceGroupName, String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancelAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + accept, + context); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtResourceGroupAsync(String resourceGroupName, String remediationName) { + return cancelAtResourceGroupWithResponseAsync(resourceGroupName, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner cancelAtResourceGroup(String resourceGroupName, String remediationName) { + return cancelAtResourceGroupAsync(resourceGroupName, remediationName).block(); + } + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context) { + return cancelAtResourceGroupWithResponseAsync(resourceGroupName, remediationName, context).block(); + } + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + filter, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + filter, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, filter), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group 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 all remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, filter), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, filter, context), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group 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 all remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, filter)); + } + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, filter, context)); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtResourceGroupWithResponseAsync( + String resourceGroupName, String remediationName, RemediationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdateAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtResourceGroupWithResponseAsync( + String resourceGroupName, String remediationName, RemediationInner parameters, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdateAtResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtResourceGroupAsync( + String resourceGroupName, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceGroupWithResponseAsync(resourceGroupName, remediationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner createOrUpdateAtResourceGroup( + String resourceGroupName, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceGroupAsync(resourceGroupName, remediationName, parameters).block(); + } + + /** + * Creates or updates a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAtResourceGroupWithResponse( + String resourceGroupName, String remediationName, RemediationInner parameters, Context context) { + return createOrUpdateAtResourceGroupWithResponseAsync(resourceGroupName, remediationName, parameters, context) + .block(); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + accept, + context); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String remediationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner getByResourceGroup(String resourceGroupName, String remediationName) { + return getByResourceGroupAsync(resourceGroupName, remediationName).block(); + } + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, remediationName, context).block(); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String remediationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + remediationName, + apiVersion, + accept, + context); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String remediationName) { + return deleteWithResponseAsync(resourceGroupName, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner delete(String resourceGroupName, String remediationName) { + return deleteAsync(resourceGroupName, remediationName).block(); + } + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String remediationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, remediationName, context).block(); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceSinglePageAsync( + String resourceId, String remediationName, Integer top) { + 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDeploymentsAtResource( + this.client.getEndpoint(), resourceId, remediationName, top, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceSinglePageAsync( + String resourceId, String remediationName, 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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtResource( + this.client.getEndpoint(), resourceId, remediationName, top, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtResourceAsync( + String resourceId, String remediationName, Integer top) { + return new PagedFlux<>( + () -> listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, top), + nextLink -> listDeploymentsAtResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtResourceAsync( + String resourceId, String remediationName) { + final Integer top = null; + return new PagedFlux<>( + () -> listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, top), + nextLink -> listDeploymentsAtResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAtResourceAsync( + String resourceId, String remediationName, Integer top, Context context) { + return new PagedFlux<>( + () -> listDeploymentsAtResourceSinglePageAsync(resourceId, remediationName, top, context), + nextLink -> listDeploymentsAtResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtResource( + String resourceId, String remediationName) { + final Integer top = null; + return new PagedIterable<>(listDeploymentsAtResourceAsync(resourceId, remediationName, top)); + } + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 deployments for a remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeploymentsAtResource( + String resourceId, String remediationName, Integer top, Context context) { + return new PagedIterable<>(listDeploymentsAtResourceAsync(resourceId, remediationName, top, context)); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtResourceWithResponseAsync( + String resourceId, String remediationName) { + 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancelAtResource( + this.client.getEndpoint(), resourceId, remediationName, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelAtResourceWithResponseAsync( + String resourceId, String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancelAtResource(this.client.getEndpoint(), resourceId, remediationName, apiVersion, accept, context); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAtResourceAsync(String resourceId, String remediationName) { + return cancelAtResourceWithResponseAsync(resourceId, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner cancelAtResource(String resourceId, String remediationName) { + return cancelAtResourceAsync(resourceId, remediationName).block(); + } + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAtResourceWithResponse( + String resourceId, String remediationName, Context context) { + return cancelAtResourceWithResponseAsync(resourceId, remediationName, context).block(); + } + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceSinglePageAsync( + String resourceId, Integer top, String filter) { + 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-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listForResource( + this.client.getEndpoint(), resourceId, top, filter, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceSinglePageAsync( + String resourceId, Integer top, 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 (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResource(this.client.getEndpoint(), resourceId, top, filter, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync(String resourceId, Integer top, String filter) { + return new PagedFlux<>( + () -> listForResourceSinglePageAsync(resourceId, top, filter), + nextLink -> listForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource 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 all remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync(String resourceId) { + final Integer top = null; + final String filter = null; + return new PagedFlux<>( + () -> listForResourceSinglePageAsync(resourceId, top, filter), + nextLink -> listForResourceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync( + String resourceId, Integer top, String filter, Context context) { + return new PagedFlux<>( + () -> listForResourceSinglePageAsync(resourceId, top, filter, context), + nextLink -> listForResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource 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 all remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForResource(String resourceId) { + final Integer top = null; + final String filter = null; + return new PagedIterable<>(listForResourceAsync(resourceId, top, filter)); + } + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 remediations for a resource. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForResource( + String resourceId, Integer top, String filter, Context context) { + return new PagedIterable<>(listForResourceAsync(resourceId, top, filter, context)); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtResourceWithResponseAsync( + String resourceId, String remediationName, RemediationInner parameters) { + 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdateAtResource( + this.client.getEndpoint(), + resourceId, + remediationName, + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateAtResourceWithResponseAsync( + String resourceId, String remediationName, RemediationInner parameters, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdateAtResource( + this.client.getEndpoint(), resourceId, remediationName, apiVersion, parameters, accept, context); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAtResourceAsync( + String resourceId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceWithResponseAsync(resourceId, remediationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner createOrUpdateAtResource( + String resourceId, String remediationName, RemediationInner parameters) { + return createOrUpdateAtResourceAsync(resourceId, remediationName, parameters).block(); + } + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAtResourceWithResponse( + String resourceId, String remediationName, RemediationInner parameters, Context context) { + return createOrUpdateAtResourceWithResponseAsync(resourceId, remediationName, parameters, context).block(); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtResourceWithResponseAsync(String resourceId, String remediationName) { + 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAtResource( + this.client.getEndpoint(), resourceId, remediationName, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAtResourceWithResponseAsync( + String resourceId, String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAtResource(this.client.getEndpoint(), resourceId, remediationName, apiVersion, accept, context); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAtResourceAsync(String resourceId, String remediationName) { + return getAtResourceWithResponseAsync(resourceId, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner getAtResource(String resourceId, String remediationName) { + return getAtResourceAsync(resourceId, remediationName).block(); + } + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 existing remediation at resource scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAtResourceWithResponse( + String resourceId, String remediationName, Context context) { + return getAtResourceWithResponseAsync(resourceId, remediationName, context).block(); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtResourceWithResponseAsync( + String resourceId, String remediationName) { + 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAtResource( + this.client.getEndpoint(), resourceId, remediationName, apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteAtResourceWithResponseAsync( + String resourceId, String remediationName, 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 (remediationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); + } + final String apiVersion = "2019-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAtResource(this.client.getEndpoint(), resourceId, remediationName, apiVersion, accept, context); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAtResourceAsync(String resourceId, String remediationName) { + return deleteAtResourceWithResponseAsync(resourceId, remediationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RemediationInner deleteAtResource(String resourceId, String remediationName) { + return deleteAtResourceAsync(resourceId, remediationName).block(); + } + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAtResourceWithResponse( + String resourceId, String remediationName, Context context) { + return deleteAtResourceWithResponseAsync(resourceId, remediationName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtManagementGroupNextSinglePageAsync( + 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.listDeploymentsAtManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtManagementGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForManagementGroupNextSinglePageAsync(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.listForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForManagementGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtSubscriptionNextSinglePageAsync( + 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.listDeploymentsAtSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForSubscriptionNextSinglePageAsync(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.listForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceGroupNextSinglePageAsync( + 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.listDeploymentsAtResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceGroupNextSinglePageAsync(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.listForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceNextSinglePageAsync( + 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.listDeploymentsAtResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of deployments for a remediation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsAtResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsAtResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceNextSinglePageAsync(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.listForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of remediations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsImpl.java new file mode 100644 index 000000000000..a4a2325a1f49 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/RemediationsImpl.java @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.RemediationsClient; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationDeploymentInner; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; +import com.azure.resourcemanager.policyinsights.models.Remediation; +import com.azure.resourcemanager.policyinsights.models.RemediationDeployment; +import com.azure.resourcemanager.policyinsights.models.Remediations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RemediationsImpl implements Remediations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationsImpl.class); + + private final RemediationsClient innerClient; + + private final PolicyInsightsManager serviceManager; + + public RemediationsImpl(RemediationsClient innerClient, PolicyInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtManagementGroup(managementGroupId, remediationName); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtManagementGroup(managementGroupId, remediationName, top, context); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public Remediation cancelAtManagementGroup(String managementGroupId, String remediationName) { + RemediationInner inner = this.serviceClient().cancelAtManagementGroup(managementGroupId, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context) { + Response inner = + this.serviceClient().cancelAtManagementGroupWithResponse(managementGroupId, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listForManagementGroup(String managementGroupId) { + PagedIterable inner = this.serviceClient().listForManagementGroup(managementGroupId); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public PagedIterable listForManagementGroup( + String managementGroupId, Integer top, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listForManagementGroup(managementGroupId, top, filter, context); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public Remediation createOrUpdateAtManagementGroup( + String managementGroupId, String remediationName, RemediationInner parameters) { + RemediationInner inner = + this.serviceClient().createOrUpdateAtManagementGroup(managementGroupId, remediationName, parameters); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateAtManagementGroupWithResponse( + String managementGroupId, String remediationName, RemediationInner parameters, Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateAtManagementGroupWithResponse(managementGroupId, remediationName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation getAtManagementGroup(String managementGroupId, String remediationName) { + RemediationInner inner = this.serviceClient().getAtManagementGroup(managementGroupId, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context) { + Response inner = + this.serviceClient().getAtManagementGroupWithResponse(managementGroupId, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation deleteAtManagementGroup(String managementGroupId, String remediationName) { + RemediationInner inner = this.serviceClient().deleteAtManagementGroup(managementGroupId, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context) { + Response inner = + this.serviceClient().deleteAtManagementGroupWithResponse(managementGroupId, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listDeploymentsAtSubscription(String remediationName) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtSubscription(remediationName); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listDeploymentsAtSubscription( + String remediationName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtSubscription(remediationName, top, context); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public Remediation cancelAtSubscription(String remediationName) { + RemediationInner inner = this.serviceClient().cancelAtSubscription(remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelAtSubscriptionWithResponse(String remediationName, Context context) { + Response inner = + this.serviceClient().cancelAtSubscriptionWithResponse(remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(top, filter, context); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public Remediation createOrUpdateAtSubscription(String remediationName, RemediationInner parameters) { + RemediationInner inner = this.serviceClient().createOrUpdateAtSubscription(remediationName, parameters); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateAtSubscriptionWithResponse( + String remediationName, RemediationInner parameters, Context context) { + Response inner = + this.serviceClient().createOrUpdateAtSubscriptionWithResponse(remediationName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation getAtSubscription(String remediationName) { + RemediationInner inner = this.serviceClient().getAtSubscription(remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtSubscriptionWithResponse(String remediationName, Context context) { + Response inner = this.serviceClient().getAtSubscriptionWithResponse(remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation deleteAtSubscription(String remediationName) { + RemediationInner inner = this.serviceClient().deleteAtSubscription(remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteAtSubscriptionWithResponse(String remediationName, Context context) { + Response inner = + this.serviceClient().deleteAtSubscriptionWithResponse(remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtResourceGroup(resourceGroupName, remediationName); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtResourceGroup(resourceGroupName, remediationName, top, context); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public Remediation cancelAtResourceGroup(String resourceGroupName, String remediationName) { + RemediationInner inner = this.serviceClient().cancelAtResourceGroup(resourceGroupName, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelAtResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context) { + Response inner = + this.serviceClient().cancelAtResourceGroupWithResponse(resourceGroupName, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, top, filter, context); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public Remediation getByResourceGroup(String resourceGroupName, String remediationName) { + RemediationInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation deleteByResourceGroup(String resourceGroupName, String remediationName) { + RemediationInner inner = this.serviceClient().delete(resourceGroupName, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String remediationName, Context context) { + Response inner = + this.serviceClient().deleteWithResponse(resourceGroupName, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listDeploymentsAtResource(String resourceId, String remediationName) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtResource(resourceId, remediationName); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listDeploymentsAtResource( + String resourceId, String remediationName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listDeploymentsAtResource(resourceId, remediationName, top, context); + return inner.mapPage(inner1 -> new RemediationDeploymentImpl(inner1, this.manager())); + } + + public Remediation cancelAtResource(String resourceId, String remediationName) { + RemediationInner inner = this.serviceClient().cancelAtResource(resourceId, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelAtResourceWithResponse( + String resourceId, String remediationName, Context context) { + Response inner = + this.serviceClient().cancelAtResourceWithResponse(resourceId, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listForResource(String resourceId) { + PagedIterable inner = this.serviceClient().listForResource(resourceId); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public PagedIterable listForResource(String resourceId, Integer top, String filter, Context context) { + PagedIterable inner = this.serviceClient().listForResource(resourceId, top, filter, context); + return inner.mapPage(inner1 -> new RemediationImpl(inner1, this.manager())); + } + + public Remediation createOrUpdateAtResource( + String resourceId, String remediationName, RemediationInner parameters) { + RemediationInner inner = this.serviceClient().createOrUpdateAtResource(resourceId, remediationName, parameters); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateAtResourceWithResponse( + String resourceId, String remediationName, RemediationInner parameters, Context context) { + Response inner = + this.serviceClient().createOrUpdateAtResourceWithResponse(resourceId, remediationName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation getAtResource(String resourceId, String remediationName) { + RemediationInner inner = this.serviceClient().getAtResource(resourceId, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAtResourceWithResponse(String resourceId, String remediationName, Context context) { + Response inner = + this.serviceClient().getAtResourceWithResponse(resourceId, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation deleteAtResource(String resourceId, String remediationName) { + RemediationInner inner = this.serviceClient().deleteAtResource(resourceId, remediationName); + if (inner != null) { + return new RemediationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteAtResourceWithResponse( + String resourceId, String remediationName, Context context) { + Response inner = + this.serviceClient().deleteAtResourceWithResponse(resourceId, remediationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RemediationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Remediation getById(String id) { + String resourceGroupName = Utils.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 remediationName = Utils.getValueFromIdByName(id, "remediations"); + if (remediationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'remediations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, remediationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 remediationName = Utils.getValueFromIdByName(id, "remediations"); + if (remediationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'remediations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, remediationName, context); + } + + public Remediation deleteById(String id) { + String resourceGroupName = Utils.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 remediationName = Utils.getValueFromIdByName(id, "remediations"); + if (remediationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'remediations'.", id))); + } + return this.deleteWithResponse(resourceGroupName, remediationName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 remediationName = Utils.getValueFromIdByName(id, "remediations"); + if (remediationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'remediations'.", id))); + } + return this.deleteWithResponse(resourceGroupName, remediationName, context); + } + + private RemediationsClient serviceClient() { + return this.innerClient; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } + + public RemediationImpl define(String name) { + return new RemediationImpl(name, this.manager()); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SlimPolicyMetadataImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SlimPolicyMetadataImpl.java new file mode 100644 index 000000000000..1de3272a217c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SlimPolicyMetadataImpl.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.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.SlimPolicyMetadataInner; +import com.azure.resourcemanager.policyinsights.models.SlimPolicyMetadata; + +public final class SlimPolicyMetadataImpl implements SlimPolicyMetadata { + private SlimPolicyMetadataInner innerObject; + + private final PolicyInsightsManager serviceManager; + + SlimPolicyMetadataImpl(SlimPolicyMetadataInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String metadataId() { + return this.innerModel().metadataId(); + } + + public String category() { + return this.innerModel().category(); + } + + public String title() { + return this.innerModel().title(); + } + + public String owner() { + return this.innerModel().owner(); + } + + public String additionalContentUrl() { + return this.innerModel().additionalContentUrl(); + } + + public Object metadata() { + return this.innerModel().metadata(); + } + + public SlimPolicyMetadataInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SummarizeResultsImpl.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SummarizeResultsImpl.java new file mode 100644 index 000000000000..0ca416e21bd2 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/SummarizeResultsImpl.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.policyinsights.implementation; + +import com.azure.resourcemanager.policyinsights.PolicyInsightsManager; +import com.azure.resourcemanager.policyinsights.fluent.models.SummarizeResultsInner; +import com.azure.resourcemanager.policyinsights.models.SummarizeResults; +import com.azure.resourcemanager.policyinsights.models.Summary; +import java.util.Collections; +import java.util.List; + +public final class SummarizeResultsImpl implements SummarizeResults { + private SummarizeResultsInner innerObject; + + private final PolicyInsightsManager serviceManager; + + SummarizeResultsImpl(SummarizeResultsInner innerObject, PolicyInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String odataContext() { + return this.innerModel().odataContext(); + } + + public Integer odataCount() { + return this.innerModel().odataCount(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SummarizeResultsInner innerModel() { + return this.innerObject; + } + + private PolicyInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/Utils.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/Utils.java new file mode 100644 index 000000000000..ae0990b7c943 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/Utils.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.policyinsights.implementation; + +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/package-info.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/package-info.java new file mode 100644 index 000000000000..a0927a4331c3 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for PolicyInsightsClient. null. */ +package com.azure.resourcemanager.policyinsights.implementation; diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestation.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestation.java new file mode 100644 index 000000000000..7faefe8dd4b1 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestation.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Attestation. */ +public interface Attestation { + /** + * 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 policyAssignmentId property: The resource ID of the policy assignment that the attestation is setting + * the state for. + * + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * Gets the policyDefinitionReferenceId property: The policy definition reference ID from a policy set definition + * that the attestation is setting the state for. If the policy assignment assigns a policy set definition the + * attestation can choose a definition within the set definition with this property or omit this and set the state + * for the entire set definition. + * + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * Gets the complianceState property: The compliance state that should be set on the resource. + * + * @return the complianceState value. + */ + ComplianceState complianceState(); + + /** + * Gets the expiresOn property: The time the compliance state should expire. + * + * @return the expiresOn value. + */ + OffsetDateTime expiresOn(); + + /** + * Gets the owner property: The person responsible for setting the state of the resource. This value is typically an + * Azure Active Directory object ID. + * + * @return the owner value. + */ + String owner(); + + /** + * Gets the comments property: Comments describing why this attestation was created. + * + * @return the comments value. + */ + String comments(); + + /** + * Gets the evidence property: The evidence supporting the compliance state set in this attestation. + * + * @return the evidence value. + */ + List evidence(); + + /** + * Gets the provisioningState property: The status of the attestation. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the lastComplianceStateChangeAt property: The time the compliance state was last changed in this + * attestation. + * + * @return the lastComplianceStateChangeAt value. + */ + OffsetDateTime lastComplianceStateChangeAt(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner object. + * + * @return the inner object. + */ + AttestationInner innerModel(); + + /** The entirety of the Attestation definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithPolicyAssignmentId, + DefinitionStages.WithCreate { + } + /** The Attestation definition stages. */ + interface DefinitionStages { + /** The first stage of the Attestation definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the Attestation definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithPolicyAssignmentId withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Attestation definition allowing to specify policyAssignmentId. */ + interface WithPolicyAssignmentId { + /** + * Specifies the policyAssignmentId property: The resource ID of the policy assignment that the attestation + * is setting the state for.. + * + * @param policyAssignmentId The resource ID of the policy assignment that the attestation is setting the + * state for. + * @return the next definition stage. + */ + WithCreate withPolicyAssignmentId(String policyAssignmentId); + } + /** + * The stage of the Attestation 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.WithPolicyDefinitionReferenceId, + DefinitionStages.WithComplianceState, + DefinitionStages.WithExpiresOn, + DefinitionStages.WithOwner, + DefinitionStages.WithComments, + DefinitionStages.WithEvidence { + /** + * Executes the create request. + * + * @return the created resource. + */ + Attestation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Attestation create(Context context); + } + /** The stage of the Attestation definition allowing to specify policyDefinitionReferenceId. */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies the policyDefinitionReferenceId property: The policy definition reference ID from a policy set + * definition that the attestation is setting the state for. If the policy assignment assigns a policy set + * definition the attestation can choose a definition within the set definition with this property or omit + * this and set the state for the entire set definition.. + * + * @param policyDefinitionReferenceId The policy definition reference ID from a policy set definition that + * the attestation is setting the state for. If the policy assignment assigns a policy set definition + * the attestation can choose a definition within the set definition with this property or omit this and + * set the state for the entire set definition. + * @return the next definition stage. + */ + WithCreate withPolicyDefinitionReferenceId(String policyDefinitionReferenceId); + } + /** The stage of the Attestation definition allowing to specify complianceState. */ + interface WithComplianceState { + /** + * Specifies the complianceState property: The compliance state that should be set on the resource.. + * + * @param complianceState The compliance state that should be set on the resource. + * @return the next definition stage. + */ + WithCreate withComplianceState(ComplianceState complianceState); + } + /** The stage of the Attestation definition allowing to specify expiresOn. */ + interface WithExpiresOn { + /** + * Specifies the expiresOn property: The time the compliance state should expire.. + * + * @param expiresOn The time the compliance state should expire. + * @return the next definition stage. + */ + WithCreate withExpiresOn(OffsetDateTime expiresOn); + } + /** The stage of the Attestation definition allowing to specify owner. */ + interface WithOwner { + /** + * Specifies the owner property: The person responsible for setting the state of the resource. This value is + * typically an Azure Active Directory object ID.. + * + * @param owner The person responsible for setting the state of the resource. This value is typically an + * Azure Active Directory object ID. + * @return the next definition stage. + */ + WithCreate withOwner(String owner); + } + /** The stage of the Attestation definition allowing to specify comments. */ + interface WithComments { + /** + * Specifies the comments property: Comments describing why this attestation was created.. + * + * @param comments Comments describing why this attestation was created. + * @return the next definition stage. + */ + WithCreate withComments(String comments); + } + /** The stage of the Attestation definition allowing to specify evidence. */ + interface WithEvidence { + /** + * Specifies the evidence property: The evidence supporting the compliance state set in this attestation.. + * + * @param evidence The evidence supporting the compliance state set in this attestation. + * @return the next definition stage. + */ + WithCreate withEvidence(List evidence); + } + } + /** + * Begins update for the Attestation resource. + * + * @return the stage of resource update. + */ + Attestation.Update update(); + + /** The template for Attestation update. */ + interface Update + extends UpdateStages.WithPolicyAssignmentId, + UpdateStages.WithPolicyDefinitionReferenceId, + UpdateStages.WithComplianceState, + UpdateStages.WithExpiresOn, + UpdateStages.WithOwner, + UpdateStages.WithComments, + UpdateStages.WithEvidence { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Attestation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Attestation apply(Context context); + } + /** The Attestation update stages. */ + interface UpdateStages { + /** The stage of the Attestation update allowing to specify policyAssignmentId. */ + interface WithPolicyAssignmentId { + /** + * Specifies the policyAssignmentId property: The resource ID of the policy assignment that the attestation + * is setting the state for.. + * + * @param policyAssignmentId The resource ID of the policy assignment that the attestation is setting the + * state for. + * @return the next definition stage. + */ + Update withPolicyAssignmentId(String policyAssignmentId); + } + /** The stage of the Attestation update allowing to specify policyDefinitionReferenceId. */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies the policyDefinitionReferenceId property: The policy definition reference ID from a policy set + * definition that the attestation is setting the state for. If the policy assignment assigns a policy set + * definition the attestation can choose a definition within the set definition with this property or omit + * this and set the state for the entire set definition.. + * + * @param policyDefinitionReferenceId The policy definition reference ID from a policy set definition that + * the attestation is setting the state for. If the policy assignment assigns a policy set definition + * the attestation can choose a definition within the set definition with this property or omit this and + * set the state for the entire set definition. + * @return the next definition stage. + */ + Update withPolicyDefinitionReferenceId(String policyDefinitionReferenceId); + } + /** The stage of the Attestation update allowing to specify complianceState. */ + interface WithComplianceState { + /** + * Specifies the complianceState property: The compliance state that should be set on the resource.. + * + * @param complianceState The compliance state that should be set on the resource. + * @return the next definition stage. + */ + Update withComplianceState(ComplianceState complianceState); + } + /** The stage of the Attestation update allowing to specify expiresOn. */ + interface WithExpiresOn { + /** + * Specifies the expiresOn property: The time the compliance state should expire.. + * + * @param expiresOn The time the compliance state should expire. + * @return the next definition stage. + */ + Update withExpiresOn(OffsetDateTime expiresOn); + } + /** The stage of the Attestation update allowing to specify owner. */ + interface WithOwner { + /** + * Specifies the owner property: The person responsible for setting the state of the resource. This value is + * typically an Azure Active Directory object ID.. + * + * @param owner The person responsible for setting the state of the resource. This value is typically an + * Azure Active Directory object ID. + * @return the next definition stage. + */ + Update withOwner(String owner); + } + /** The stage of the Attestation update allowing to specify comments. */ + interface WithComments { + /** + * Specifies the comments property: Comments describing why this attestation was created.. + * + * @param comments Comments describing why this attestation was created. + * @return the next definition stage. + */ + Update withComments(String comments); + } + /** The stage of the Attestation update allowing to specify evidence. */ + interface WithEvidence { + /** + * Specifies the evidence property: The evidence supporting the compliance state set in this attestation.. + * + * @param evidence The evidence supporting the compliance state set in this attestation. + * @return the next definition stage. + */ + Update withEvidence(List evidence); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Attestation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Attestation refresh(Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationEvidence.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationEvidence.java new file mode 100644 index 000000000000..576cec7b4c2e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationEvidence.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A piece of evidence supporting the compliance state set in the attestation. */ +@Fluent +public final class AttestationEvidence { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationEvidence.class); + + /* + * The description for this piece of evidence. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The URI location of the evidence. + */ + @JsonProperty(value = "sourceUri") + private String sourceUri; + + /** + * Get the description property: The description for this piece of evidence. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description for this piece of evidence. + * + * @param description the description value to set. + * @return the AttestationEvidence object itself. + */ + public AttestationEvidence withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the sourceUri property: The URI location of the evidence. + * + * @return the sourceUri value. + */ + public String sourceUri() { + return this.sourceUri; + } + + /** + * Set the sourceUri property: The URI location of the evidence. + * + * @param sourceUri the sourceUri value to set. + * @return the AttestationEvidence object itself. + */ + public AttestationEvidence withSourceUri(String sourceUri) { + this.sourceUri = sourceUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationListResult.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationListResult.java new file mode 100644 index 000000000000..62d02e6c2b5e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/AttestationListResult.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of attestations. */ +@Immutable +public final class AttestationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationListResult.class); + + /* + * Array of attestation definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of attestation definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @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()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestations.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestations.java new file mode 100644 index 000000000000..669dfadfb845 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Attestations.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.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.policyinsights.fluent.models.AttestationInner; + +/** Resource collection API of Attestations. */ +public interface Attestations { + /** + * Gets all attestations 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 all attestations for the subscription. + */ + PagedIterable list(); + + /** + * Gets all attestations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestations for the subscription. + */ + PagedIterable list(Integer top, String filter, Context context); + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + Attestation createOrUpdateAtSubscription(String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + Attestation createOrUpdateAtSubscription(String attestationName, AttestationInner parameters, Context context); + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at subscription scope. + */ + Attestation getAtSubscription(String attestationName); + + /** + * Gets an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at subscription scope. + */ + Response getAtSubscriptionWithResponse(String attestationName, Context context); + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteAtSubscription(String attestationName); + + /** + * Deletes an existing attestation at subscription scope. + * + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response deleteAtSubscriptionWithResponse(String attestationName, Context context); + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all attestations for the resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all attestations for the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestations for the resource group. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context); + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource group scope. + */ + Attestation getByResourceGroup(String resourceGroupName, String attestationName); + + /** + * Gets an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource group scope. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String attestationName, Context context); + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 attestationName); + + /** + * Deletes an existing attestation at resource group scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response deleteWithResponse(String resourceGroupName, String attestationName, Context context); + + /** + * Gets all attestations for a resource. + * + * @param resourceId 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 all attestations for a resource. + */ + PagedIterable listForResource(String resourceId); + + /** + * Gets all attestations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestations for a resource. + */ + PagedIterable listForResource(String resourceId, Integer top, String filter, Context context); + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + Attestation createOrUpdateAtResource(String resourceId, String attestationName, AttestationInner parameters); + + /** + * Creates or updates an attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param parameters The attestation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 attestation resource. + */ + Attestation createOrUpdateAtResource( + String resourceId, String attestationName, AttestationInner parameters, Context context); + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource scope. + */ + Attestation getAtResource(String resourceId, String attestationName); + + /** + * Gets an existing attestation at resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing attestation at resource scope. + */ + Response getAtResourceWithResponse(String resourceId, String attestationName, Context context); + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteAtResource(String resourceId, String attestationName); + + /** + * Deletes an existing attestation at individual resource scope. + * + * @param resourceId Resource ID. + * @param attestationName The name of the attestation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response deleteAtResourceWithResponse(String resourceId, String attestationName, Context context); + + /** + * Gets an existing attestation at resource group 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. + * @return an existing attestation at resource group scope. + */ + Attestation getById(String id); + + /** + * Gets an existing attestation at resource group 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 an existing attestation at resource group scope. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing attestation at resource group 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); + + /** + * Deletes an existing attestation at resource group 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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Attestation resource. + * + * @param name resource name. + * @return the first stage of the new Attestation definition. + */ + Attestation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsRequest.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsRequest.java new file mode 100644 index 000000000000..25e04a6db9de --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsRequest.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The check policy restrictions parameters describing the resource that is being evaluated. */ +@Fluent +public final class CheckRestrictionsRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckRestrictionsRequest.class); + + /* + * The information about the resource that will be evaluated. + */ + @JsonProperty(value = "resourceDetails", required = true) + private CheckRestrictionsResourceDetails resourceDetails; + + /* + * The list of fields and values that should be evaluated for potential + * restrictions. + */ + @JsonProperty(value = "pendingFields") + private List pendingFields; + + /** + * Get the resourceDetails property: The information about the resource that will be evaluated. + * + * @return the resourceDetails value. + */ + public CheckRestrictionsResourceDetails resourceDetails() { + return this.resourceDetails; + } + + /** + * Set the resourceDetails property: The information about the resource that will be evaluated. + * + * @param resourceDetails the resourceDetails value to set. + * @return the CheckRestrictionsRequest object itself. + */ + public CheckRestrictionsRequest withResourceDetails(CheckRestrictionsResourceDetails resourceDetails) { + this.resourceDetails = resourceDetails; + return this; + } + + /** + * Get the pendingFields property: The list of fields and values that should be evaluated for potential + * restrictions. + * + * @return the pendingFields value. + */ + public List pendingFields() { + return this.pendingFields; + } + + /** + * Set the pendingFields property: The list of fields and values that should be evaluated for potential + * restrictions. + * + * @param pendingFields the pendingFields value to set. + * @return the CheckRestrictionsRequest object itself. + */ + public CheckRestrictionsRequest withPendingFields(List pendingFields) { + this.pendingFields = pendingFields; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceDetails() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resourceDetails in model CheckRestrictionsRequest")); + } else { + resourceDetails().validate(); + } + if (pendingFields() != null) { + pendingFields().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResourceDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResourceDetails.java new file mode 100644 index 000000000000..e8906f3a7843 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResourceDetails.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The information about the resource that will be evaluated. */ +@Fluent +public final class CheckRestrictionsResourceDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckRestrictionsResourceDetails.class); + + /* + * The resource content. This should include whatever properties are + * already known and can be a partial set of all resource properties. + */ + @JsonProperty(value = "resourceContent", required = true) + private Object resourceContent; + + /* + * The api-version of the resource content. + */ + @JsonProperty(value = "apiVersion") + private String apiVersion; + + /* + * The scope where the resource is being created. For example, if the + * resource is a child resource this would be the parent resource's + * resource ID. + */ + @JsonProperty(value = "scope") + private String scope; + + /** + * Get the resourceContent property: The resource content. This should include whatever properties are already known + * and can be a partial set of all resource properties. + * + * @return the resourceContent value. + */ + public Object resourceContent() { + return this.resourceContent; + } + + /** + * Set the resourceContent property: The resource content. This should include whatever properties are already known + * and can be a partial set of all resource properties. + * + * @param resourceContent the resourceContent value to set. + * @return the CheckRestrictionsResourceDetails object itself. + */ + public CheckRestrictionsResourceDetails withResourceContent(Object resourceContent) { + this.resourceContent = resourceContent; + return this; + } + + /** + * Get the apiVersion property: The api-version of the resource content. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Set the apiVersion property: The api-version of the resource content. + * + * @param apiVersion the apiVersion value to set. + * @return the CheckRestrictionsResourceDetails object itself. + */ + public CheckRestrictionsResourceDetails withApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get the scope property: The scope where the resource is being created. For example, if the resource is a child + * resource this would be the parent resource's resource ID. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The scope where the resource is being created. For example, if the resource is a child + * resource this would be the parent resource's resource ID. + * + * @param scope the scope value to set. + * @return the CheckRestrictionsResourceDetails object itself. + */ + public CheckRestrictionsResourceDetails withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceContent() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resourceContent in model CheckRestrictionsResourceDetails")); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResult.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResult.java new file mode 100644 index 000000000000..0d97d176c0bc --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResult.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.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.CheckRestrictionsResultInner; +import java.util.List; + +/** An immutable client-side representation of CheckRestrictionsResult. */ +public interface CheckRestrictionsResult { + /** + * Gets the fieldRestrictions property: The restrictions that will be placed on various fields in the resource by + * policy. + * + * @return the fieldRestrictions value. + */ + List fieldRestrictions(); + + /** + * Gets the contentEvaluationResult property: Evaluation results for the provided partial resource content. + * + * @return the contentEvaluationResult value. + */ + CheckRestrictionsResultContentEvaluationResult contentEvaluationResult(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.CheckRestrictionsResultInner object. + * + * @return the inner object. + */ + CheckRestrictionsResultInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResultContentEvaluationResult.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResultContentEvaluationResult.java new file mode 100644 index 000000000000..eb8c34ae27f8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CheckRestrictionsResultContentEvaluationResult.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Evaluation results for the provided partial resource content. */ +@Fluent +public final class CheckRestrictionsResultContentEvaluationResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(CheckRestrictionsResultContentEvaluationResult.class); + + /* + * Policy evaluation results against the given resource content. This will + * indicate if the partial content that was provided will be denied as-is. + */ + @JsonProperty(value = "policyEvaluations") + private List policyEvaluations; + + /** + * Get the policyEvaluations property: Policy evaluation results against the given resource content. This will + * indicate if the partial content that was provided will be denied as-is. + * + * @return the policyEvaluations value. + */ + public List policyEvaluations() { + return this.policyEvaluations; + } + + /** + * Set the policyEvaluations property: Policy evaluation results against the given resource content. This will + * indicate if the partial content that was provided will be denied as-is. + * + * @param policyEvaluations the policyEvaluations value to set. + * @return the CheckRestrictionsResultContentEvaluationResult object itself. + */ + public CheckRestrictionsResultContentEvaluationResult withPolicyEvaluations( + List policyEvaluations) { + this.policyEvaluations = policyEvaluations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyEvaluations() != null) { + policyEvaluations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceDetail.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceDetail.java new file mode 100644 index 000000000000..795ae4785fea --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceDetail.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The compliance state rollup. */ +@Fluent +public final class ComplianceDetail { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceDetail.class); + + /* + * The compliance state. + */ + @JsonProperty(value = "complianceState") + private String complianceState; + + /* + * Summarized count value for this compliance state. + */ + @JsonProperty(value = "count") + private Integer count; + + /** + * Get the complianceState property: The compliance state. + * + * @return the complianceState value. + */ + public String complianceState() { + return this.complianceState; + } + + /** + * Set the complianceState property: The compliance state. + * + * @param complianceState the complianceState value to set. + * @return the ComplianceDetail object itself. + */ + public ComplianceDetail withComplianceState(String complianceState) { + this.complianceState = complianceState; + return this; + } + + /** + * Get the count property: Summarized count value for this compliance state. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Set the count property: Summarized count value for this compliance state. + * + * @param count the count value to set. + * @return the ComplianceDetail object itself. + */ + public ComplianceDetail withCount(Integer count) { + this.count = count; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceState.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceState.java new file mode 100644 index 000000000000..be16554d9584 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComplianceState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ComplianceState. */ +public final class ComplianceState extends ExpandableStringEnum { + /** Static value Compliant for ComplianceState. */ + public static final ComplianceState COMPLIANT = fromString("Compliant"); + + /** Static value NonCompliant for ComplianceState. */ + public static final ComplianceState NON_COMPLIANT = fromString("NonCompliant"); + + /** Static value Unknown for ComplianceState. */ + public static final ComplianceState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a ComplianceState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ComplianceState. + */ + @JsonCreator + public static ComplianceState fromString(String name) { + return fromString(name, ComplianceState.class); + } + + /** @return known ComplianceState values. */ + public static Collection values() { + return values(ComplianceState.class); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentEventDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentEventDetails.java new file mode 100644 index 000000000000..8a0e9aa3c1f1 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentEventDetails.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Component event details. */ +@Fluent +public final class ComponentEventDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComponentEventDetails.class); + + /* + * Component Id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Component type. + */ + @JsonProperty(value = "type") + private String type; + + /* + * Component name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Timestamp for component policy event record. + */ + @JsonProperty(value = "timestamp") + private OffsetDateTime timestamp; + + /* + * Tenant ID for the policy event record. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * Principal object ID for the user who initiated the resource component + * operation that triggered the policy event. + */ + @JsonProperty(value = "principalOid") + private String principalOid; + + /* + * Policy definition action, i.e. effect. + */ + @JsonProperty(value = "policyDefinitionAction") + private String policyDefinitionAction; + + /* + * Component event details. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the id property: Component Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Component Id. + * + * @param id the id value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: Component type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Component type. + * + * @param type the type value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: Component name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Component name. + * + * @param name the name value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get the timestamp property: Timestamp for component policy event record. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: Timestamp for component policy event record. + * + * @param timestamp the timestamp value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the tenantId property: Tenant ID for the policy event record. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID for the policy event record. + * + * @param tenantId the tenantId value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the principalOid property: Principal object ID for the user who initiated the resource component operation + * that triggered the policy event. + * + * @return the principalOid value. + */ + public String principalOid() { + return this.principalOid; + } + + /** + * Set the principalOid property: Principal object ID for the user who initiated the resource component operation + * that triggered the policy event. + * + * @param principalOid the principalOid value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withPrincipalOid(String principalOid) { + this.principalOid = principalOid; + return this; + } + + /** + * Get the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @return the policyDefinitionAction value. + */ + public String policyDefinitionAction() { + return this.policyDefinitionAction; + } + + /** + * Set the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @param policyDefinitionAction the policyDefinitionAction value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withPolicyDefinitionAction(String policyDefinitionAction) { + this.policyDefinitionAction = policyDefinitionAction; + return this; + } + + /** + * Get the additionalProperties property: Component event details. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Component event details. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ComponentEventDetails object itself. + */ + public ComponentEventDetails withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentStateDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentStateDetails.java new file mode 100644 index 000000000000..b87ffeda1a70 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ComponentStateDetails.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Component state details. */ +@Fluent +public final class ComponentStateDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComponentStateDetails.class); + + /* + * Component Id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Component type. + */ + @JsonProperty(value = "type") + private String type; + + /* + * Component name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Component compliance evaluation timestamp. + */ + @JsonProperty(value = "timestamp") + private OffsetDateTime timestamp; + + /* + * Component compliance state. + */ + @JsonProperty(value = "complianceState") + private String complianceState; + + /* + * Component state details. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the id property: Component Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Component Id. + * + * @param id the id value to set. + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: Component type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Component type. + * + * @param type the type value to set. + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: Component name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Component name. + * + * @param name the name value to set. + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get the timestamp property: Component compliance evaluation timestamp. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: Component compliance evaluation timestamp. + * + * @param timestamp the timestamp value to set. + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the complianceState property: Component compliance state. + * + * @return the complianceState value. + */ + public String complianceState() { + return this.complianceState; + } + + /** + * Set the complianceState property: Component compliance state. + * + * @param complianceState the complianceState value to set. + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withComplianceState(String complianceState) { + this.complianceState = complianceState; + return this; + } + + /** + * Get the additionalProperties property: Component state details. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Component state details. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ComponentStateDetails object itself. + */ + public ComponentStateDetails withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CreatedByType.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CreatedByType.java new file mode 100644 index 000000000000..6d5d7cd8c4cf --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/CreatedByType.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.policyinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreatedByType. */ +public final class CreatedByType extends ExpandableStringEnum { + /** Static value User for CreatedByType. */ + public static final CreatedByType USER = fromString("User"); + + /** Static value Application for CreatedByType. */ + public static final CreatedByType APPLICATION = fromString("Application"); + + /** Static value ManagedIdentity for CreatedByType. */ + public static final CreatedByType MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** Static value Key for CreatedByType. */ + public static final CreatedByType KEY = fromString("Key"); + + /** + * Creates or finds a CreatedByType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreatedByType. + */ + @JsonCreator + public static CreatedByType fromString(String name) { + return fromString(name, CreatedByType.class); + } + + /** @return known CreatedByType values. */ + public static Collection values() { + return values(CreatedByType.class); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ExpressionEvaluationDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ExpressionEvaluationDetails.java new file mode 100644 index 000000000000..39a03720e89e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ExpressionEvaluationDetails.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Evaluation details of policy language expressions. */ +@Fluent +public final class ExpressionEvaluationDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExpressionEvaluationDetails.class); + + /* + * Evaluation result. + */ + @JsonProperty(value = "result") + private String result; + + /* + * Expression evaluated. + */ + @JsonProperty(value = "expression") + private String expression; + + /* + * The kind of expression that was evaluated. + */ + @JsonProperty(value = "expressionKind", access = JsonProperty.Access.WRITE_ONLY) + private String expressionKind; + + /* + * Property path if the expression is a field or an alias. + */ + @JsonProperty(value = "path") + private String path; + + /* + * Value of the expression. + */ + @JsonProperty(value = "expressionValue") + private Object expressionValue; + + /* + * Target value to be compared with the expression value. + */ + @JsonProperty(value = "targetValue") + private Object targetValue; + + /* + * Operator to compare the expression value and the target value. + */ + @JsonProperty(value = "operator") + private String operator; + + /** + * Get the result property: Evaluation result. + * + * @return the result value. + */ + public String result() { + return this.result; + } + + /** + * Set the result property: Evaluation result. + * + * @param result the result value to set. + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withResult(String result) { + this.result = result; + return this; + } + + /** + * Get the expression property: Expression evaluated. + * + * @return the expression value. + */ + public String expression() { + return this.expression; + } + + /** + * Set the expression property: Expression evaluated. + * + * @param expression the expression value to set. + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withExpression(String expression) { + this.expression = expression; + return this; + } + + /** + * Get the expressionKind property: The kind of expression that was evaluated. + * + * @return the expressionKind value. + */ + public String expressionKind() { + return this.expressionKind; + } + + /** + * Get the path property: Property path if the expression is a field or an alias. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: Property path if the expression is a field or an alias. + * + * @param path the path value to set. + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the expressionValue property: Value of the expression. + * + * @return the expressionValue value. + */ + public Object expressionValue() { + return this.expressionValue; + } + + /** + * Set the expressionValue property: Value of the expression. + * + * @param expressionValue the expressionValue value to set. + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withExpressionValue(Object expressionValue) { + this.expressionValue = expressionValue; + return this; + } + + /** + * Get the targetValue property: Target value to be compared with the expression value. + * + * @return the targetValue value. + */ + public Object targetValue() { + return this.targetValue; + } + + /** + * Set the targetValue property: Target value to be compared with the expression value. + * + * @param targetValue the targetValue value to set. + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withTargetValue(Object targetValue) { + this.targetValue = targetValue; + return this; + } + + /** + * Get the operator property: Operator to compare the expression value and the target value. + * + * @return the operator value. + */ + public String operator() { + return this.operator; + } + + /** + * Set the operator property: Operator to compare the expression value and the target value. + * + * @param operator the operator value to set. + * @return the ExpressionEvaluationDetails object itself. + */ + public ExpressionEvaluationDetails withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestriction.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestriction.java new file mode 100644 index 000000000000..8478afa851b1 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestriction.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The restrictions on a field imposed by a specific policy. */ +@Immutable +public final class FieldRestriction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FieldRestriction.class); + + /* + * The type of restriction that is imposed on the field. + */ + @JsonProperty(value = "result", access = JsonProperty.Access.WRITE_ONLY) + private FieldRestrictionResult result; + + /* + * The value that policy will set for the field if the user does not + * provide a value. + */ + @JsonProperty(value = "defaultValue", access = JsonProperty.Access.WRITE_ONLY) + private String defaultValue; + + /* + * The values that policy either requires or denies for the field. + */ + @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY) + private List values; + + /* + * The details of the policy that is causing the field restriction. + */ + @JsonProperty(value = "policy", access = JsonProperty.Access.WRITE_ONLY) + private PolicyReference policy; + + /** + * Get the result property: The type of restriction that is imposed on the field. + * + * @return the result value. + */ + public FieldRestrictionResult result() { + return this.result; + } + + /** + * Get the defaultValue property: The value that policy will set for the field if the user does not provide a value. + * + * @return the defaultValue value. + */ + public String defaultValue() { + return this.defaultValue; + } + + /** + * Get the values property: The values that policy either requires or denies for the field. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Get the policy property: The details of the policy that is causing the field restriction. + * + * @return the policy value. + */ + public PolicyReference policy() { + return this.policy; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policy() != null) { + policy().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictionResult.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictionResult.java new file mode 100644 index 000000000000..fe3743e86d0b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictionResult.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FieldRestrictionResult. */ +public final class FieldRestrictionResult extends ExpandableStringEnum { + /** Static value Required for FieldRestrictionResult. */ + public static final FieldRestrictionResult REQUIRED = fromString("Required"); + + /** Static value Removed for FieldRestrictionResult. */ + public static final FieldRestrictionResult REMOVED = fromString("Removed"); + + /** Static value Deny for FieldRestrictionResult. */ + public static final FieldRestrictionResult DENY = fromString("Deny"); + + /** + * Creates or finds a FieldRestrictionResult from its string representation. + * + * @param name a name to look for. + * @return the corresponding FieldRestrictionResult. + */ + @JsonCreator + public static FieldRestrictionResult fromString(String name) { + return fromString(name, FieldRestrictionResult.class); + } + + /** @return known FieldRestrictionResult values. */ + public static Collection values() { + return values(FieldRestrictionResult.class); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictions.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictions.java new file mode 100644 index 000000000000..97a44fe94ad2 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/FieldRestrictions.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The restrictions that will be placed on a field in the resource by policy. */ +@Fluent +public final class FieldRestrictions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FieldRestrictions.class); + + /* + * The name of the field. This can be a top-level property like 'name' or + * 'type' or an Azure Policy field alias. + */ + @JsonProperty(value = "field", access = JsonProperty.Access.WRITE_ONLY) + private String field; + + /* + * The restrictions placed on that field by policy. + */ + @JsonProperty(value = "restrictions") + private List restrictions; + + /** + * Get the field property: The name of the field. This can be a top-level property like 'name' or 'type' or an Azure + * Policy field alias. + * + * @return the field value. + */ + public String field() { + return this.field; + } + + /** + * Get the restrictions property: The restrictions placed on that field by policy. + * + * @return the restrictions value. + */ + public List restrictions() { + return this.restrictions; + } + + /** + * Set the restrictions property: The restrictions placed on that field by policy. + * + * @param restrictions the restrictions value to set. + * @return the FieldRestrictions object itself. + */ + public FieldRestrictions withRestrictions(List restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restrictions() != null) { + restrictions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/IfNotExistsEvaluationDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/IfNotExistsEvaluationDetails.java new file mode 100644 index 000000000000..de3ccf04e56e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/IfNotExistsEvaluationDetails.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Evaluation details of IfNotExists effect. */ +@Fluent +public final class IfNotExistsEvaluationDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IfNotExistsEvaluationDetails.class); + + /* + * ID of the last evaluated resource for IfNotExists effect. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * Total number of resources to which the existence condition is + * applicable. + */ + @JsonProperty(value = "totalResources") + private Integer totalResources; + + /** + * Get the resourceId property: ID of the last evaluated resource for IfNotExists effect. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: ID of the last evaluated resource for IfNotExists effect. + * + * @param resourceId the resourceId value to set. + * @return the IfNotExistsEvaluationDetails object itself. + */ + public IfNotExistsEvaluationDetails withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the totalResources property: Total number of resources to which the existence condition is applicable. + * + * @return the totalResources value. + */ + public Integer totalResources() { + return this.totalResources; + } + + /** + * Set the totalResources property: Total number of resources to which the existence condition is applicable. + * + * @param totalResources the totalResources value to set. + * @return the IfNotExistsEvaluationDetails object itself. + */ + public IfNotExistsEvaluationDetails withTotalResources(Integer totalResources) { + this.totalResources = totalResources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operation.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operation.java new file mode 100644 index 000000000000..2d2f22c4d4d6 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operation.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation definition. */ +@Fluent +public final class Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * Operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name. + * + * @param name the name value to set. + * @return the Operation object itself. + */ + public Operation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the Operation object itself. + */ + public Operation withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationDisplay.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationDisplay.java new file mode 100644 index 000000000000..80e0867206a7 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationDisplay.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Resource provider name. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource name on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation name. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Operation description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider name. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource name on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource name on which the operation is performed. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation name. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation name. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Operation description. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operations.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operations.java new file mode 100644 index 000000000000..858697fb3c5d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists available operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + OperationsListResults list(); + + /** + * Lists available operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of available operations. + */ + Response listWithResponse(Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationsListResults.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationsListResults.java new file mode 100644 index 000000000000..043824ca4555 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/OperationsListResults.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.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.OperationsListResultsInner; +import java.util.List; + +/** An immutable client-side representation of OperationsListResults. */ +public interface OperationsListResults { + /** + * Gets the odataCount property: OData entity count; represents the number of operations returned. + * + * @return the odataCount value. + */ + Integer odataCount(); + + /** + * Gets the value property: List of available operations. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.OperationsListResultsInner object. + * + * @return the inner object. + */ + OperationsListResultsInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PendingField.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PendingField.java new file mode 100644 index 000000000000..95ce0bbe6696 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PendingField.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A field that should be evaluated against Azure Policy to determine restrictions. */ +@Fluent +public final class PendingField { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PendingField.class); + + /* + * The name of the field. This can be a top-level property like 'name' or + * 'type' or an Azure Policy field alias. + */ + @JsonProperty(value = "field", required = true) + private String field; + + /* + * The list of potential values for the field that should be evaluated + * against Azure Policy. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the field property: The name of the field. This can be a top-level property like 'name' or 'type' or an Azure + * Policy field alias. + * + * @return the field value. + */ + public String field() { + return this.field; + } + + /** + * Set the field property: The name of the field. This can be a top-level property like 'name' or 'type' or an Azure + * Policy field alias. + * + * @param field the field value to set. + * @return the PendingField object itself. + */ + public PendingField withField(String field) { + this.field = field; + return this; + } + + /** + * Get the values property: The list of potential values for the field that should be evaluated against Azure + * Policy. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The list of potential values for the field that should be evaluated against Azure + * Policy. + * + * @param values the values value to set. + * @return the PendingField object itself. + */ + public PendingField withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (field() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property field in model PendingField")); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyAssignmentSummary.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyAssignmentSummary.java new file mode 100644 index 000000000000..062b5c9e4a82 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyAssignmentSummary.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Policy assignment summary. */ +@Fluent +public final class PolicyAssignmentSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyAssignmentSummary.class); + + /* + * Policy assignment ID. + */ + @JsonProperty(value = "policyAssignmentId") + private String policyAssignmentId; + + /* + * Policy set definition ID, if the policy assignment is for a policy set. + */ + @JsonProperty(value = "policySetDefinitionId") + private String policySetDefinitionId; + + /* + * Compliance summary for the policy assignment. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /* + * Policy definitions summary. + */ + @JsonProperty(value = "policyDefinitions") + private List policyDefinitions; + + /* + * Policy definition group summary. + */ + @JsonProperty(value = "policyGroups") + private List policyGroups; + + /** + * Get the policyAssignmentId property: Policy assignment ID. + * + * @return the policyAssignmentId value. + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Set the policyAssignmentId property: Policy assignment ID. + * + * @param policyAssignmentId the policyAssignmentId value to set. + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicyAssignmentId(String policyAssignmentId) { + this.policyAssignmentId = policyAssignmentId; + return this; + } + + /** + * Get the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value. + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @param policySetDefinitionId the policySetDefinitionId value to set. + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get the results property: Compliance summary for the policy assignment. + * + * @return the results value. + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set the results property: Compliance summary for the policy assignment. + * + * @param results the results value to set. + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Get the policyDefinitions property: Policy definitions summary. + * + * @return the policyDefinitions value. + */ + public List policyDefinitions() { + return this.policyDefinitions; + } + + /** + * Set the policyDefinitions property: Policy definitions summary. + * + * @param policyDefinitions the policyDefinitions value to set. + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicyDefinitions(List policyDefinitions) { + this.policyDefinitions = policyDefinitions; + return this; + } + + /** + * Get the policyGroups property: Policy definition group summary. + * + * @return the policyGroups value. + */ + public List policyGroups() { + return this.policyGroups; + } + + /** + * Set the policyGroups property: Policy definition group summary. + * + * @param policyGroups the policyGroups value to set. + * @return the PolicyAssignmentSummary object itself. + */ + public PolicyAssignmentSummary withPolicyGroups(List policyGroups) { + this.policyGroups = policyGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() != null) { + results().validate(); + } + if (policyDefinitions() != null) { + policyDefinitions().forEach(e -> e.validate()); + } + if (policyGroups() != null) { + policyGroups().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDefinitionSummary.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDefinitionSummary.java new file mode 100644 index 000000000000..bf320e56f822 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDefinitionSummary.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Policy definition summary. */ +@Fluent +public final class PolicyDefinitionSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyDefinitionSummary.class); + + /* + * Policy definition ID. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /* + * Policy definition reference ID. + */ + @JsonProperty(value = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /* + * Policy definition group names. + */ + @JsonProperty(value = "policyDefinitionGroupNames") + private List policyDefinitionGroupNames; + + /* + * Policy effect, i.e. policy definition action. + */ + @JsonProperty(value = "effect") + private String effect; + + /* + * Compliance summary for the policy definition. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Get the policyDefinitionId property: Policy definition ID. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the policyDefinitionId property: Policy definition ID. + * + * @param policyDefinitionId the policyDefinitionId value to set. + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the policyDefinitionReferenceId property: Policy definition reference ID. + * + * @return the policyDefinitionReferenceId value. + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Set the policyDefinitionReferenceId property: Policy definition reference ID. + * + * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set. + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { + this.policyDefinitionReferenceId = policyDefinitionReferenceId; + return this; + } + + /** + * Get the policyDefinitionGroupNames property: Policy definition group names. + * + * @return the policyDefinitionGroupNames value. + */ + public List policyDefinitionGroupNames() { + return this.policyDefinitionGroupNames; + } + + /** + * Set the policyDefinitionGroupNames property: Policy definition group names. + * + * @param policyDefinitionGroupNames the policyDefinitionGroupNames value to set. + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withPolicyDefinitionGroupNames(List policyDefinitionGroupNames) { + this.policyDefinitionGroupNames = policyDefinitionGroupNames; + return this; + } + + /** + * Get the effect property: Policy effect, i.e. policy definition action. + * + * @return the effect value. + */ + public String effect() { + return this.effect; + } + + /** + * Set the effect property: Policy effect, i.e. policy definition action. + * + * @param effect the effect value to set. + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withEffect(String effect) { + this.effect = effect; + return this; + } + + /** + * Get the results property: Compliance summary for the policy definition. + * + * @return the results value. + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set the results property: Compliance summary for the policy definition. + * + * @param results the results value to set. + * @return the PolicyDefinitionSummary object itself. + */ + public PolicyDefinitionSummary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() != null) { + results().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDetails.java new file mode 100644 index 000000000000..1aa19eaea8b8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyDetails.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The policy details. */ +@Immutable +public final class PolicyDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyDetails.class); + + /* + * The ID of the policy definition. + */ + @JsonProperty(value = "policyDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionId; + + /* + * The ID of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentId", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentId; + + /* + * The display name of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentDisplayName; + + /* + * The scope of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentScope", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentScope; + + /* + * The ID of the policy set definition. + */ + @JsonProperty(value = "policySetDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policySetDefinitionId; + + /* + * The policy definition reference ID within the policy set definition. + */ + @JsonProperty(value = "policyDefinitionReferenceId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionReferenceId; + + /** + * Get the policyDefinitionId property: The ID of the policy definition. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Get the policyAssignmentId property: The ID of the policy assignment. + * + * @return the policyAssignmentId value. + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Get the policyAssignmentDisplayName property: The display name of the policy assignment. + * + * @return the policyAssignmentDisplayName value. + */ + public String policyAssignmentDisplayName() { + return this.policyAssignmentDisplayName; + } + + /** + * Get the policyAssignmentScope property: The scope of the policy assignment. + * + * @return the policyAssignmentScope value. + */ + public String policyAssignmentScope() { + return this.policyAssignmentScope; + } + + /** + * Get the policySetDefinitionId property: The ID of the policy set definition. + * + * @return the policySetDefinitionId value. + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Get the policyDefinitionReferenceId property: The policy definition reference ID within the policy set + * definition. + * + * @return the policyDefinitionReferenceId value. + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationDetails.java new file mode 100644 index 000000000000..88e3ab39f00c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationDetails.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Policy evaluation details. */ +@Fluent +public final class PolicyEvaluationDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyEvaluationDetails.class); + + /* + * Details of the evaluated expressions. + */ + @JsonProperty(value = "evaluatedExpressions") + private List evaluatedExpressions; + + /* + * Evaluation details of IfNotExists effect. + */ + @JsonProperty(value = "ifNotExistsDetails") + private IfNotExistsEvaluationDetails ifNotExistsDetails; + + /** + * Get the evaluatedExpressions property: Details of the evaluated expressions. + * + * @return the evaluatedExpressions value. + */ + public List evaluatedExpressions() { + return this.evaluatedExpressions; + } + + /** + * Set the evaluatedExpressions property: Details of the evaluated expressions. + * + * @param evaluatedExpressions the evaluatedExpressions value to set. + * @return the PolicyEvaluationDetails object itself. + */ + public PolicyEvaluationDetails withEvaluatedExpressions(List evaluatedExpressions) { + this.evaluatedExpressions = evaluatedExpressions; + return this; + } + + /** + * Get the ifNotExistsDetails property: Evaluation details of IfNotExists effect. + * + * @return the ifNotExistsDetails value. + */ + public IfNotExistsEvaluationDetails ifNotExistsDetails() { + return this.ifNotExistsDetails; + } + + /** + * Set the ifNotExistsDetails property: Evaluation details of IfNotExists effect. + * + * @param ifNotExistsDetails the ifNotExistsDetails value to set. + * @return the PolicyEvaluationDetails object itself. + */ + public PolicyEvaluationDetails withIfNotExistsDetails(IfNotExistsEvaluationDetails ifNotExistsDetails) { + this.ifNotExistsDetails = ifNotExistsDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (evaluatedExpressions() != null) { + evaluatedExpressions().forEach(e -> e.validate()); + } + if (ifNotExistsDetails() != null) { + ifNotExistsDetails().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationResult.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationResult.java new file mode 100644 index 000000000000..7fe782cf69b8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvaluationResult.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The result of a non-compliant policy evaluation against the given resource content. */ +@Immutable +public final class PolicyEvaluationResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyEvaluationResult.class); + + /* + * The details of the policy that was evaluated. + */ + @JsonProperty(value = "policyInfo", access = JsonProperty.Access.WRITE_ONLY) + private PolicyReference policyInfo; + + /* + * The result of the policy evaluation against the resource. This will + * typically be 'NonCompliant' but may contain other values if errors were + * encountered. + */ + @JsonProperty(value = "evaluationResult", access = JsonProperty.Access.WRITE_ONLY) + private String evaluationResult; + + /* + * The detailed results of the policy expressions and values that were + * evaluated. + */ + @JsonProperty(value = "evaluationDetails", access = JsonProperty.Access.WRITE_ONLY) + private PolicyEvaluationDetails evaluationDetails; + + /** + * Get the policyInfo property: The details of the policy that was evaluated. + * + * @return the policyInfo value. + */ + public PolicyReference policyInfo() { + return this.policyInfo; + } + + /** + * Get the evaluationResult property: The result of the policy evaluation against the resource. This will typically + * be 'NonCompliant' but may contain other values if errors were encountered. + * + * @return the evaluationResult value. + */ + public String evaluationResult() { + return this.evaluationResult; + } + + /** + * Get the evaluationDetails property: The detailed results of the policy expressions and values that were + * evaluated. + * + * @return the evaluationDetails value. + */ + public PolicyEvaluationDetails evaluationDetails() { + return this.evaluationDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyInfo() != null) { + policyInfo().validate(); + } + if (evaluationDetails() != null) { + evaluationDetails().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvent.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvent.java new file mode 100644 index 000000000000..d12461a7e619 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvent.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyEventInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of PolicyEvent. */ +public interface PolicyEvent { + /** + * Gets the odataId property: OData entity ID; always set to null since policy event records do not have an entity + * ID. + * + * @return the odataId value. + */ + String odataId(); + + /** + * Gets the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + String odataContext(); + + /** + * Gets the timestamp property: Timestamp for the policy event record. + * + * @return the timestamp value. + */ + OffsetDateTime timestamp(); + + /** + * Gets the resourceId property: Resource ID. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the policyAssignmentId property: Policy assignment ID. + * + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * Gets the policyDefinitionId property: Policy definition ID. + * + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * Gets the effectiveParameters property: Effective parameters for the policy assignment. + * + * @return the effectiveParameters value. + */ + String effectiveParameters(); + + /** + * Gets the isCompliant property: Flag which states whether the resource is compliant against the policy assignment + * it was evaluated against. + * + * @return the isCompliant value. + */ + Boolean isCompliant(); + + /** + * Gets the subscriptionId property: Subscription ID. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the resourceType property: Resource type. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the resourceLocation property: Resource location. + * + * @return the resourceLocation value. + */ + String resourceLocation(); + + /** + * Gets the resourceGroup property: Resource group name. + * + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * Gets the resourceTags property: List of resource tags. + * + * @return the resourceTags value. + */ + String resourceTags(); + + /** + * Gets the policyAssignmentName property: Policy assignment name. + * + * @return the policyAssignmentName value. + */ + String policyAssignmentName(); + + /** + * Gets the policyAssignmentOwner property: Policy assignment owner. + * + * @return the policyAssignmentOwner value. + */ + String policyAssignmentOwner(); + + /** + * Gets the policyAssignmentParameters property: Policy assignment parameters. + * + * @return the policyAssignmentParameters value. + */ + String policyAssignmentParameters(); + + /** + * Gets the policyAssignmentScope property: Policy assignment scope. + * + * @return the policyAssignmentScope value. + */ + String policyAssignmentScope(); + + /** + * Gets the policyDefinitionName property: Policy definition name. + * + * @return the policyDefinitionName value. + */ + String policyDefinitionName(); + + /** + * Gets the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @return the policyDefinitionAction value. + */ + String policyDefinitionAction(); + + /** + * Gets the policyDefinitionCategory property: Policy definition category. + * + * @return the policyDefinitionCategory value. + */ + String policyDefinitionCategory(); + + /** + * Gets the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value. + */ + String policySetDefinitionId(); + + /** + * Gets the policySetDefinitionName property: Policy set definition name, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionName value. + */ + String policySetDefinitionName(); + + /** + * Gets the policySetDefinitionOwner property: Policy set definition owner, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionOwner value. + */ + String policySetDefinitionOwner(); + + /** + * Gets the policySetDefinitionCategory property: Policy set definition category, if the policy assignment is for a + * policy set. + * + * @return the policySetDefinitionCategory value. + */ + String policySetDefinitionCategory(); + + /** + * Gets the policySetDefinitionParameters property: Policy set definition parameters, if the policy assignment is + * for a policy set. + * + * @return the policySetDefinitionParameters value. + */ + String policySetDefinitionParameters(); + + /** + * Gets the managementGroupIds property: Comma separated list of management group IDs, which represent the hierarchy + * of the management groups the resource is under. + * + * @return the managementGroupIds value. + */ + String managementGroupIds(); + + /** + * Gets the policyDefinitionReferenceId property: Reference ID for the policy definition inside the policy set, if + * the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * Gets the complianceState property: Compliance state of the resource. + * + * @return the complianceState value. + */ + String complianceState(); + + /** + * Gets the tenantId property: Tenant ID for the policy event record. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the principalOid property: Principal object ID for the user who initiated the resource operation that + * triggered the policy event. + * + * @return the principalOid value. + */ + String principalOid(); + + /** + * Gets the components property: Components events records populated only when URL contains $expand=components + * clause. + * + * @return the components value. + */ + List components(); + + /** + * Gets the additionalProperties property: Policy event record. + * + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.PolicyEventInner object. + * + * @return the inner object. + */ + PolicyEventInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvents.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvents.java new file mode 100644 index 000000000000..f2e70aacd457 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEvents.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Resource collection API of PolicyEvents. */ +public interface PolicyEvents { + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + PagedIterable listQueryResultsForManagementGroup(String managementGroupName); + + /** + * Queries policy events for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + PagedIterable listQueryResultsForSubscription(String subscriptionId); + + /** + * Queries policy events for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForSubscription( + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + PagedIterable listQueryResultsForResourceGroup(String subscriptionId, String resourceGroupName); + + /** + * Queries policy events for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResourceGroup( + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resource. + * + * @param resourceId 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 query results. + */ + PagedIterable listQueryResultsForResource(String resourceId); + + /** + * Queries policy events for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResource( + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context); + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, String policySetDefinitionName); + + /** + * Queries policy events for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForPolicySetDefinition( + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + PagedIterable listQueryResultsForPolicyDefinition(String subscriptionId, String policyDefinitionName); + + /** + * Queries policy events for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForPolicyDefinition( + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, String policyAssignmentName); + + /** + * Queries policy events for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName); + + /** + * Queries policy events for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEventsQueryResults.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEventsQueryResults.java new file mode 100644 index 000000000000..3635bf1d5c0d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyEventsQueryResults.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyEventInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Query results. */ +@Fluent +public final class PolicyEventsQueryResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyEventsQueryResults.class); + + /* + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata.context") + private String odataContext; + + /* + * OData entity count; represents the number of policy event records + * returned. + */ + @JsonProperty(value = "@odata.count") + private Integer odataCount; + + /* + * Odata next link; URL to get the next set of results. + */ + @JsonProperty(value = "@odata.nextLink") + private String odataNextLink; + + /* + * Query results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + public String odataContext() { + return this.odataContext; + } + + /** + * Set the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @param odataContext the odataContext value to set. + * @return the PolicyEventsQueryResults object itself. + */ + public PolicyEventsQueryResults withOdataContext(String odataContext) { + this.odataContext = odataContext; + return this; + } + + /** + * Get the odataCount property: OData entity count; represents the number of policy event records returned. + * + * @return the odataCount value. + */ + public Integer odataCount() { + return this.odataCount; + } + + /** + * Set the odataCount property: OData entity count; represents the number of policy event records returned. + * + * @param odataCount the odataCount value to set. + * @return the PolicyEventsQueryResults object itself. + */ + public PolicyEventsQueryResults withOdataCount(Integer odataCount) { + this.odataCount = odataCount; + return this; + } + + /** + * Get the odataNextLink property: Odata next link; URL to get the next set of results. + * + * @return the odataNextLink value. + */ + public String odataNextLink() { + return this.odataNextLink; + } + + /** + * Set the odataNextLink property: Odata next link; URL to get the next set of results. + * + * @param odataNextLink the odataNextLink value to set. + * @return the PolicyEventsQueryResults object itself. + */ + public PolicyEventsQueryResults withOdataNextLink(String odataNextLink) { + this.odataNextLink = odataNextLink; + return this; + } + + /** + * Get the value property: Query results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Query results. + * + * @param value the value value to set. + * @return the PolicyEventsQueryResults object itself. + */ + public PolicyEventsQueryResults withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyGroupSummary.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyGroupSummary.java new file mode 100644 index 000000000000..f902f7f88c49 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyGroupSummary.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Policy definition group summary. */ +@Fluent +public final class PolicyGroupSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyGroupSummary.class); + + /* + * Policy group name. + */ + @JsonProperty(value = "policyGroupName") + private String policyGroupName; + + /* + * Compliance summary for the policy definition group. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /** + * Get the policyGroupName property: Policy group name. + * + * @return the policyGroupName value. + */ + public String policyGroupName() { + return this.policyGroupName; + } + + /** + * Set the policyGroupName property: Policy group name. + * + * @param policyGroupName the policyGroupName value to set. + * @return the PolicyGroupSummary object itself. + */ + public PolicyGroupSummary withPolicyGroupName(String policyGroupName) { + this.policyGroupName = policyGroupName; + return this; + } + + /** + * Get the results property: Compliance summary for the policy definition group. + * + * @return the results value. + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set the results property: Compliance summary for the policy definition group. + * + * @param results the results value to set. + * @return the PolicyGroupSummary object itself. + */ + public PolicyGroupSummary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() != null) { + results().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadata.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadata.java new file mode 100644 index 000000000000..6afa75ce983d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadata.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyMetadataInner; + +/** An immutable client-side representation of PolicyMetadata. */ +public interface PolicyMetadata { + /** + * Gets the id property: The ID of the policy metadata. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the policy metadata. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the policy metadata. + * + * @return the name value. + */ + String name(); + + /** + * Gets the metadataId property: The policy metadata identifier. + * + * @return the metadataId value. + */ + String metadataId(); + + /** + * Gets the category property: The category of the policy metadata. + * + * @return the category value. + */ + String category(); + + /** + * Gets the title property: The title of the policy metadata. + * + * @return the title value. + */ + String title(); + + /** + * Gets the owner property: The owner of the policy metadata. + * + * @return the owner value. + */ + String owner(); + + /** + * Gets the additionalContentUrl property: Url for getting additional content about the resource metadata. + * + * @return the additionalContentUrl value. + */ + String additionalContentUrl(); + + /** + * Gets the metadata property: Additional metadata. + * + * @return the metadata value. + */ + Object metadata(); + + /** + * Gets the description property: The description of the policy metadata. + * + * @return the description value. + */ + String description(); + + /** + * Gets the requirements property: The requirements of the policy metadata. + * + * @return the requirements value. + */ + String requirements(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.PolicyMetadataInner object. + * + * @return the inner object. + */ + PolicyMetadataInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataCollection.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataCollection.java new file mode 100644 index 000000000000..ac531d61e5fc --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataCollection.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.models.SlimPolicyMetadataInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of policy metadata resources. */ +@Immutable +public final class PolicyMetadataCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyMetadataCollection.class); + + /* + * Array of policy metadata definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of policy metadata definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @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()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataProperties.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataProperties.java new file mode 100644 index 000000000000..def777eb665f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataProperties.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the policy metadata. */ +@Immutable +public final class PolicyMetadataProperties extends PolicyMetadataSlimProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyMetadataProperties.class); + + /* + * The description of the policy metadata. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The requirements of the policy metadata. + */ + @JsonProperty(value = "requirements", access = JsonProperty.Access.WRITE_ONLY) + private String requirements; + + /** + * Get the description property: The description of the policy metadata. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the requirements property: The requirements of the policy metadata. + * + * @return the requirements value. + */ + public String requirements() { + return this.requirements; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataSlimProperties.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataSlimProperties.java new file mode 100644 index 000000000000..3198793a57ed --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataSlimProperties.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the policy metadata, excluding properties containing large strings. */ +@Immutable +public class PolicyMetadataSlimProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyMetadataSlimProperties.class); + + /* + * The policy metadata identifier. + */ + @JsonProperty(value = "metadataId", access = JsonProperty.Access.WRITE_ONLY) + private String metadataId; + + /* + * The category of the policy metadata. + */ + @JsonProperty(value = "category", access = JsonProperty.Access.WRITE_ONLY) + private String category; + + /* + * The title of the policy metadata. + */ + @JsonProperty(value = "title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * The owner of the policy metadata. + */ + @JsonProperty(value = "owner", access = JsonProperty.Access.WRITE_ONLY) + private String owner; + + /* + * Url for getting additional content about the resource metadata. + */ + @JsonProperty(value = "additionalContentUrl", access = JsonProperty.Access.WRITE_ONLY) + private String additionalContentUrl; + + /* + * Additional metadata. + */ + @JsonProperty(value = "metadata", access = JsonProperty.Access.WRITE_ONLY) + private Object metadata; + + /** + * Get the metadataId property: The policy metadata identifier. + * + * @return the metadataId value. + */ + public String metadataId() { + return this.metadataId; + } + + /** + * Get the category property: The category of the policy metadata. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Get the title property: The title of the policy metadata. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the owner property: The owner of the policy metadata. + * + * @return the owner value. + */ + public String owner() { + return this.owner; + } + + /** + * Get the additionalContentUrl property: Url for getting additional content about the resource metadata. + * + * @return the additionalContentUrl value. + */ + public String additionalContentUrl() { + return this.additionalContentUrl; + } + + /** + * Get the metadata property: Additional metadata. + * + * @return the metadata value. + */ + public Object metadata() { + return this.metadata; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadatas.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadatas.java new file mode 100644 index 000000000000..760da5118a60 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadatas.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.policyinsights.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 PolicyMetadatas. */ +public interface PolicyMetadatas { + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + PolicyMetadata getResource(String resourceName); + + /** + * Get policy metadata resource. + * + * @param resourceName The name of the policy metadata 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 policy metadata resource. + */ + Response getResourceWithResponse(String resourceName, Context context); + + /** + * Get a list of the policy metadata resources. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + PagedIterable list(); + + /** + * Get a list of the policy metadata resources. + * + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the policy metadata resources. + */ + PagedIterable list(Integer top, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyReference.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyReference.java new file mode 100644 index 000000000000..d4b93773eeb5 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyReference.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource identifiers for a policy. */ +@Immutable +public final class PolicyReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyReference.class); + + /* + * The resource identifier of the policy definition. + */ + @JsonProperty(value = "policyDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionId; + + /* + * The resource identifier of the policy set definition. + */ + @JsonProperty(value = "policySetDefinitionId", access = JsonProperty.Access.WRITE_ONLY) + private String policySetDefinitionId; + + /* + * The reference identifier of a specific policy definition within a policy + * set definition. + */ + @JsonProperty(value = "policyDefinitionReferenceId", access = JsonProperty.Access.WRITE_ONLY) + private String policyDefinitionReferenceId; + + /* + * The resource identifier of the policy assignment. + */ + @JsonProperty(value = "policyAssignmentId", access = JsonProperty.Access.WRITE_ONLY) + private String policyAssignmentId; + + /** + * Get the policyDefinitionId property: The resource identifier of the policy definition. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Get the policySetDefinitionId property: The resource identifier of the policy set definition. + * + * @return the policySetDefinitionId value. + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Get the policyDefinitionReferenceId property: The reference identifier of a specific policy definition within a + * policy set definition. + * + * @return the policyDefinitionReferenceId value. + */ + public String policyDefinitionReferenceId() { + return this.policyDefinitionReferenceId; + } + + /** + * Get the policyAssignmentId property: The resource identifier of the policy assignment. + * + * @return the policyAssignmentId value. + */ + public String policyAssignmentId() { + return this.policyAssignmentId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyRestrictions.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyRestrictions.java new file mode 100644 index 000000000000..f60fe4204967 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyRestrictions.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PolicyRestrictions. */ +public interface PolicyRestrictions { + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + CheckRestrictionsResult checkAtSubscriptionScope(CheckRestrictionsRequest parameters); + + /** + * Checks what restrictions Azure Policy will place on a resource within a subscription. + * + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + Response checkAtSubscriptionScopeWithResponse( + CheckRestrictionsRequest parameters, Context context); + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + CheckRestrictionsResult checkAtResourceGroupScope(String resourceGroupName, CheckRestrictionsRequest parameters); + + /** + * Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the + * resource group the resource will be created in is already known. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The check policy restrictions parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a check policy restrictions evaluation on a resource. + */ + Response checkAtResourceGroupScopeWithResponse( + String resourceGroupName, CheckRestrictionsRequest parameters, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyState.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyState.java new file mode 100644 index 000000000000..4a9ce987a156 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyState.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyStateInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of PolicyState. */ +public interface PolicyState { + /** + * Gets the odataId property: OData entity ID; always set to null since policy state records do not have an entity + * ID. + * + * @return the odataId value. + */ + String odataId(); + + /** + * Gets the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + String odataContext(); + + /** + * Gets the timestamp property: Timestamp for the policy state record. + * + * @return the timestamp value. + */ + OffsetDateTime timestamp(); + + /** + * Gets the resourceId property: Resource ID. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the policyAssignmentId property: Policy assignment ID. + * + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * Gets the policyDefinitionId property: Policy definition ID. + * + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * Gets the effectiveParameters property: Effective parameters for the policy assignment. + * + * @return the effectiveParameters value. + */ + String effectiveParameters(); + + /** + * Gets the isCompliant property: Flag which states whether the resource is compliant against the policy assignment + * it was evaluated against. This property is deprecated; please use ComplianceState instead. + * + * @return the isCompliant value. + */ + Boolean isCompliant(); + + /** + * Gets the subscriptionId property: Subscription ID. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the resourceType property: Resource type. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the resourceLocation property: Resource location. + * + * @return the resourceLocation value. + */ + String resourceLocation(); + + /** + * Gets the resourceGroup property: Resource group name. + * + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * Gets the resourceTags property: List of resource tags. + * + * @return the resourceTags value. + */ + String resourceTags(); + + /** + * Gets the policyAssignmentName property: Policy assignment name. + * + * @return the policyAssignmentName value. + */ + String policyAssignmentName(); + + /** + * Gets the policyAssignmentOwner property: Policy assignment owner. + * + * @return the policyAssignmentOwner value. + */ + String policyAssignmentOwner(); + + /** + * Gets the policyAssignmentParameters property: Policy assignment parameters. + * + * @return the policyAssignmentParameters value. + */ + String policyAssignmentParameters(); + + /** + * Gets the policyAssignmentScope property: Policy assignment scope. + * + * @return the policyAssignmentScope value. + */ + String policyAssignmentScope(); + + /** + * Gets the policyDefinitionName property: Policy definition name. + * + * @return the policyDefinitionName value. + */ + String policyDefinitionName(); + + /** + * Gets the policyDefinitionAction property: Policy definition action, i.e. effect. + * + * @return the policyDefinitionAction value. + */ + String policyDefinitionAction(); + + /** + * Gets the policyDefinitionCategory property: Policy definition category. + * + * @return the policyDefinitionCategory value. + */ + String policyDefinitionCategory(); + + /** + * Gets the policySetDefinitionId property: Policy set definition ID, if the policy assignment is for a policy set. + * + * @return the policySetDefinitionId value. + */ + String policySetDefinitionId(); + + /** + * Gets the policySetDefinitionName property: Policy set definition name, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionName value. + */ + String policySetDefinitionName(); + + /** + * Gets the policySetDefinitionOwner property: Policy set definition owner, if the policy assignment is for a policy + * set. + * + * @return the policySetDefinitionOwner value. + */ + String policySetDefinitionOwner(); + + /** + * Gets the policySetDefinitionCategory property: Policy set definition category, if the policy assignment is for a + * policy set. + * + * @return the policySetDefinitionCategory value. + */ + String policySetDefinitionCategory(); + + /** + * Gets the policySetDefinitionParameters property: Policy set definition parameters, if the policy assignment is + * for a policy set. + * + * @return the policySetDefinitionParameters value. + */ + String policySetDefinitionParameters(); + + /** + * Gets the managementGroupIds property: Comma separated list of management group IDs, which represent the hierarchy + * of the management groups the resource is under. + * + * @return the managementGroupIds value. + */ + String managementGroupIds(); + + /** + * Gets the policyDefinitionReferenceId property: Reference ID for the policy definition inside the policy set, if + * the policy assignment is for a policy set. + * + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * Gets the complianceState property: Compliance state of the resource. + * + * @return the complianceState value. + */ + String complianceState(); + + /** + * Gets the policyEvaluationDetails property: Policy evaluation details. + * + * @return the policyEvaluationDetails value. + */ + PolicyEvaluationDetails policyEvaluationDetails(); + + /** + * Gets the policyDefinitionGroupNames property: Policy definition group names. + * + * @return the policyDefinitionGroupNames value. + */ + List policyDefinitionGroupNames(); + + /** + * Gets the components property: Components state compliance records populated only when URL contains + * $expand=components clause. + * + * @return the components value. + */ + List components(); + + /** + * Gets the policyDefinitionVersion property: Evaluated policy definition version. + * + * @return the policyDefinitionVersion value. + */ + String policyDefinitionVersion(); + + /** + * Gets the policySetDefinitionVersion property: Evaluated policy set definition version. + * + * @return the policySetDefinitionVersion value. + */ + String policySetDefinitionVersion(); + + /** + * Gets the policyAssignmentVersion property: Evaluated policy assignment version. + * + * @return the policyAssignmentVersion value. + */ + String policyAssignmentVersion(); + + /** + * Gets the additionalProperties property: Policy state record. + * + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.PolicyStateInner object. + * + * @return the inner object. + */ + PolicyStateInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStates.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStates.java new file mode 100644 index 000000000000..6e62e30e007b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStates.java @@ -0,0 +1,785 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Resource collection API of PolicyStates. */ +public interface PolicyStates { + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group 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 query results. + */ + PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, String managementGroupName); + + /** + * Queries policy states for the resources under the management group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForManagementGroup( + PolicyStatesResource policyStatesResource, + String managementGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group 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 summarize action results. + */ + SummarizeResults summarizeForManagementGroup(String managementGroupName); + + /** + * Summarizes policy states for the resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForManagementGroupWithResponse( + String managementGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription 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 query results. + */ + PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, String subscriptionId); + + /** + * Queries policy states for the resources under the subscription. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForSubscription( + PolicyStatesResource policyStatesResource, + String subscriptionId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 summarize action results. + */ + SummarizeResults summarizeForSubscription(String subscriptionId); + + /** + * Summarizes policy states for the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForSubscriptionWithResponse( + String subscriptionId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context); + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 query results. + */ + PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName); + + /** + * Queries policy states for the resources under the resource group. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResourceGroup( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 summarize action results. + */ + SummarizeResults summarizeForResourceGroup(String subscriptionId, String resourceGroupName); + + /** + * Summarizes policy states for the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForResourceGroupWithResponse( + String subscriptionId, + String resourceGroupName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId 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 query results. + */ + PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, String resourceId); + + /** + * Queries policy states for the resource. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param expand The $expand query parameter. For example, to expand components use $expand=components. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResource( + PolicyStatesResource policyStatesResource, + String resourceId, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String expand, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resource. + * + * @param resourceId 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 summarize action results. + */ + SummarizeResults summarizeForResource(String resourceId); + + /** + * Summarizes policy states for the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForResourceWithResponse( + String resourceId, Integer top, OffsetDateTime from, OffsetDateTime to, String filter, Context context); + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription 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 triggerSubscriptionEvaluation(String subscriptionId); + + /** + * Triggers a policy evaluation scan for all the resources under the subscription. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerSubscriptionEvaluation(String subscriptionId, Context context); + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName); + + /** + * Triggers a policy evaluation scan for all the resources under the resource group. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group 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 triggerResourceGroupEvaluation(String subscriptionId, String resourceGroupName, Context context); + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 query results. + */ + PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName); + + /** + * Queries policy states for the subscription level policy set definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForPolicySetDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policySetDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition 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 summarize action results. + */ + SummarizeResults summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName); + + /** + * Summarizes policy states for the subscription level policy set definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policySetDefinitionName Policy set definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForPolicySetDefinitionWithResponse( + String subscriptionId, + String policySetDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 query results. + */ + PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName); + + /** + * Queries policy states for the subscription level policy definition. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForPolicyDefinition( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyDefinitionName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition 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 summarize action results. + */ + SummarizeResults summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName); + + /** + * Summarizes policy states for the subscription level policy definition. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyDefinitionName Policy definition name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForPolicyDefinitionWithResponse( + String subscriptionId, + String policyDefinitionName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 query results. + */ + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName); + + /** + * Queries policy states for the subscription level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + SummarizeResults summarizeForSubscriptionLevelPolicyAssignment(String subscriptionId, String policyAssignmentName); + + /** + * Summarizes policy states for the subscription level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForSubscriptionLevelPolicyAssignmentWithResponse( + String subscriptionId, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 query results. + */ + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName); + + /** + * Queries policy states for the resource group level policy assignment. + * + * @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, + * 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param orderBy Ordering expression using OData notation. One or more comma-separated column names with an + * optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + * @param select Select expression using OData notation. Limits the columns on each record to just those requested, + * e.g. "$select=PolicyAssignmentId, ResourceId". + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param apply OData apply expression for aggregations. + * @param skipToken Skiptoken is only provided if a previous response returned a partial result as a part of + * nextLink element. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource policyStatesResource, + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + String orderBy, + String select, + OffsetDateTime from, + OffsetDateTime to, + String filter, + String apply, + String skipToken, + Context context); + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment 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 summarize action results. + */ + SummarizeResults summarizeForResourceGroupLevelPolicyAssignment( + String subscriptionId, String resourceGroupName, String policyAssignmentName); + + /** + * Summarizes policy states for the resource group level policy assignment. + * + * @param subscriptionId Microsoft Azure subscription ID. + * @param resourceGroupName Resource group name. + * @param policyAssignmentName Policy assignment name. + * @param top Maximum number of records to return. + * @param from ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, + * the service uses ($to - 1-day). + * @param to ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the + * service uses request time. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summarize action results. + */ + Response summarizeForResourceGroupLevelPolicyAssignmentWithResponse( + String subscriptionId, + String resourceGroupName, + String policyAssignmentName, + Integer top, + OffsetDateTime from, + OffsetDateTime to, + String filter, + Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesQueryResults.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesQueryResults.java new file mode 100644 index 000000000000..1d467dcbae0a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesQueryResults.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyStateInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Query results. */ +@Fluent +public final class PolicyStatesQueryResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyStatesQueryResults.class); + + /* + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata.context") + private String odataContext; + + /* + * OData entity count; represents the number of policy state records + * returned. + */ + @JsonProperty(value = "@odata.count") + private Integer odataCount; + + /* + * Odata next link; URL to get the next set of results. + */ + @JsonProperty(value = "@odata.nextLink") + private String odataNextLink; + + /* + * Query results. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + public String odataContext() { + return this.odataContext; + } + + /** + * Set the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @param odataContext the odataContext value to set. + * @return the PolicyStatesQueryResults object itself. + */ + public PolicyStatesQueryResults withOdataContext(String odataContext) { + this.odataContext = odataContext; + return this; + } + + /** + * Get the odataCount property: OData entity count; represents the number of policy state records returned. + * + * @return the odataCount value. + */ + public Integer odataCount() { + return this.odataCount; + } + + /** + * Set the odataCount property: OData entity count; represents the number of policy state records returned. + * + * @param odataCount the odataCount value to set. + * @return the PolicyStatesQueryResults object itself. + */ + public PolicyStatesQueryResults withOdataCount(Integer odataCount) { + this.odataCount = odataCount; + return this; + } + + /** + * Get the odataNextLink property: Odata next link; URL to get the next set of results. + * + * @return the odataNextLink value. + */ + public String odataNextLink() { + return this.odataNextLink; + } + + /** + * Set the odataNextLink property: Odata next link; URL to get the next set of results. + * + * @param odataNextLink the odataNextLink value to set. + * @return the PolicyStatesQueryResults object itself. + */ + public PolicyStatesQueryResults withOdataNextLink(String odataNextLink) { + this.odataNextLink = odataNextLink; + return this; + } + + /** + * Get the value property: Query results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Query results. + * + * @param value the value value to set. + * @return the PolicyStatesQueryResults object itself. + */ + public PolicyStatesQueryResults withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesResource.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesResource.java new file mode 100644 index 000000000000..873c9754e477 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStatesResource.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.policyinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PolicyStatesResource. */ +public final class PolicyStatesResource extends ExpandableStringEnum { + /** Static value default for PolicyStatesResource. */ + public static final PolicyStatesResource DEFAULT = fromString("default"); + + /** Static value latest for PolicyStatesResource. */ + public static final PolicyStatesResource LATEST = fromString("latest"); + + /** + * Creates or finds a PolicyStatesResource from its string representation. + * + * @param name a name to look for. + * @return the corresponding PolicyStatesResource. + */ + @JsonCreator + public static PolicyStatesResource fromString(String name) { + return fromString(name, PolicyStatesResource.class); + } + + /** @return known PolicyStatesResource values. */ + public static Collection values() { + return values(PolicyStatesResource.class); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResource.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResource.java new file mode 100644 index 000000000000..8558c21ad275 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResource.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.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyTrackedResourceInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of PolicyTrackedResource. */ +public interface PolicyTrackedResource { + /** + * Gets the trackedResourceId property: The ID of the policy tracked resource. + * + * @return the trackedResourceId value. + */ + String trackedResourceId(); + + /** + * Gets the policyDetails property: The details of the policy that require the tracked resource. + * + * @return the policyDetails value. + */ + PolicyDetails policyDetails(); + + /** + * Gets the createdBy property: The details of the policy triggered deployment that created the tracked resource. + * + * @return the createdBy value. + */ + TrackedResourceModificationDetails createdBy(); + + /** + * Gets the lastModifiedBy property: The details of the policy triggered deployment that modified the tracked + * resource. + * + * @return the lastModifiedBy value. + */ + TrackedResourceModificationDetails lastModifiedBy(); + + /** + * Gets the lastUpdateUtc property: Timestamp of the last update to the tracked resource. + * + * @return the lastUpdateUtc value. + */ + OffsetDateTime lastUpdateUtc(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.PolicyTrackedResourceInner object. + * + * @return the inner object. + */ + PolicyTrackedResourceInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResources.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResources.java new file mode 100644 index 000000000000..0740c8cea4e4 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResources.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.policyinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PolicyTrackedResources. */ +public interface PolicyTrackedResources { + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group 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 query results. + */ + PagedIterable listQueryResultsForManagementGroup(String managementGroupName); + + /** + * Queries policy tracked resources under the management group. + * + * @param managementGroupName Management group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForManagementGroup( + String managementGroupName, Integer top, String filter, Context context); + + /** + * Queries policy tracked resources under 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 query results. + */ + PagedIterable listQueryResultsForSubscription(); + + /** + * Queries policy tracked resources under the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForSubscription(Integer top, String filter, Context context); + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group 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 query results. + */ + PagedIterable listQueryResultsForResourceGroup(String resourceGroupName); + + /** + * Queries policy tracked resources under the resource group. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResourceGroup( + String resourceGroupName, Integer top, String filter, Context context); + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId 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 query results. + */ + PagedIterable listQueryResultsForResource(String resourceId); + + /** + * Queries policy tracked resources under the resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 results. + */ + PagedIterable listQueryResultsForResource( + String resourceId, Integer top, String filter, Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResourcesQueryResults.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResourcesQueryResults.java new file mode 100644 index 000000000000..5dda36550b4a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyTrackedResourcesQueryResults.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.models.PolicyTrackedResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Query results. */ +@Immutable +public final class PolicyTrackedResourcesQueryResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyTrackedResourcesQueryResults.class); + + /* + * Query results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Query results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @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()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.java new file mode 100644 index 000000000000..f9ceb79ac864 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediation.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.policyinsights.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Remediation. */ +public interface Remediation { + /** + * 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 policyAssignmentId property: The resource ID of the policy assignment that should be remediated. + * + * @return the policyAssignmentId value. + */ + String policyAssignmentId(); + + /** + * Gets the policyDefinitionReferenceId property: The policy definition reference ID of the individual definition + * that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. + * + * @return the policyDefinitionReferenceId value. + */ + String policyDefinitionReferenceId(); + + /** + * Gets the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified. + * + * @return the resourceDiscoveryMode value. + */ + ResourceDiscoveryMode resourceDiscoveryMode(); + + /** + * Gets the provisioningState property: The status of the remediation. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the createdOn property: The time at which the remediation was created. + * + * @return the createdOn value. + */ + OffsetDateTime createdOn(); + + /** + * Gets the lastUpdatedOn property: The time at which the remediation was last updated. + * + * @return the lastUpdatedOn value. + */ + OffsetDateTime lastUpdatedOn(); + + /** + * Gets the filters property: The filters that will be applied to determine which resources to remediate. + * + * @return the filters value. + */ + RemediationFilters filters(); + + /** + * Gets the deploymentStatus property: The deployment status summary for all deployments created by the remediation. + * + * @return the deploymentStatus value. + */ + RemediationDeploymentSummary deploymentStatus(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner object. + * + * @return the inner object. + */ + RemediationInner innerModel(); + + /** The entirety of the Remediation definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The Remediation definition stages. */ + interface DefinitionStages { + /** The first stage of the Remediation definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the Remediation definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Resource group name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Remediation 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.WithPolicyAssignmentId, + DefinitionStages.WithPolicyDefinitionReferenceId, + DefinitionStages.WithResourceDiscoveryMode, + DefinitionStages.WithFilters { + /** + * Executes the create request. + * + * @return the created resource. + */ + Remediation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Remediation create(Context context); + } + /** The stage of the Remediation definition allowing to specify policyAssignmentId. */ + interface WithPolicyAssignmentId { + /** + * Specifies the policyAssignmentId property: The resource ID of the policy assignment that should be + * remediated.. + * + * @param policyAssignmentId The resource ID of the policy assignment that should be remediated. + * @return the next definition stage. + */ + WithCreate withPolicyAssignmentId(String policyAssignmentId); + } + /** The stage of the Remediation definition allowing to specify policyDefinitionReferenceId. */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies the policyDefinitionReferenceId property: The policy definition reference ID of the individual + * definition that should be remediated. Required when the policy assignment being remediated assigns a + * policy set definition.. + * + * @param policyDefinitionReferenceId The policy definition reference ID of the individual definition that + * should be remediated. Required when the policy assignment being remediated assigns a policy set + * definition. + * @return the next definition stage. + */ + WithCreate withPolicyDefinitionReferenceId(String policyDefinitionReferenceId); + } + /** The stage of the Remediation definition allowing to specify resourceDiscoveryMode. */ + interface WithResourceDiscoveryMode { + /** + * Specifies the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified.. + * + * @param resourceDiscoveryMode The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified. + * @return the next definition stage. + */ + WithCreate withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode); + } + /** The stage of the Remediation definition allowing to specify filters. */ + interface WithFilters { + /** + * Specifies the filters property: The filters that will be applied to determine which resources to + * remediate.. + * + * @param filters The filters that will be applied to determine which resources to remediate. + * @return the next definition stage. + */ + WithCreate withFilters(RemediationFilters filters); + } + } + /** + * Begins update for the Remediation resource. + * + * @return the stage of resource update. + */ + Remediation.Update update(); + + /** The template for Remediation update. */ + interface Update + extends UpdateStages.WithPolicyAssignmentId, + UpdateStages.WithPolicyDefinitionReferenceId, + UpdateStages.WithResourceDiscoveryMode, + UpdateStages.WithFilters { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Remediation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Remediation apply(Context context); + } + /** The Remediation update stages. */ + interface UpdateStages { + /** The stage of the Remediation update allowing to specify policyAssignmentId. */ + interface WithPolicyAssignmentId { + /** + * Specifies the policyAssignmentId property: The resource ID of the policy assignment that should be + * remediated.. + * + * @param policyAssignmentId The resource ID of the policy assignment that should be remediated. + * @return the next definition stage. + */ + Update withPolicyAssignmentId(String policyAssignmentId); + } + /** The stage of the Remediation update allowing to specify policyDefinitionReferenceId. */ + interface WithPolicyDefinitionReferenceId { + /** + * Specifies the policyDefinitionReferenceId property: The policy definition reference ID of the individual + * definition that should be remediated. Required when the policy assignment being remediated assigns a + * policy set definition.. + * + * @param policyDefinitionReferenceId The policy definition reference ID of the individual definition that + * should be remediated. Required when the policy assignment being remediated assigns a policy set + * definition. + * @return the next definition stage. + */ + Update withPolicyDefinitionReferenceId(String policyDefinitionReferenceId); + } + /** The stage of the Remediation update allowing to specify resourceDiscoveryMode. */ + interface WithResourceDiscoveryMode { + /** + * Specifies the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified.. + * + * @param resourceDiscoveryMode The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified. + * @return the next definition stage. + */ + Update withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode); + } + /** The stage of the Remediation update allowing to specify filters. */ + interface WithFilters { + /** + * Specifies the filters property: The filters that will be applied to determine which resources to + * remediate.. + * + * @param filters The filters that will be applied to determine which resources to remediate. + * @return the next definition stage. + */ + Update withFilters(RemediationFilters filters); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Remediation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Remediation refresh(Context context); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeployment.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeployment.java new file mode 100644 index 000000000000..996cd1db74d2 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeployment.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationDeploymentInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RemediationDeployment. */ +public interface RemediationDeployment { + /** + * Gets the remediatedResourceId property: Resource ID of the resource that is being remediated by the deployment. + * + * @return the remediatedResourceId value. + */ + String remediatedResourceId(); + + /** + * Gets the deploymentId property: Resource ID of the template deployment that will remediate the resource. + * + * @return the deploymentId value. + */ + String deploymentId(); + + /** + * Gets the status property: Status of the remediation deployment. + * + * @return the status value. + */ + String status(); + + /** + * Gets the resourceLocation property: Location of the resource that is being remediated. + * + * @return the resourceLocation value. + */ + String resourceLocation(); + + /** + * Gets the error property: Error encountered while remediated the resource. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the createdOn property: The time at which the remediation was created. + * + * @return the createdOn value. + */ + OffsetDateTime createdOn(); + + /** + * Gets the lastUpdatedOn property: The time at which the remediation deployment was last updated. + * + * @return the lastUpdatedOn value. + */ + OffsetDateTime lastUpdatedOn(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.RemediationDeploymentInner object. + * + * @return the inner object. + */ + RemediationDeploymentInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentSummary.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentSummary.java new file mode 100644 index 000000000000..1f6744557b8a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentSummary.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The deployment status summary for all deployments created by the remediation. */ +@Immutable +public final class RemediationDeploymentSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationDeploymentSummary.class); + + /* + * The number of deployments required by the remediation. + */ + @JsonProperty(value = "totalDeployments", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalDeployments; + + /* + * The number of deployments required by the remediation that have + * succeeded. + */ + @JsonProperty(value = "successfulDeployments", access = JsonProperty.Access.WRITE_ONLY) + private Integer successfulDeployments; + + /* + * The number of deployments required by the remediation that have failed. + */ + @JsonProperty(value = "failedDeployments", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedDeployments; + + /** + * Get the totalDeployments property: The number of deployments required by the remediation. + * + * @return the totalDeployments value. + */ + public Integer totalDeployments() { + return this.totalDeployments; + } + + /** + * Get the successfulDeployments property: The number of deployments required by the remediation that have + * succeeded. + * + * @return the successfulDeployments value. + */ + public Integer successfulDeployments() { + return this.successfulDeployments; + } + + /** + * Get the failedDeployments property: The number of deployments required by the remediation that have failed. + * + * @return the failedDeployments value. + */ + public Integer failedDeployments() { + return this.failedDeployments; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentsListResult.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentsListResult.java new file mode 100644 index 000000000000..52cbdd04c24a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationDeploymentsListResult.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationDeploymentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of deployments for a remediation. */ +@Immutable +public final class RemediationDeploymentsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationDeploymentsListResult.class); + + /* + * Array of deployments for the remediation. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of deployments for the remediation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @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()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationFilters.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationFilters.java new file mode 100644 index 000000000000..0db5215ee432 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationFilters.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The filters that will be applied to determine which resources to remediate. */ +@Fluent +public final class RemediationFilters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationFilters.class); + + /* + * The resource locations that will be remediated. + */ + @JsonProperty(value = "locations") + private List locations; + + /** + * Get the locations property: The resource locations that will be remediated. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: The resource locations that will be remediated. + * + * @param locations the locations value to set. + * @return the RemediationFilters object itself. + */ + public RemediationFilters withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationListResult.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationListResult.java new file mode 100644 index 000000000000..2b742f9bb6af --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationListResult.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of remediations. */ +@Immutable +public final class RemediationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationListResult.class); + + /* + * Array of remediation definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of remediation definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @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()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediations.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediations.java new file mode 100644 index 000000000000..5054e4f5312b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Remediations.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.policyinsights.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.policyinsights.fluent.models.RemediationInner; + +/** Resource collection API of Remediations. */ +public interface Remediations { + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at management group scope. + */ + PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName); + + /** + * Gets all deployments for a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at management group scope. + */ + PagedIterable listDeploymentsAtManagementGroup( + String managementGroupId, String remediationName, Integer top, Context context); + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation cancelAtManagementGroup(String managementGroupId, String remediationName); + + /** + * Cancels a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response cancelAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context); + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group 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 all remediations for the management group. + */ + PagedIterable listForManagementGroup(String managementGroupId); + + /** + * Gets all remediations for the management group. + * + * @param managementGroupId Management group ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for the management group. + */ + PagedIterable listForManagementGroup( + String managementGroupId, Integer top, String filter, Context context); + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation createOrUpdateAtManagementGroup( + String managementGroupId, String remediationName, RemediationInner parameters); + + /** + * Creates or updates a remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response createOrUpdateAtManagementGroupWithResponse( + String managementGroupId, String remediationName, RemediationInner parameters, Context context); + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at management group scope. + */ + Remediation getAtManagementGroup(String managementGroupId, String remediationName); + + /** + * Gets an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at management group scope. + */ + Response getAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context); + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation deleteAtManagementGroup(String managementGroupId, String remediationName); + + /** + * Deletes an existing remediation at management group scope. + * + * @param managementGroupId Management group ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response deleteAtManagementGroupWithResponse( + String managementGroupId, String remediationName, Context context); + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at subscription scope. + */ + PagedIterable listDeploymentsAtSubscription(String remediationName); + + /** + * Gets all deployments for a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at subscription scope. + */ + PagedIterable listDeploymentsAtSubscription( + String remediationName, Integer top, Context context); + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation cancelAtSubscription(String remediationName); + + /** + * Cancels a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response cancelAtSubscriptionWithResponse(String remediationName, Context context); + + /** + * Gets all remediations 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 all remediations for the subscription. + */ + PagedIterable list(); + + /** + * Gets all remediations for the subscription. + * + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for the subscription. + */ + PagedIterable list(Integer top, String filter, Context context); + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation createOrUpdateAtSubscription(String remediationName, RemediationInner parameters); + + /** + * Creates or updates a remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response createOrUpdateAtSubscriptionWithResponse( + String remediationName, RemediationInner parameters, Context context); + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at subscription scope. + */ + Remediation getAtSubscription(String remediationName); + + /** + * Gets an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at subscription scope. + */ + Response getAtSubscriptionWithResponse(String remediationName, Context context); + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation deleteAtSubscription(String remediationName); + + /** + * Deletes an existing remediation at subscription scope. + * + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response deleteAtSubscriptionWithResponse(String remediationName, Context context); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource group scope. + */ + PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource group scope. + */ + PagedIterable listDeploymentsAtResourceGroup( + String resourceGroupName, String remediationName, Integer top, Context context); + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation cancelAtResourceGroup(String resourceGroupName, String remediationName); + + /** + * Cancels a remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response cancelAtResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context); + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group 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 all remediations for the subscription. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all remediations for the subscription. + * + * @param resourceGroupName Resource group name. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for the subscription. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, String filter, Context context); + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource group scope. + */ + Remediation getByResourceGroup(String resourceGroupName, String remediationName); + + /** + * Gets an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource group scope. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String remediationName, Context context); + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation deleteByResourceGroup(String resourceGroupName, String remediationName); + + /** + * Deletes an existing remediation at resource group scope. + * + * @param resourceGroupName Resource group name. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response deleteWithResponse(String resourceGroupName, String remediationName, Context context); + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource scope. + */ + PagedIterable listDeploymentsAtResource(String resourceId, String remediationName); + + /** + * Gets all deployments for a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param top Maximum number of records to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 deployments for a remediation at resource scope. + */ + PagedIterable listDeploymentsAtResource( + String resourceId, String remediationName, Integer top, Context context); + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation cancelAtResource(String resourceId, String remediationName); + + /** + * Cancel a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response cancelAtResourceWithResponse(String resourceId, String remediationName, Context context); + + /** + * Gets all remediations for a resource. + * + * @param resourceId 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 all remediations for a resource. + */ + PagedIterable listForResource(String resourceId); + + /** + * Gets all remediations for a resource. + * + * @param resourceId Resource ID. + * @param top Maximum number of records to return. + * @param filter OData filter expression. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 remediations for a resource. + */ + PagedIterable listForResource(String resourceId, Integer top, String filter, Context context); + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation createOrUpdateAtResource(String resourceId, String remediationName, RemediationInner parameters); + + /** + * Creates or updates a remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param parameters The remediation parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response createOrUpdateAtResourceWithResponse( + String resourceId, String remediationName, RemediationInner parameters, Context context); + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource scope. + */ + Remediation getAtResource(String resourceId, String remediationName); + + /** + * Gets an existing remediation at resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 existing remediation at resource scope. + */ + Response getAtResourceWithResponse(String resourceId, String remediationName, Context context); + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation deleteAtResource(String resourceId, String remediationName); + + /** + * Deletes an existing remediation at individual resource scope. + * + * @param resourceId Resource ID. + * @param remediationName The name of the remediation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response deleteAtResourceWithResponse(String resourceId, String remediationName, Context context); + + /** + * Gets an existing remediation at resource group 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. + * @return an existing remediation at resource group scope. + */ + Remediation getById(String id); + + /** + * Gets an existing remediation at resource group 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 an existing remediation at resource group scope. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing remediation at resource group 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. + * @return the remediation definition. + */ + Remediation deleteById(String id); + + /** + * Deletes an existing remediation at resource group 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 remediation definition. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Remediation resource. + * + * @param name resource name. + * @return the first stage of the new Remediation definition. + */ + Remediation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ResourceDiscoveryMode.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ResourceDiscoveryMode.java new file mode 100644 index 000000000000..540cf1456dcb --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/ResourceDiscoveryMode.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.policyinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceDiscoveryMode. */ +public final class ResourceDiscoveryMode extends ExpandableStringEnum { + /** Static value ExistingNonCompliant for ResourceDiscoveryMode. */ + public static final ResourceDiscoveryMode EXISTING_NON_COMPLIANT = fromString("ExistingNonCompliant"); + + /** Static value ReEvaluateCompliance for ResourceDiscoveryMode. */ + public static final ResourceDiscoveryMode RE_EVALUATE_COMPLIANCE = fromString("ReEvaluateCompliance"); + + /** + * Creates or finds a ResourceDiscoveryMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceDiscoveryMode. + */ + @JsonCreator + public static ResourceDiscoveryMode fromString(String name) { + return fromString(name, ResourceDiscoveryMode.class); + } + + /** @return known ResourceDiscoveryMode values. */ + public static Collection values() { + return values(ResourceDiscoveryMode.class); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SlimPolicyMetadata.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SlimPolicyMetadata.java new file mode 100644 index 000000000000..b2b670616f18 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SlimPolicyMetadata.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.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.SlimPolicyMetadataInner; + +/** An immutable client-side representation of SlimPolicyMetadata. */ +public interface SlimPolicyMetadata { + /** + * Gets the id property: The ID of the policy metadata. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the policy metadata. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the policy metadata. + * + * @return the name value. + */ + String name(); + + /** + * Gets the metadataId property: The policy metadata identifier. + * + * @return the metadataId value. + */ + String metadataId(); + + /** + * Gets the category property: The category of the policy metadata. + * + * @return the category value. + */ + String category(); + + /** + * Gets the title property: The title of the policy metadata. + * + * @return the title value. + */ + String title(); + + /** + * Gets the owner property: The owner of the policy metadata. + * + * @return the owner value. + */ + String owner(); + + /** + * Gets the additionalContentUrl property: Url for getting additional content about the resource metadata. + * + * @return the additionalContentUrl value. + */ + String additionalContentUrl(); + + /** + * Gets the metadata property: Additional metadata. + * + * @return the metadata value. + */ + Object metadata(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.SlimPolicyMetadataInner object. + * + * @return the inner object. + */ + SlimPolicyMetadataInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummarizeResults.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummarizeResults.java new file mode 100644 index 000000000000..eb16a6f88a5c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummarizeResults.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.policyinsights.models; + +import com.azure.resourcemanager.policyinsights.fluent.models.SummarizeResultsInner; +import java.util.List; + +/** An immutable client-side representation of SummarizeResults. */ +public interface SummarizeResults { + /** + * Gets the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + String odataContext(); + + /** + * Gets the odataCount property: OData entity count; represents the number of summaries returned; always set to 1. + * + * @return the odataCount value. + */ + Integer odataCount(); + + /** + * Gets the value property: Summarize action results. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.SummarizeResultsInner object. + * + * @return the inner object. + */ + SummarizeResultsInner innerModel(); +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Summary.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Summary.java new file mode 100644 index 000000000000..c1145ff9e2df --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/Summary.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Summary results. */ +@Fluent +public final class Summary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Summary.class); + + /* + * OData entity ID; always set to null since summaries do not have an + * entity ID. + */ + @JsonProperty(value = "@odata.id") + private String odataId; + + /* + * OData context string; used by OData clients to resolve type information + * based on metadata. + */ + @JsonProperty(value = "@odata.context") + private String odataContext; + + /* + * Compliance summary for all policy assignments. + */ + @JsonProperty(value = "results") + private SummaryResults results; + + /* + * Policy assignments summary. + */ + @JsonProperty(value = "policyAssignments") + private List policyAssignments; + + /** + * Get the odataId property: OData entity ID; always set to null since summaries do not have an entity ID. + * + * @return the odataId value. + */ + public String odataId() { + return this.odataId; + } + + /** + * Set the odataId property: OData entity ID; always set to null since summaries do not have an entity ID. + * + * @param odataId the odataId value to set. + * @return the Summary object itself. + */ + public Summary withOdataId(String odataId) { + this.odataId = odataId; + return this; + } + + /** + * Get the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @return the odataContext value. + */ + public String odataContext() { + return this.odataContext; + } + + /** + * Set the odataContext property: OData context string; used by OData clients to resolve type information based on + * metadata. + * + * @param odataContext the odataContext value to set. + * @return the Summary object itself. + */ + public Summary withOdataContext(String odataContext) { + this.odataContext = odataContext; + return this; + } + + /** + * Get the results property: Compliance summary for all policy assignments. + * + * @return the results value. + */ + public SummaryResults results() { + return this.results; + } + + /** + * Set the results property: Compliance summary for all policy assignments. + * + * @param results the results value to set. + * @return the Summary object itself. + */ + public Summary withResults(SummaryResults results) { + this.results = results; + return this; + } + + /** + * Get the policyAssignments property: Policy assignments summary. + * + * @return the policyAssignments value. + */ + public List policyAssignments() { + return this.policyAssignments; + } + + /** + * Set the policyAssignments property: Policy assignments summary. + * + * @param policyAssignments the policyAssignments value to set. + * @return the Summary object itself. + */ + public Summary withPolicyAssignments(List policyAssignments) { + this.policyAssignments = policyAssignments; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() != null) { + results().validate(); + } + if (policyAssignments() != null) { + policyAssignments().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummaryResults.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummaryResults.java new file mode 100644 index 000000000000..10914420d896 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SummaryResults.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Compliance summary on a particular summary level. */ +@Fluent +public final class SummaryResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SummaryResults.class); + + /* + * HTTP POST URI for queryResults action on Microsoft.PolicyInsights to + * retrieve raw results for the compliance summary. This property will not + * be available by default in future API versions, but could be queried + * explicitly. + */ + @JsonProperty(value = "queryResultsUri") + private String queryResultsUri; + + /* + * Number of non-compliant resources. + */ + @JsonProperty(value = "nonCompliantResources") + private Integer nonCompliantResources; + + /* + * Number of non-compliant policies. + */ + @JsonProperty(value = "nonCompliantPolicies") + private Integer nonCompliantPolicies; + + /* + * The resources summary at this level. + */ + @JsonProperty(value = "resourceDetails") + private List resourceDetails; + + /* + * The policy artifact summary at this level. For query scope level, it + * represents policy assignment summary. For policy assignment level, it + * represents policy definitions summary. + */ + @JsonProperty(value = "policyDetails") + private List policyDetails; + + /* + * The policy definition group summary at this level. + */ + @JsonProperty(value = "policyGroupDetails") + private List policyGroupDetails; + + /** + * Get the queryResultsUri property: HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve + * raw results for the compliance summary. This property will not be available by default in future API versions, + * but could be queried explicitly. + * + * @return the queryResultsUri value. + */ + public String queryResultsUri() { + return this.queryResultsUri; + } + + /** + * Set the queryResultsUri property: HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve + * raw results for the compliance summary. This property will not be available by default in future API versions, + * but could be queried explicitly. + * + * @param queryResultsUri the queryResultsUri value to set. + * @return the SummaryResults object itself. + */ + public SummaryResults withQueryResultsUri(String queryResultsUri) { + this.queryResultsUri = queryResultsUri; + return this; + } + + /** + * Get the nonCompliantResources property: Number of non-compliant resources. + * + * @return the nonCompliantResources value. + */ + public Integer nonCompliantResources() { + return this.nonCompliantResources; + } + + /** + * Set the nonCompliantResources property: Number of non-compliant resources. + * + * @param nonCompliantResources the nonCompliantResources value to set. + * @return the SummaryResults object itself. + */ + public SummaryResults withNonCompliantResources(Integer nonCompliantResources) { + this.nonCompliantResources = nonCompliantResources; + return this; + } + + /** + * Get the nonCompliantPolicies property: Number of non-compliant policies. + * + * @return the nonCompliantPolicies value. + */ + public Integer nonCompliantPolicies() { + return this.nonCompliantPolicies; + } + + /** + * Set the nonCompliantPolicies property: Number of non-compliant policies. + * + * @param nonCompliantPolicies the nonCompliantPolicies value to set. + * @return the SummaryResults object itself. + */ + public SummaryResults withNonCompliantPolicies(Integer nonCompliantPolicies) { + this.nonCompliantPolicies = nonCompliantPolicies; + return this; + } + + /** + * Get the resourceDetails property: The resources summary at this level. + * + * @return the resourceDetails value. + */ + public List resourceDetails() { + return this.resourceDetails; + } + + /** + * Set the resourceDetails property: The resources summary at this level. + * + * @param resourceDetails the resourceDetails value to set. + * @return the SummaryResults object itself. + */ + public SummaryResults withResourceDetails(List resourceDetails) { + this.resourceDetails = resourceDetails; + return this; + } + + /** + * Get the policyDetails property: The policy artifact summary at this level. For query scope level, it represents + * policy assignment summary. For policy assignment level, it represents policy definitions summary. + * + * @return the policyDetails value. + */ + public List policyDetails() { + return this.policyDetails; + } + + /** + * Set the policyDetails property: The policy artifact summary at this level. For query scope level, it represents + * policy assignment summary. For policy assignment level, it represents policy definitions summary. + * + * @param policyDetails the policyDetails value to set. + * @return the SummaryResults object itself. + */ + public SummaryResults withPolicyDetails(List policyDetails) { + this.policyDetails = policyDetails; + return this; + } + + /** + * Get the policyGroupDetails property: The policy definition group summary at this level. + * + * @return the policyGroupDetails value. + */ + public List policyGroupDetails() { + return this.policyGroupDetails; + } + + /** + * Set the policyGroupDetails property: The policy definition group summary at this level. + * + * @param policyGroupDetails the policyGroupDetails value to set. + * @return the SummaryResults object itself. + */ + public SummaryResults withPolicyGroupDetails(List policyGroupDetails) { + this.policyGroupDetails = policyGroupDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceDetails() != null) { + resourceDetails().forEach(e -> e.validate()); + } + if (policyDetails() != null) { + policyDetails().forEach(e -> e.validate()); + } + if (policyGroupDetails() != null) { + policyGroupDetails().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SystemData.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SystemData.java new file mode 100644 index 000000000000..c2d0e463b4ff --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/SystemData.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.policyinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Metadata pertaining to creation and last modification of the resource. */ +@Fluent +public final class SystemData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class); + + /* + * The identity that created the resource. + */ + @JsonProperty(value = "createdBy") + private String createdBy; + + /* + * The type of identity that created the resource. + */ + @JsonProperty(value = "createdByType") + private CreatedByType createdByType; + + /* + * The timestamp of resource creation (UTC). + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * The identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedBy") + private String lastModifiedBy; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedByType") + private CreatedByType lastModifiedByType; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedAt") + private OffsetDateTime lastModifiedAt; + + /** + * Get the createdBy property: The identity that created the resource. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: The identity that created the resource. + * + * @param createdBy the createdBy value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the createdByType property: The type of identity that created the resource. + * + * @return the createdByType value. + */ + public CreatedByType createdByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: The type of identity that created the resource. + * + * @param createdByType the createdByType value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedByType(CreatedByType createdByType) { + this.createdByType = createdByType; + return this; + } + + /** + * Get the createdAt property: The timestamp of resource creation (UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The timestamp of resource creation (UTC). + * + * @param createdAt the createdAt value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the lastModifiedBy property: The identity that last modified the resource. + * + * @return the lastModifiedBy value. + */ + public String lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the lastModifiedBy property: The identity that last modified the resource. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * Get the lastModifiedByType property: The type of identity that last modified the resource. + * + * @return the lastModifiedByType value. + */ + public CreatedByType lastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Set the lastModifiedByType property: The type of identity that last modified the resource. + * + * @param lastModifiedByType the lastModifiedByType value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedByType(CreatedByType lastModifiedByType) { + this.lastModifiedByType = lastModifiedByType; + return this; + } + + /** + * Get the lastModifiedAt property: The type of identity that last modified the resource. + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the lastModifiedAt property: The type of identity that last modified the resource. + * + * @param lastModifiedAt the lastModifiedAt value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TrackedResourceModificationDetails.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TrackedResourceModificationDetails.java new file mode 100644 index 000000000000..e5b60fa8260b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TrackedResourceModificationDetails.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The details of the policy triggered deployment that created or modified the tracked resource. */ +@Immutable +public final class TrackedResourceModificationDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TrackedResourceModificationDetails.class); + + /* + * The details of the policy that created or modified the tracked resource. + */ + @JsonProperty(value = "policyDetails", access = JsonProperty.Access.WRITE_ONLY) + private PolicyDetails policyDetails; + + /* + * The ID of the deployment that created or modified the tracked resource. + */ + @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentId; + + /* + * Timestamp of the deployment that created or modified the tracked + * resource. + */ + @JsonProperty(value = "deploymentTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deploymentTime; + + /** + * Get the policyDetails property: The details of the policy that created or modified the tracked resource. + * + * @return the policyDetails value. + */ + public PolicyDetails policyDetails() { + return this.policyDetails; + } + + /** + * Get the deploymentId property: The ID of the deployment that created or modified the tracked resource. + * + * @return the deploymentId value. + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Get the deploymentTime property: Timestamp of the deployment that created or modified the tracked resource. + * + * @return the deploymentTime value. + */ + public OffsetDateTime deploymentTime() { + return this.deploymentTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyDetails() != null) { + policyDetails().validate(); + } + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TypedErrorInfo.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TypedErrorInfo.java new file mode 100644 index 000000000000..9bd19fff89a0 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/TypedErrorInfo.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.policyinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Scenario specific error details. */ +@Immutable +public final class TypedErrorInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TypedErrorInfo.class); + + /* + * The type of included error details. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The scenario specific error details. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The type of included error details. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The scenario specific error details. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/package-info.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/package-info.java new file mode 100644 index 000000000000..676c97a66ee2 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for PolicyInsightsClient. null. */ +package com.azure.resourcemanager.policyinsights.models; diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/package-info.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/package-info.java new file mode 100644 index 000000000000..8604a618f34f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for PolicyInsightsClient. null. */ +package com.azure.resourcemanager.policyinsights; diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/module-info.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/module-info.java new file mode 100644 index 000000000000..98475482613e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.policyinsights { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.policyinsights; + exports com.azure.resourcemanager.policyinsights.fluent; + exports com.azure.resourcemanager.policyinsights.fluent.models; + exports com.azure.resourcemanager.policyinsights.models; + + opens com.azure.resourcemanager.policyinsights.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.policyinsights.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/policyinsights/ci.yml b/sdk/policyinsights/ci.yml new file mode 100644 index 000000000000..195e4e2bf5de --- /dev/null +++ b/sdk/policyinsights/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/policyinsights/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/policyinsights/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: policyinsights + Artifacts: + - name: azure-resourcemanager-policyinsights + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpolicyinsights diff --git a/sdk/policyinsights/pom.xml b/sdk/policyinsights/pom.xml new file mode 100644 index 000000000000..33d9a9746789 --- /dev/null +++ b/sdk/policyinsights/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-policyinsights-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-policyinsights + + + +