diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md index f0a34565a57a0..5acaa75c142fd 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-10-13) +- Azure Resource Manager PolicyInsights client library for Java. This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.1 (2021-04-22) diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md index 61af264c7752e..ca1dcf8493461 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/README.md @@ -2,7 +2,7 @@ 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). +This package contains Microsoft Azure SDK for PolicyInsights Management SDK. Package tag package-2021-10. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-policyinsights - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/policyinsights/azure-resourcemanager-policyinsights/SAMPLE.md) + + ## Troubleshooting ## Next steps diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/SAMPLE.md b/sdk/policyinsights/azure-resourcemanager-policyinsights/SAMPLE.md new file mode 100644 index 0000000000000..73770169b1dba --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/SAMPLE.md @@ -0,0 +1,3422 @@ +# Code snippets and samples + + +## Attestations + +- [CreateOrUpdateAtResource](#attestations_createorupdateatresource) +- [CreateOrUpdateAtResourceGroup](#attestations_createorupdateatresourcegroup) +- [CreateOrUpdateAtSubscription](#attestations_createorupdateatsubscription) +- [Delete](#attestations_delete) +- [DeleteAtResource](#attestations_deleteatresource) +- [DeleteAtSubscription](#attestations_deleteatsubscription) +- [GetAtResource](#attestations_getatresource) +- [GetAtSubscription](#attestations_getatsubscription) +- [GetByResourceGroup](#attestations_getbyresourcegroup) +- [List](#attestations_list) +- [ListByResourceGroup](#attestations_listbyresourcegroup) +- [ListForResource](#attestations_listforresource) + +## Operations + +- [List](#operations_list) + +## PolicyEvents + +- [ListQueryResultsForManagementGroup](#policyevents_listqueryresultsformanagementgroup) +- [ListQueryResultsForPolicyDefinition](#policyevents_listqueryresultsforpolicydefinition) +- [ListQueryResultsForPolicySetDefinition](#policyevents_listqueryresultsforpolicysetdefinition) +- [ListQueryResultsForResource](#policyevents_listqueryresultsforresource) +- [ListQueryResultsForResourceGroup](#policyevents_listqueryresultsforresourcegroup) +- [ListQueryResultsForResourceGroupLevelPolicyAssignment](#policyevents_listqueryresultsforresourcegrouplevelpolicyassignment) +- [ListQueryResultsForSubscription](#policyevents_listqueryresultsforsubscription) +- [ListQueryResultsForSubscriptionLevelPolicyAssignment](#policyevents_listqueryresultsforsubscriptionlevelpolicyassignment) + +## PolicyMetadata + +- [GetResource](#policymetadata_getresource) +- [List](#policymetadata_list) + +## PolicyRestrictions + +- [CheckAtResourceGroupScope](#policyrestrictions_checkatresourcegroupscope) +- [CheckAtSubscriptionScope](#policyrestrictions_checkatsubscriptionscope) + +## PolicyStates + +- [ListQueryResultsForManagementGroup](#policystates_listqueryresultsformanagementgroup) +- [ListQueryResultsForPolicyDefinition](#policystates_listqueryresultsforpolicydefinition) +- [ListQueryResultsForPolicySetDefinition](#policystates_listqueryresultsforpolicysetdefinition) +- [ListQueryResultsForResource](#policystates_listqueryresultsforresource) +- [ListQueryResultsForResourceGroup](#policystates_listqueryresultsforresourcegroup) +- [ListQueryResultsForResourceGroupLevelPolicyAssignment](#policystates_listqueryresultsforresourcegrouplevelpolicyassignment) +- [ListQueryResultsForSubscription](#policystates_listqueryresultsforsubscription) +- [ListQueryResultsForSubscriptionLevelPolicyAssignment](#policystates_listqueryresultsforsubscriptionlevelpolicyassignment) +- [SummarizeForManagementGroup](#policystates_summarizeformanagementgroup) +- [SummarizeForPolicyDefinition](#policystates_summarizeforpolicydefinition) +- [SummarizeForPolicySetDefinition](#policystates_summarizeforpolicysetdefinition) +- [SummarizeForResource](#policystates_summarizeforresource) +- [SummarizeForResourceGroup](#policystates_summarizeforresourcegroup) +- [SummarizeForResourceGroupLevelPolicyAssignment](#policystates_summarizeforresourcegrouplevelpolicyassignment) +- [SummarizeForSubscription](#policystates_summarizeforsubscription) +- [SummarizeForSubscriptionLevelPolicyAssignment](#policystates_summarizeforsubscriptionlevelpolicyassignment) +- [TriggerResourceGroupEvaluation](#policystates_triggerresourcegroupevaluation) +- [TriggerSubscriptionEvaluation](#policystates_triggersubscriptionevaluation) + +## PolicyTrackedResources + +- [ListQueryResultsForManagementGroup](#policytrackedresources_listqueryresultsformanagementgroup) +- [ListQueryResultsForResource](#policytrackedresources_listqueryresultsforresource) +- [ListQueryResultsForResourceGroup](#policytrackedresources_listqueryresultsforresourcegroup) +- [ListQueryResultsForSubscription](#policytrackedresources_listqueryresultsforsubscription) + +## Remediations + +- [CancelAtManagementGroup](#remediations_cancelatmanagementgroup) +- [CancelAtResource](#remediations_cancelatresource) +- [CancelAtResourceGroup](#remediations_cancelatresourcegroup) +- [CancelAtSubscription](#remediations_cancelatsubscription) +- [CreateOrUpdateAtManagementGroup](#remediations_createorupdateatmanagementgroup) +- [CreateOrUpdateAtResource](#remediations_createorupdateatresource) +- [CreateOrUpdateAtResourceGroup](#remediations_createorupdateatresourcegroup) +- [CreateOrUpdateAtSubscription](#remediations_createorupdateatsubscription) +- [Delete](#remediations_delete) +- [DeleteAtManagementGroup](#remediations_deleteatmanagementgroup) +- [DeleteAtResource](#remediations_deleteatresource) +- [DeleteAtSubscription](#remediations_deleteatsubscription) +- [GetAtManagementGroup](#remediations_getatmanagementgroup) +- [GetAtResource](#remediations_getatresource) +- [GetAtSubscription](#remediations_getatsubscription) +- [GetByResourceGroup](#remediations_getbyresourcegroup) +- [List](#remediations_list) +- [ListByResourceGroup](#remediations_listbyresourcegroup) +- [ListDeploymentsAtManagementGroup](#remediations_listdeploymentsatmanagementgroup) +- [ListDeploymentsAtResource](#remediations_listdeploymentsatresource) +- [ListDeploymentsAtResourceGroup](#remediations_listdeploymentsatresourcegroup) +- [ListDeploymentsAtSubscription](#remediations_listdeploymentsatsubscription) +- [ListForManagementGroup](#remediations_listformanagementgroup) +- [ListForResource](#remediations_listforresource) +### Attestations_CreateOrUpdateAtResource + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for Attestations CreateOrUpdateAtResource. */ +public final class AttestationsCreateOrUpdateAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateResourceScope.json + */ + /** + * Sample code: Create attestation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .createOrUpdateAtResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + new AttestationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("0b158b46-ff42-4799-8e39-08a5c23b4551") + .withComplianceState(ComplianceState.COMPLIANT) + .withExpiresOn(OffsetDateTime.parse("2021-06-15T00:00:00Z")) + .withOwner("55a32e28-3aa5-4eea-9b5a-4cd85153b966") + .withComments("This subscription has passed a security audit.") + .withEvidence( + Arrays + .asList( + new AttestationEvidence() + .withDescription("The results of the security audit.") + .withSourceUri( + "https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"))), + Context.NONE); + } +} +``` + +### Attestations_CreateOrUpdateAtResourceGroup + +```java +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for Attestations CreateOrUpdateAtResourceGroup. */ +public final class AttestationsCreateOrUpdateAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateResourceGroupScope.json + */ + /** + * Sample code: Create attestation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .define("790996e6-9871-4b1f-9cd9-ec42cd6ced1e") + .withExistingResourceGroup("myRg") + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("0b158b46-ff42-4799-8e39-08a5c23b4551") + .withComplianceState(ComplianceState.COMPLIANT) + .withExpiresOn(OffsetDateTime.parse("2021-06-15T00:00:00Z")) + .withOwner("55a32e28-3aa5-4eea-9b5a-4cd85153b966") + .withComments("This subscription has passed a security audit.") + .withEvidence( + Arrays + .asList( + new AttestationEvidence() + .withDescription("The results of the security audit.") + .withSourceUri("https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"))) + .create(); + } +} +``` + +### Attestations_CreateOrUpdateAtSubscription + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for Attestations CreateOrUpdateAtSubscription. */ +public final class AttestationsCreateOrUpdateAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateSubscriptionScope.json + */ + /** + * Sample code: Create attestation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .createOrUpdateAtSubscription( + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + new AttestationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withComplianceState(ComplianceState.COMPLIANT), + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateSubscriptionScope_AllProperties.json + */ + /** + * Sample code: Create attestation at subscription scope with all properties. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtSubscriptionScopeWithAllProperties( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .createOrUpdateAtSubscription( + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + new AttestationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("0b158b46-ff42-4799-8e39-08a5c23b4551") + .withComplianceState(ComplianceState.COMPLIANT) + .withExpiresOn(OffsetDateTime.parse("2021-06-15T00:00:00Z")) + .withOwner("55a32e28-3aa5-4eea-9b5a-4cd85153b966") + .withComments("This subscription has passed a security audit.") + .withEvidence( + Arrays + .asList( + new AttestationEvidence() + .withDescription("The results of the security audit.") + .withSourceUri( + "https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"))), + Context.NONE); + } +} +``` + +### Attestations_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations Delete. */ +public final class AttestationsDeleteSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_DeleteResourceGroupScope.json + */ + /** + * Sample code: Delete attestation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteAttestationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().deleteWithResponse("myRg", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} +``` + +### Attestations_DeleteAtResource + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations DeleteAtResource. */ +public final class AttestationsDeleteAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_DeleteResourceScope.json + */ + /** + * Sample code: Delete attestation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteAttestationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .deleteAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + Context.NONE); + } +} +``` + +### Attestations_DeleteAtSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations DeleteAtSubscription. */ +public final class AttestationsDeleteAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_DeleteSubscriptionScope.json + */ + /** + * Sample code: Delete attestation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteAttestationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().deleteAtSubscriptionWithResponse("790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} +``` + +### Attestations_GetAtResource + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations GetAtResource. */ +public final class AttestationsGetAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_GetResourceScope.json + */ + /** + * Sample code: Get attestation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getAttestationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .getAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + Context.NONE); + } +} +``` + +### Attestations_GetAtSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations GetAtSubscription. */ +public final class AttestationsGetAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_GetSubscriptionScope.json + */ + /** + * Sample code: Get attestation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getAttestationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().getAtSubscriptionWithResponse("790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} +``` + +### Attestations_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations GetByResourceGroup. */ +public final class AttestationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_GetResourceGroupScope.json + */ + /** + * Sample code: Get attestation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getAttestationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .getByResourceGroupWithResponse("myRg", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} +``` + +### Attestations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations List. */ +public final class AttestationsListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListSubscriptionScope.json + */ + /** + * Sample code: List attestations at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().list(null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListSubscriptionScope_WithQuery.json + */ + /** + * Sample code: List attestations at subscription scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtSubscriptionScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .list( + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'", + Context.NONE); + } +} +``` + +### Attestations_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations ListByResourceGroup. */ +public final class AttestationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceGroupScope_WithQuery.json + */ + /** + * Sample code: List attestations at resource group scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtResourceGroupScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .listByResourceGroup( + "myRg", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceGroupScope.json + */ + /** + * Sample code: List attestations at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().listByResourceGroup("myRg", null, null, Context.NONE); + } +} +``` + +### Attestations_ListForResource + +```java +import com.azure.core.util.Context; + +/** Samples for Attestations ListForResource. */ +public final class AttestationsListForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceScope_WithQuery.json + */ + /** + * Sample code: List attestations at individual resource scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtIndividualResourceScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceScope.json + */ + /** + * Sample code: List attestations at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + null, + null, + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_ListOperations.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listOperations(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.operations().listWithResponse(Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForManagementGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForManagementGroup. */ +public final class PolicyEventsListQueryResultsForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryManagementGroupScopeNextLink.json + */ + /** + * Sample code: Query at management group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForManagementGroup( + "myManagementGroup", null, null, null, null, null, null, null, "WpmWfBSvPhkAK6QD", Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryManagementGroupScope.json + */ + /** + * Sample code: Query at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForManagementGroup( + "myManagementGroup", null, null, null, null, null, null, null, null, Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForPolicyDefinition + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForPolicyDefinition. */ +public final class PolicyEventsListQueryResultsForPolicyDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyDefinitionScope.json + */ + /** + * Sample code: Query at subscription level policy definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicyDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyDefinitionScopeNextLink.json + */ + /** + * Sample code: Query at subscription level policy definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicyDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForPolicySetDefinition + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForPolicySetDefinition. */ +public final class PolicyEventsListQueryResultsForPolicySetDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicySetDefinitionScope.json + */ + /** + * Sample code: Query at subscription level policy set definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicySetDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicySetDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicySetDefinitionScopeNextLink.json + */ + /** + * Sample code: Query at subscription level policy set definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicySetDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicySetDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForResource + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForResource. */ +public final class PolicyEventsListQueryResultsForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelResourceScope.json + */ + /** + * Sample code: Query at subscription level resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResourceName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryNestedResourceScope.json + */ + /** + * Sample code: Query at nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApplication", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelNestedResourceScope.json + */ + /** + * Sample code: Query at subscription level nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResource/someNestedResourceType/someNestedResource", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScope.json + */ + /** + * Sample code: Query at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScope(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeExpandComponents.json + */ + /** + * Sample code: Query components policy events for resource scope filtered by given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryComponentsPolicyEventsForResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeExpandComponentsGroupByWithAggregate.json + */ + /** + * Sample code: Query components policy events count grouped by user and action type for resource scope filtered by + * given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void + queryComponentsPolicyEventsCountGroupedByUserAndActionTypeForResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components($apply=groupby((tenantId, principalOid, policyDefinitionAction), aggregate($count as" + + " totalActions)))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeNextLink.json + */ + /** + * Sample code: Query at resource scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForResourceGroup. */ +public final class PolicyEventsListQueryResultsForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupScope.json + */ + /** + * Sample code: Query at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroup( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupScopeNextLink.json + */ + /** + * Sample code: Query at resource group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroup( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForResourceGroupLevelPolicyAssignment. */ +public final class PolicyEventsListQueryResultsForResourceGroupLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query at resource group level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query at resource group level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForSubscription + +```java +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for PolicyEvents ListQueryResultsForSubscription. */ +public final class PolicyEventsListQueryResultsForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_TimeRangeSortSelectTop.json + */ + /** + * Sample code: Time range; sort, select and limit. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void timeRangeSortSelectAndLimit( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + "Timestamp desc, PolicyAssignmentId asc, SubscriptionId asc, ResourceGroup asc, ResourceId", + "Timestamp, PolicyAssignmentId, PolicyDefinitionId, SubscriptionId, ResourceGroup, ResourceId", + OffsetDateTime.parse("2018-02-05T18:00:00Z"), + OffsetDateTime.parse("2018-02-06T18:00:00Z"), + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndAggregateOnly.json + */ + /** + * Sample code: Filter and aggregate only. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndAggregateOnly(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + OffsetDateTime.parse("2018-02-05T18:00:00Z"), + null, + "PolicyDefinitionAction eq 'deny'", + "aggregate($count as NumDenyEvents)", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndGroupByWithoutAggregate.json + */ + /** + * Sample code: Filter and group without aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithoutAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + null, + null, + OffsetDateTime.parse("2018-01-05T18:00:00Z"), + null, + "PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append'", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionScopeNextLink.json + */ + /** + * Sample code: Query at subscription scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndMultipleGroups.json + */ + /** + * Sample code: Filter and multiple groups. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndMultipleGroups(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 10, + "NumDeniedResources desc", + null, + OffsetDateTime.parse("2018-01-01T00:00:00Z"), + null, + "PolicyDefinitionAction eq 'deny'", + "groupby((PolicyAssignmentId, PolicyDefinitionId, ResourceId))/groupby((PolicyAssignmentId," + + " PolicyDefinitionId), aggregate($count as NumDeniedResources))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndGroupByWithAggregate.json + */ + /** + * Sample code: Filter and group with aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + null, + null, + OffsetDateTime.parse("2018-02-05T18:00:00Z"), + null, + "PolicyDefinitionAction eq 'audit' or PolicyDefinitionAction eq 'deny'", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId)," + + " aggregate($count as NumEvents))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionScope.json + */ + /** + * Sample code: Query at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", null, null, null, null, null, null, null, null, Context.NONE); + } +} +``` + +### PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForSubscriptionLevelPolicyAssignment. */ +public final class PolicyEventsListQueryResultsForSubscriptionLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query at subscription level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query at subscription level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyMetadata_GetResource + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyMetadata GetResource. */ +public final class PolicyMetadataGetResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_GetResource.json + */ + /** + * Sample code: Get a single policy metadata resource. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getASinglePolicyMetadataResource( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyMetadatas().getResourceWithResponse("NIST_SP_800-53_R4_AC-2", Context.NONE); + } +} +``` + +### PolicyMetadata_List + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyMetadata List. */ +public final class PolicyMetadataListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List.json + */ + /** + * Sample code: Get collection of policy metadata resources. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getCollectionOfPolicyMetadataResources( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyMetadatas().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List_WithTop.json + */ + /** + * Sample code: Get collection of policy metadata resources using top query parameter. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getCollectionOfPolicyMetadataResourcesUsingTopQueryParameter( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyMetadatas().list(1, Context.NONE); + } +} +``` + +### PolicyRestrictions_CheckAtResourceGroupScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsRequest; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResourceDetails; +import com.azure.resourcemanager.policyinsights.models.PendingField; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for PolicyRestrictions CheckAtResourceGroupScope. */ +public final class PolicyRestrictionsCheckAtResourceGroupScopeSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2020-07-01/examples/PolicyRestrictions_CheckAtResourceGroupScope.json + */ + /** + * Sample code: Check policy restrictions at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void checkPolicyRestrictionsAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) throws IOException { + manager + .policyRestrictions() + .checkAtResourceGroupScopeWithResponse( + "vmRg", + new CheckRestrictionsRequest() + .withResourceDetails( + new CheckRestrictionsResourceDetails() + .withResourceContent( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"type\":\"Microsoft.Compute/virtualMachines\",\"properties\":{\"priority\":\"Spot\"}}", + Object.class, + SerializerEncoding.JSON)) + .withApiVersion("2019-12-01")) + .withPendingFields( + Arrays + .asList( + new PendingField().withField("name").withValues(Arrays.asList("myVMName")), + new PendingField() + .withField("location") + .withValues(Arrays.asList("eastus", "westus", "westus2", "westeurope")), + new PendingField().withField("tags"))), + Context.NONE); + } +} +``` + +### PolicyRestrictions_CheckAtSubscriptionScope + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsRequest; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResourceDetails; +import com.azure.resourcemanager.policyinsights.models.PendingField; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for PolicyRestrictions CheckAtSubscriptionScope. */ +public final class PolicyRestrictionsCheckAtSubscriptionScopeSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2020-07-01/examples/PolicyRestrictions_CheckAtSubscriptionScope.json + */ + /** + * Sample code: Check policy restrictions at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void checkPolicyRestrictionsAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) throws IOException { + manager + .policyRestrictions() + .checkAtSubscriptionScopeWithResponse( + new CheckRestrictionsRequest() + .withResourceDetails( + new CheckRestrictionsResourceDetails() + .withResourceContent( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"type\":\"Microsoft.Compute/virtualMachines\",\"properties\":{\"priority\":\"Spot\"}}", + Object.class, + SerializerEncoding.JSON)) + .withApiVersion("2019-12-01")) + .withPendingFields( + Arrays + .asList( + new PendingField().withField("name").withValues(Arrays.asList("myVMName")), + new PendingField() + .withField("location") + .withValues(Arrays.asList("eastus", "westus", "westus2", "westeurope")), + new PendingField().withField("tags"))), + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForManagementGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForManagementGroup. */ +public final class PolicyStatesListQueryResultsForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryManagementGroupScope.json + */ + /** + * Sample code: Query latest at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForManagementGroup( + PolicyStatesResource.LATEST, + "myManagementGroup", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryManagementGroupScopeNextLink.json + */ + /** + * Sample code: Query latest at management group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtManagementGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForManagementGroup( + PolicyStatesResource.LATEST, + "myManagementGroup", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForPolicyDefinition + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForPolicyDefinition. */ +public final class PolicyStatesListQueryResultsForPolicyDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyDefinitionScope.json + */ + /** + * Sample code: Query latest at subscription level policy definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicyDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyDefinitionScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription level policy definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicyDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForPolicySetDefinition + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForPolicySetDefinition. */ +public final class PolicyStatesListQueryResultsForPolicySetDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicySetDefinitionScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription level policy set definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicySetDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicySetDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicySetDefinitionScope.json + */ + /** + * Sample code: Query latest at subscription level policy set definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicySetDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicySetDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForResource + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForResource. */ +public final class PolicyStatesListQueryResultsForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandPolicyEvaluationDetails.json + */ + /** + * Sample code: Query all policy states at resource scope and expand policyEvaluationDetails. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtResourceScopeAndExpandPolicyEvaluationDetails( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.LATEST, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + "PolicyEvaluationDetails", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeNextLink.json + */ + /** + * Sample code: Query all policy states at resource scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtResourceScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelNestedResourceScope.json + */ + /** + * Sample code: Query all policy states at subscription level nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtSubscriptionLevelNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResource/someNestedResourceType/someNestedResource", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandComponents.json + */ + /** + * Sample code: Query component policy compliance state at resource scope filtered by given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryComponentPolicyComplianceStateAtResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.LATEST, + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components($filter=ComplianceState eq 'NonCompliant' or ComplianceState eq 'Compliant')", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandComponentsGroupByWithAggregate.json + */ + /** + * Sample code: Query component policy compliance state count grouped by state type at resource scope filtered by + * given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void + queryComponentPolicyComplianceStateCountGroupedByStateTypeAtResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.LATEST, + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components($filter=ComplianceState eq 'NonCompliant' or ComplianceState eq" + + " 'Compliant';$apply=groupby((complianceState),aggregate($count as count)))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelResourceScope.json + */ + /** + * Sample code: Query all policy states at subscription level resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtSubscriptionLevelResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResourceName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScope.json + */ + /** + * Sample code: Query all policy states at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryNestedResourceScope.json + */ + /** + * Sample code: Query all policy states at nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApplication", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForResourceGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForResourceGroup. */ +public final class PolicyStatesListQueryResultsForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupScopeNextLink.json + */ + /** + * Sample code: Query latest at resource group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroup( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupScope.json + */ + /** + * Sample code: Query latest at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroup( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForResourceGroupLevelPolicyAssignment. */ +public final class PolicyStatesListQueryResultsForResourceGroupLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query latest at resource group level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query latest at resource group level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForSubscription + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; +import java.time.OffsetDateTime; + +/** Samples for PolicyStates ListQueryResultsForSubscription. */ +public final class PolicyStatesListQueryResultsForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionScope.json + */ + /** + * Sample code: Query latest at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TimeRangeSortSelectTop.json + */ + /** + * Sample code: Time range; sort, select and limit. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void timeRangeSortSelectAndLimit( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + "Timestamp desc, PolicyAssignmentId asc, SubscriptionId asc, ResourceGroup asc, ResourceId", + "Timestamp, PolicyAssignmentId, PolicyDefinitionId, SubscriptionId, ResourceGroup, ResourceId," + + " policyDefinitionGroupNames", + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + OffsetDateTime.parse("2019-10-06T18:00:00Z"), + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndAggregateOnly.json + */ + /** + * Sample code: Filter and aggregate only. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndAggregateOnly(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + null, + "PolicyDefinitionAction eq 'deny'", + "aggregate($count as NumDenyStates)", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndGroupByWithoutAggregate.json + */ + /** + * Sample code: Filter and group without aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithoutAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + null, + null, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + null, + "IsCompliant eq false and (PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append')", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndMultipleGroups.json + */ + /** + * Sample code: Filter and multiple groups. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndMultipleGroups(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 10, + "NumNonCompliantResources desc", + null, + null, + null, + "IsCompliant eq false", + "groupby((PolicyAssignmentId, PolicySetDefinitionId, PolicyDefinitionId, PolicyDefinitionReferenceId," + + " ResourceId))/groupby((PolicyAssignmentId, PolicySetDefinitionId, PolicyDefinitionId," + + " PolicyDefinitionReferenceId), aggregate($count as NumNonCompliantResources))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndGroupByWithAggregate.json + */ + /** + * Sample code: Filter and group with aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + "NumAuditDenyNonComplianceRecords desc", + null, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + null, + "IsCompliant eq false and (PolicyDefinitionAction eq 'audit' or PolicyDefinitionAction eq 'deny')", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId)," + + " aggregate($count as NumAuditDenyNonComplianceRecords))", + null, + Context.NONE); + } +} +``` + +### PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForSubscriptionLevelPolicyAssignment. */ +public final class PolicyStatesListQueryResultsForSubscriptionLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query latest at subscription level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForManagementGroup + +```java +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for PolicyStates SummarizeForManagementGroup. */ +public final class PolicyStatesSummarizeForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeManagementGroupScope.json + */ + /** + * Sample code: Summarize at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForManagementGroupWithResponse( + "myManagementGroup", + 0, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + OffsetDateTime.parse("2019-10-06T18:00:00Z"), + "PolicyDefinitionAction eq 'deny' or PolicyDefinitionAction eq 'audit'", + Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForPolicyDefinition + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForPolicyDefinition. */ +public final class PolicyStatesSummarizeForPolicyDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicyDefinitionScope.json + */ + /** + * Sample code: Summarize at policy definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicyDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForPolicyDefinitionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForPolicySetDefinition + +```java +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for PolicyStates SummarizeForPolicySetDefinition. */ +public final class PolicyStatesSummarizeForPolicySetDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicySetDefinitionScope.json + */ + /** + * Sample code: Summarize at policy set definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicySetDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForPolicySetDefinitionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + 1, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + OffsetDateTime.parse("2019-10-06T18:00:00Z"), + "PolicyDefinitionAction eq 'deny'", + Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForResource + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForResource. */ +public final class PolicyStatesSummarizeForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceScope.json + */ + /** + * Sample code: Summarize at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForResourceWithResponse( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/my-vault", + 2, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForResourceGroup. */ +public final class PolicyStatesSummarizeForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceGroupScope.json + */ + /** + * Sample code: Summarize at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForResourceGroupWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", null, null, null, null, Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForResourceGroupLevelPolicyAssignment. */ +public final class PolicyStatesSummarizeForResourceGroupLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceGroupLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Summarize at policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForResourceGroupLevelPolicyAssignmentWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "b7a1ca2596524e3ab19597f2", + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForSubscription. */ +public final class PolicyStatesSummarizeForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionScopeForPolicyGroup.json + */ + /** + * Sample code: Summarize at subscription scope for a policy definition group. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtSubscriptionScopeForAPolicyDefinitionGroup( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForSubscriptionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 1, + null, + null, + "'group1' IN PolicyDefinitionGroupNames", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionScope.json + */ + /** + * Sample code: Summarize at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForSubscriptionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", 5, null, null, null, Context.NONE); + } +} +``` + +### PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForSubscriptionLevelPolicyAssignment. */ +public final class PolicyStatesSummarizeForSubscriptionLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Summarize at policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForSubscriptionLevelPolicyAssignmentWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### PolicyStates_TriggerResourceGroupEvaluation + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates TriggerResourceGroupEvaluation. */ +public final class PolicyStatesTriggerResourceGroupEvaluationSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TriggerResourceGroupEvaluation.json + */ + /** + * Sample code: Trigger evaluations for all resources in a resource group. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void triggerEvaluationsForAllResourcesInAResourceGroup( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .triggerResourceGroupEvaluation("fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", Context.NONE); + } +} +``` + +### PolicyStates_TriggerSubscriptionEvaluation + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyStates TriggerSubscriptionEvaluation. */ +public final class PolicyStatesTriggerSubscriptionEvaluationSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TriggerSubscriptionEvaluation.json + */ + /** + * Sample code: Trigger evaluations for all resources in a subscription. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void triggerEvaluationsForAllResourcesInASubscription( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyStates().triggerSubscriptionEvaluation("fffedd8f-ffff-fffd-fffd-fffed2f84852", Context.NONE); + } +} +``` + +### PolicyTrackedResources_ListQueryResultsForManagementGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForManagementGroup. */ +public final class PolicyTrackedResourcesListQueryResultsForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryManagementGroupScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at management group scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForManagementGroup( + "myManagementGroup", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryManagementGroupScope.json + */ + /** + * Sample code: Query at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForManagementGroup("myManagementGroup", null, null, Context.NONE); + } +} +``` + +### PolicyTrackedResources_ListQueryResultsForResource + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForResource. */ +public final class PolicyTrackedResourcesListQueryResultsForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at resource scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForResource( + "subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceScope.json + */ + /** + * Sample code: Query at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScope(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForResource( + "subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource", + null, + null, + Context.NONE); + } +} +``` + +### PolicyTrackedResources_ListQueryResultsForResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForResourceGroup. */ +public final class PolicyTrackedResourcesListQueryResultsForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceGroupScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at resource group scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForResourceGroup( + "myResourceGroup", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceGroupScope.json + */ + /** + * Sample code: Query at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyTrackedResources().listQueryResultsForResourceGroup("myResourceGroup", null, null, Context.NONE); + } +} +``` + +### PolicyTrackedResources_ListQueryResultsForSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForSubscription. */ +public final class PolicyTrackedResourcesListQueryResultsForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QuerySubscriptionScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at subscription scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForSubscription( + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QuerySubscriptionScope.json + */ + /** + * Sample code: Query at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyTrackedResources().listQueryResultsForSubscription(null, null, Context.NONE); + } +} +``` + +### Remediations_CancelAtManagementGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtManagementGroup. */ +public final class RemediationsCancelAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelManagementGroupScope.json + */ + /** + * Sample code: Cancel a remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().cancelAtManagementGroupWithResponse("financeMg", "myRemediation", Context.NONE); + } +} +``` + +### Remediations_CancelAtResource + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtResource. */ +public final class RemediationsCancelAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelResourceScope.json + */ + /** + * Sample code: Cancel a remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .cancelAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "myRemediation", + Context.NONE); + } +} +``` + +### Remediations_CancelAtResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtResourceGroup. */ +public final class RemediationsCancelAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelResourceGroupScope.json + */ + /** + * Sample code: Cancel a remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().cancelAtResourceGroupWithResponse("myResourceGroup", "myRemediation", Context.NONE); + } +} +``` + +### Remediations_CancelAtSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtSubscription. */ +public final class RemediationsCancelAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelSubscriptionScope.json + */ + /** + * Sample code: Cancel a remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().cancelAtSubscriptionWithResponse("myRemediation", Context.NONE); + } +} +``` + +### Remediations_CreateOrUpdateAtManagementGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; + +/** Samples for Remediations CreateOrUpdateAtManagementGroup. */ +public final class RemediationsCreateOrUpdateAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateManagementGroupScope.json + */ + /** + * Sample code: Create remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtManagementGroupWithResponse( + "financeMg", + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/providers/microsoft.management/managementGroups/financeMg/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"), + Context.NONE); + } +} +``` + +### Remediations_CreateOrUpdateAtResource + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; + +/** Samples for Remediations CreateOrUpdateAtResource. */ +public final class RemediationsCreateOrUpdateAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateResourceScope.json + */ + /** + * Sample code: Create remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"), + Context.NONE); + } +} +``` + +### Remediations_CreateOrUpdateAtResourceGroup + +```java +/** Samples for Remediations CreateOrUpdateAtResourceGroup. */ +public final class RemediationsCreateOrUpdateAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateResourceGroupScope.json + */ + /** + * Sample code: Create remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .define("storageRemediation") + .withExistingResourceGroup("myResourceGroup") + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .create(); + } +} +``` + +### Remediations_CreateOrUpdateAtSubscription + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; +import com.azure.resourcemanager.policyinsights.models.RemediationFilters; +import com.azure.resourcemanager.policyinsights.models.RemediationPropertiesFailureThreshold; +import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode; +import java.util.Arrays; + +/** Samples for Remediations CreateOrUpdateAtSubscription. */ +public final class RemediationsCreateOrUpdateAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateSubscriptionScope.json + */ + /** + * Sample code: Create remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtSubscriptionWithResponse( + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateSubscriptionScope_AllProperties.json + */ + /** + * Sample code: Create remediation at subscription scope with all properties. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtSubscriptionScopeWithAllProperties( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtSubscriptionWithResponse( + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("8c8fa9e4") + .withResourceDiscoveryMode(ResourceDiscoveryMode.RE_EVALUATE_COMPLIANCE) + .withFilters(new RemediationFilters().withLocations(Arrays.asList("eastus", "westus"))) + .withResourceCount(42) + .withParallelDeployments(6) + .withFailureThreshold(new RemediationPropertiesFailureThreshold().withPercentage(0.1f)), + Context.NONE); + } +} +``` + +### Remediations_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations Delete. */ +public final class RemediationsDeleteSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteResourceGroupScope.json + */ + /** + * Sample code: Delete remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().deleteWithResponse("myResourceGroup", "storageRemediation", Context.NONE); + } +} +``` + +### Remediations_DeleteAtManagementGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations DeleteAtManagementGroup. */ +public final class RemediationsDeleteAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteManagementGroupScope.json + */ + /** + * Sample code: Delete remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().deleteAtManagementGroupWithResponse("financeMg", "storageRemediation", Context.NONE); + } +} +``` + +### Remediations_DeleteAtResource + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations DeleteAtResource. */ +public final class RemediationsDeleteAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteResourceScope.json + */ + /** + * Sample code: Delete remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .deleteAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "storageRemediation", + Context.NONE); + } +} +``` + +### Remediations_DeleteAtSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations DeleteAtSubscription. */ +public final class RemediationsDeleteAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteSubscriptionScope.json + */ + /** + * Sample code: Delete remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().deleteAtSubscriptionWithResponse("storageRemediation", Context.NONE); + } +} +``` + +### Remediations_GetAtManagementGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations GetAtManagementGroup. */ +public final class RemediationsGetAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetManagementGroupScope.json + */ + /** + * Sample code: Get remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().getAtManagementGroupWithResponse("financeMg", "storageRemediation", Context.NONE); + } +} +``` + +### Remediations_GetAtResource + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations GetAtResource. */ +public final class RemediationsGetAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetResourceScope.json + */ + /** + * Sample code: Get remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .getAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "storageRemediation", + Context.NONE); + } +} +``` + +### Remediations_GetAtSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations GetAtSubscription. */ +public final class RemediationsGetAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetSubscriptionScope.json + */ + /** + * Sample code: Get remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().getAtSubscriptionWithResponse("storageRemediation", Context.NONE); + } +} +``` + +### Remediations_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations GetByResourceGroup. */ +public final class RemediationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetResourceGroupScope.json + */ + /** + * Sample code: Get remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().getByResourceGroupWithResponse("myResourceGroup", "storageRemediation", Context.NONE); + } +} +``` + +### Remediations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations List. */ +public final class RemediationsListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope_WithQuery.json + */ + /** + * Sample code: List remediations at subscription scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtSubscriptionScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .list( + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq 'storageSkuDef'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope.json + */ + /** + * Sample code: List remediations at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().list(null, null, Context.NONE); + } +} +``` + +### Remediations_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations ListByResourceGroup. */ +public final class RemediationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceGroupScope_WithQuery.json + */ + /** + * Sample code: List remediations at resource group scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtResourceGroupScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listByResourceGroup( + "myResourceGroup", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceGroupScope.json + */ + /** + * Sample code: List remediations at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listByResourceGroup("myResourceGroup", null, null, Context.NONE); + } +} +``` + +### Remediations_ListDeploymentsAtManagementGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtManagementGroup. */ +public final class RemediationsListDeploymentsAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsManagementGroupScope.json + */ + /** + * Sample code: List deployments for a remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listDeploymentsAtManagementGroup("financeMg", "myRemediation", null, Context.NONE); + } +} +``` + +### Remediations_ListDeploymentsAtResource + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtResource. */ +public final class RemediationsListDeploymentsAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceScope.json + */ + /** + * Sample code: List deployments for a remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listDeploymentsAtResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "myRemediation", + null, + Context.NONE); + } +} +``` + +### Remediations_ListDeploymentsAtResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtResourceGroup. */ +public final class RemediationsListDeploymentsAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceGroupScope.json + */ + /** + * Sample code: List deployments for a remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listDeploymentsAtResourceGroup("myResourceGroup", "myRemediation", null, Context.NONE); + } +} +``` + +### Remediations_ListDeploymentsAtSubscription + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtSubscription. */ +public final class RemediationsListDeploymentsAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsSubscriptionScope.json + */ + /** + * Sample code: List deployments for a remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listDeploymentsAtSubscription("myRemediation", null, Context.NONE); + } +} +``` + +### Remediations_ListForManagementGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations ListForManagementGroup. */ +public final class RemediationsListForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListManagementGroupScope.json + */ + /** + * Sample code: List remediations at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listForManagementGroup("financeMg", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListManagementGroupScope_WithQuery.json + */ + /** + * Sample code: List remediations at management group scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtManagementGroupScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listForManagementGroup( + "financeMg", + 1, + "PolicyAssignmentId eq" + + " '/providers/microsoft.management/managementGroups/financeMg/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'", + Context.NONE); + } +} +``` + +### Remediations_ListForResource + +```java +import com.azure.core.util.Context; + +/** Samples for Remediations ListForResource. */ +public final class RemediationsListForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceScope.json + */ + /** + * Sample code: List remediations at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceScope_WithQuery.json + */ + /** + * Sample code: List remediations at individual resource scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtIndividualResourceScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'", + Context.NONE); + } +} +``` + diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml index 568651e26080f..0385065e9080f 100644 --- a/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/pom.xml @@ -1,67 +1,86 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 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.2 - jar + com.azure.resourcemanager + azure-resourcemanager-policyinsights + 1.0.0-beta.2 + jar - Microsoft Azure SDK for PolicyInsights Management - This package contains Microsoft Azure SDK for PolicyInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-01. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for PolicyInsights Management + This package contains Microsoft Azure SDK for PolicyInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-10. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + 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 - 1.21.0 - - - com.azure - azure-core-management - 1.4.2 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - true - - - - + + 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 + 1.21.0 + + + com.azure + azure-core-management + 1.4.2 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + 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 index 07fc8feee1c5e..fd85dc19d5e00 100644 --- 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 @@ -9,7 +9,6 @@ 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; @@ -17,6 +16,7 @@ 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.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -105,6 +105,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -144,6 +145,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -200,6 +212,9 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } @@ -209,10 +224,7 @@ public PolicyInsightsManager authenticate(TokenCredential credential, AzureProfi HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); 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 index 7529938c55f96..27762cb0732b6 100644 --- 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 @@ -49,7 +49,7 @@ public interface AttestationsClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( String attestationName, AttestationInner parameters); @@ -64,7 +64,7 @@ SyncPoller, AttestationInner> beginCreateOrUpdateAt * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( String attestationName, AttestationInner parameters, Context context); @@ -183,7 +183,7 @@ PagedIterable listByResourceGroup( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( String resourceGroupName, String attestationName, AttestationInner parameters); @@ -199,7 +199,7 @@ SyncPoller, AttestationInner> beginCreateOrUpdateAt * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( String resourceGroupName, String attestationName, AttestationInner parameters, Context context); @@ -326,7 +326,7 @@ Response getByResourceGroupWithResponse( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( String resourceId, String attestationName, AttestationInner parameters); @@ -342,7 +342,7 @@ SyncPoller, AttestationInner> beginCreateOrUpdateAt * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( String resourceId, String attestationName, AttestationInner 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 index 9d59dc2cca762..174231c66d889 100644 --- 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 @@ -389,7 +389,7 @@ Response summarizeForResourceWithResponse( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginTriggerSubscriptionEvaluation(String subscriptionId); /** @@ -402,7 +402,7 @@ Response summarizeForResourceWithResponse( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginTriggerSubscriptionEvaluation(String subscriptionId, Context context); /** @@ -438,7 +438,7 @@ Response summarizeForResourceWithResponse( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginTriggerResourceGroupEvaluation( String subscriptionId, String resourceGroupName); @@ -453,7 +453,7 @@ SyncPoller, Void> beginTriggerResourceGroupEvaluation( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginTriggerResourceGroupEvaluation( String subscriptionId, String resourceGroupName, 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 index 9b1f6381fea26..a449e250c40f0 100644 --- 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 @@ -5,7 +5,6 @@ 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.management.SystemData; import com.azure.core.util.logging.ClientLogger; @@ -17,11 +16,16 @@ import java.util.List; /** An attestation resource. */ -@JsonFlatten @Fluent -public class AttestationInner extends ProxyResource { +public final class AttestationInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationInner.class); + /* + * Properties for the attestation. + */ + @JsonProperty(value = "properties", required = true) + private AttestationProperties innerProperties = new AttestationProperties(); + /* * Azure Resource Manager metadata containing createdBy and modifiedBy * information. @@ -29,65 +33,14 @@ public class AttestationInner extends ProxyResource { @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. + /** + * Get the innerProperties property: Properties for the attestation. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.lastComplianceStateChangeAt", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime lastComplianceStateChangeAt; + private AttestationProperties innerProperties() { + return this.innerProperties; + } /** * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -105,7 +58,7 @@ public SystemData systemData() { * @return the policyAssignmentId value. */ public String policyAssignmentId() { - return this.policyAssignmentId; + return this.innerProperties() == null ? null : this.innerProperties().policyAssignmentId(); } /** @@ -116,7 +69,10 @@ public String policyAssignmentId() { * @return the AttestationInner object itself. */ public AttestationInner withPolicyAssignmentId(String policyAssignmentId) { - this.policyAssignmentId = policyAssignmentId; + if (this.innerProperties() == null) { + this.innerProperties = new AttestationProperties(); + } + this.innerProperties().withPolicyAssignmentId(policyAssignmentId); return this; } @@ -129,7 +85,7 @@ public AttestationInner withPolicyAssignmentId(String policyAssignmentId) { * @return the policyDefinitionReferenceId value. */ public String policyDefinitionReferenceId() { - return this.policyDefinitionReferenceId; + return this.innerProperties() == null ? null : this.innerProperties().policyDefinitionReferenceId(); } /** @@ -142,7 +98,10 @@ public String policyDefinitionReferenceId() { * @return the AttestationInner object itself. */ public AttestationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { - this.policyDefinitionReferenceId = policyDefinitionReferenceId; + if (this.innerProperties() == null) { + this.innerProperties = new AttestationProperties(); + } + this.innerProperties().withPolicyDefinitionReferenceId(policyDefinitionReferenceId); return this; } @@ -152,7 +111,7 @@ public AttestationInner withPolicyDefinitionReferenceId(String policyDefinitionR * @return the complianceState value. */ public ComplianceState complianceState() { - return this.complianceState; + return this.innerProperties() == null ? null : this.innerProperties().complianceState(); } /** @@ -162,7 +121,10 @@ public ComplianceState complianceState() { * @return the AttestationInner object itself. */ public AttestationInner withComplianceState(ComplianceState complianceState) { - this.complianceState = complianceState; + if (this.innerProperties() == null) { + this.innerProperties = new AttestationProperties(); + } + this.innerProperties().withComplianceState(complianceState); return this; } @@ -172,7 +134,7 @@ public AttestationInner withComplianceState(ComplianceState complianceState) { * @return the expiresOn value. */ public OffsetDateTime expiresOn() { - return this.expiresOn; + return this.innerProperties() == null ? null : this.innerProperties().expiresOn(); } /** @@ -182,7 +144,10 @@ public OffsetDateTime expiresOn() { * @return the AttestationInner object itself. */ public AttestationInner withExpiresOn(OffsetDateTime expiresOn) { - this.expiresOn = expiresOn; + if (this.innerProperties() == null) { + this.innerProperties = new AttestationProperties(); + } + this.innerProperties().withExpiresOn(expiresOn); return this; } @@ -193,7 +158,7 @@ public AttestationInner withExpiresOn(OffsetDateTime expiresOn) { * @return the owner value. */ public String owner() { - return this.owner; + return this.innerProperties() == null ? null : this.innerProperties().owner(); } /** @@ -204,7 +169,10 @@ public String owner() { * @return the AttestationInner object itself. */ public AttestationInner withOwner(String owner) { - this.owner = owner; + if (this.innerProperties() == null) { + this.innerProperties = new AttestationProperties(); + } + this.innerProperties().withOwner(owner); return this; } @@ -214,7 +182,7 @@ public AttestationInner withOwner(String owner) { * @return the comments value. */ public String comments() { - return this.comments; + return this.innerProperties() == null ? null : this.innerProperties().comments(); } /** @@ -224,7 +192,10 @@ public String comments() { * @return the AttestationInner object itself. */ public AttestationInner withComments(String comments) { - this.comments = comments; + if (this.innerProperties() == null) { + this.innerProperties = new AttestationProperties(); + } + this.innerProperties().withComments(comments); return this; } @@ -234,7 +205,7 @@ public AttestationInner withComments(String comments) { * @return the evidence value. */ public List evidence() { - return this.evidence; + return this.innerProperties() == null ? null : this.innerProperties().evidence(); } /** @@ -244,7 +215,10 @@ public List evidence() { * @return the AttestationInner object itself. */ public AttestationInner withEvidence(List evidence) { - this.evidence = evidence; + if (this.innerProperties() == null) { + this.innerProperties = new AttestationProperties(); + } + this.innerProperties().withEvidence(evidence); return this; } @@ -254,7 +228,7 @@ public AttestationInner withEvidence(List evidence) { * @return the provisioningState value. */ public String provisioningState() { - return this.provisioningState; + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } /** @@ -263,7 +237,7 @@ public String provisioningState() { * @return the lastComplianceStateChangeAt value. */ public OffsetDateTime lastComplianceStateChangeAt() { - return this.lastComplianceStateChangeAt; + return this.innerProperties() == null ? null : this.innerProperties().lastComplianceStateChangeAt(); } /** @@ -272,14 +246,13 @@ public OffsetDateTime lastComplianceStateChangeAt() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (policyAssignmentId() == null) { + if (innerProperties() == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - "Missing required property policyAssignmentId in model AttestationInner")); - } - if (evidence() != null) { - evidence().forEach(e -> e.validate()); + "Missing required property innerProperties in model AttestationInner")); + } else { + innerProperties().validate(); } } } diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/AttestationProperties.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/AttestationProperties.java new file mode 100644 index 0000000000000..d5cef83d128d8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/AttestationProperties.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of an attestation resource. */ +@Fluent +public final class AttestationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationProperties.class); + + /* + * The resource ID of the policy assignment that the attestation is setting + * the state for. + */ + @JsonProperty(value = "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 = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /* + * The compliance state that should be set on the resource. + */ + @JsonProperty(value = "complianceState") + private ComplianceState complianceState; + + /* + * The time the compliance state should expire. + */ + @JsonProperty(value = "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 = "owner") + private String owner; + + /* + * Comments describing why this attestation was created. + */ + @JsonProperty(value = "comments") + private String comments; + + /* + * The evidence supporting the compliance state set in this attestation. + */ + @JsonProperty(value = "evidence") + private List evidence; + + /* + * The status of the attestation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The time the compliance state was last changed in this attestation. + */ + @JsonProperty(value = "lastComplianceStateChangeAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastComplianceStateChangeAt; + + /** + * 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 AttestationProperties object itself. + */ + public AttestationProperties 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 AttestationProperties object itself. + */ + public AttestationProperties 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 AttestationProperties object itself. + */ + public AttestationProperties 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 AttestationProperties object itself. + */ + public AttestationProperties 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 AttestationProperties object itself. + */ + public AttestationProperties 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 AttestationProperties object itself. + */ + public AttestationProperties 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 AttestationProperties object itself. + */ + public AttestationProperties 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 (policyAssignmentId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property policyAssignmentId in model AttestationProperties")); + } + 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/PolicyMetadataInner.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyMetadataInner.java index 1859e8a80795f..a98066f53746c 100644 --- 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 @@ -4,18 +4,22 @@ package com.azure.resourcemanager.policyinsights.fluent.models; -import com.azure.core.annotation.Immutable; -import com.azure.core.annotation.JsonFlatten; +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 metadata resource definition. */ -@JsonFlatten -@Immutable -public class PolicyMetadataInner { +@Fluent +public final class PolicyMetadataInner { @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyMetadataInner.class); + /* + * Properties of the policy metadata. + */ + @JsonProperty(value = "properties") + private PolicyMetadataProperties innerProperties; + /* * The ID of the policy metadata. */ @@ -34,53 +38,14 @@ public class PolicyMetadataInner { @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. + /** + * Get the innerProperties property: Properties of the policy metadata. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.requirements", access = JsonProperty.Access.WRITE_ONLY) - private String requirements; + private PolicyMetadataProperties innerProperties() { + return this.innerProperties; + } /** * Get the id property: The ID of the policy metadata. @@ -109,13 +74,31 @@ public String name() { return this.name; } + /** + * Get the description property: The description of the policy metadata. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the requirements property: The requirements of the policy metadata. + * + * @return the requirements value. + */ + public String requirements() { + return this.innerProperties() == null ? null : this.innerProperties().requirements(); + } + /** * Get the metadataId property: The policy metadata identifier. * * @return the metadataId value. */ public String metadataId() { - return this.metadataId; + return this.innerProperties() == null ? null : this.innerProperties().metadataId(); } /** @@ -124,7 +107,7 @@ public String metadataId() { * @return the category value. */ public String category() { - return this.category; + return this.innerProperties() == null ? null : this.innerProperties().category(); } /** @@ -133,7 +116,7 @@ public String category() { * @return the title value. */ public String title() { - return this.title; + return this.innerProperties() == null ? null : this.innerProperties().title(); } /** @@ -142,7 +125,7 @@ public String title() { * @return the owner value. */ public String owner() { - return this.owner; + return this.innerProperties() == null ? null : this.innerProperties().owner(); } /** @@ -151,7 +134,7 @@ public String owner() { * @return the additionalContentUrl value. */ public String additionalContentUrl() { - return this.additionalContentUrl; + return this.innerProperties() == null ? null : this.innerProperties().additionalContentUrl(); } /** @@ -160,25 +143,7 @@ public String additionalContentUrl() { * @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; + return this.innerProperties() == null ? null : this.innerProperties().metadata(); } /** @@ -187,5 +152,8 @@ public String requirements() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (innerProperties() != null) { + innerProperties().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/fluent/models/PolicyMetadataProperties.java similarity index 96% rename from sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataProperties.java rename to sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyMetadataProperties.java index def777eb665fe..0f2769e9e4c44 100644 --- 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/fluent/models/PolicyMetadataProperties.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.policyinsights.models; +package com.azure.resourcemanager.policyinsights.fluent.models; import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; 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/fluent/models/PolicyMetadataSlimProperties.java similarity index 97% rename from sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyMetadataSlimProperties.java rename to sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/PolicyMetadataSlimProperties.java index 3198793a57edd..b493ad2333d04 100644 --- 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/fluent/models/PolicyMetadataSlimProperties.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.policyinsights.models; +package com.azure.resourcemanager.policyinsights.fluent.models; import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; 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 index 94d55a1a361db..597536a1d097d 100644 --- 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 @@ -5,74 +5,52 @@ 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.management.SystemData; 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.RemediationPropertiesFailureThreshold; 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 { +public final class RemediationInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationInner.class); /* - * The resource ID of the policy assignment that should be remediated. + * Properties for the remediation. */ - @JsonProperty(value = "properties.policyAssignmentId") - private String policyAssignmentId; + @JsonProperty(value = "properties") + private RemediationProperties innerProperties; /* - * 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. + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. */ - @JsonProperty(value = "properties.policyDefinitionReferenceId") - private String policyDefinitionReferenceId; + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; - /* - * 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. + /** + * Get the innerProperties property: Properties for the remediation. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.filters") - private RemediationFilters filters; + private RemediationProperties innerProperties() { + return this.innerProperties; + } - /* - * The deployment status summary for all deployments created by the - * remediation. + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. */ - @JsonProperty(value = "properties.deploymentStatus", access = JsonProperty.Access.WRITE_ONLY) - private RemediationDeploymentSummary deploymentStatus; + public SystemData systemData() { + return this.systemData; + } /** * Get the policyAssignmentId property: The resource ID of the policy assignment that should be remediated. @@ -80,7 +58,7 @@ public class RemediationInner extends ProxyResource { * @return the policyAssignmentId value. */ public String policyAssignmentId() { - return this.policyAssignmentId; + return this.innerProperties() == null ? null : this.innerProperties().policyAssignmentId(); } /** @@ -90,7 +68,10 @@ public String policyAssignmentId() { * @return the RemediationInner object itself. */ public RemediationInner withPolicyAssignmentId(String policyAssignmentId) { - this.policyAssignmentId = policyAssignmentId; + if (this.innerProperties() == null) { + this.innerProperties = new RemediationProperties(); + } + this.innerProperties().withPolicyAssignmentId(policyAssignmentId); return this; } @@ -101,7 +82,7 @@ public RemediationInner withPolicyAssignmentId(String policyAssignmentId) { * @return the policyDefinitionReferenceId value. */ public String policyDefinitionReferenceId() { - return this.policyDefinitionReferenceId; + return this.innerProperties() == null ? null : this.innerProperties().policyDefinitionReferenceId(); } /** @@ -112,7 +93,10 @@ public String policyDefinitionReferenceId() { * @return the RemediationInner object itself. */ public RemediationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) { - this.policyDefinitionReferenceId = policyDefinitionReferenceId; + if (this.innerProperties() == null) { + this.innerProperties = new RemediationProperties(); + } + this.innerProperties().withPolicyDefinitionReferenceId(policyDefinitionReferenceId); return this; } @@ -123,7 +107,7 @@ public RemediationInner withPolicyDefinitionReferenceId(String policyDefinitionR * @return the resourceDiscoveryMode value. */ public ResourceDiscoveryMode resourceDiscoveryMode() { - return this.resourceDiscoveryMode; + return this.innerProperties() == null ? null : this.innerProperties().resourceDiscoveryMode(); } /** @@ -134,7 +118,10 @@ public ResourceDiscoveryMode resourceDiscoveryMode() { * @return the RemediationInner object itself. */ public RemediationInner withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode) { - this.resourceDiscoveryMode = resourceDiscoveryMode; + if (this.innerProperties() == null) { + this.innerProperties = new RemediationProperties(); + } + this.innerProperties().withResourceDiscoveryMode(resourceDiscoveryMode); return this; } @@ -144,7 +131,7 @@ public RemediationInner withResourceDiscoveryMode(ResourceDiscoveryMode resource * @return the provisioningState value. */ public String provisioningState() { - return this.provisioningState; + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } /** @@ -153,7 +140,7 @@ public String provisioningState() { * @return the createdOn value. */ public OffsetDateTime createdOn() { - return this.createdOn; + return this.innerProperties() == null ? null : this.innerProperties().createdOn(); } /** @@ -162,7 +149,7 @@ public OffsetDateTime createdOn() { * @return the lastUpdatedOn value. */ public OffsetDateTime lastUpdatedOn() { - return this.lastUpdatedOn; + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedOn(); } /** @@ -171,7 +158,7 @@ public OffsetDateTime lastUpdatedOn() { * @return the filters value. */ public RemediationFilters filters() { - return this.filters; + return this.innerProperties() == null ? null : this.innerProperties().filters(); } /** @@ -181,7 +168,10 @@ public RemediationFilters filters() { * @return the RemediationInner object itself. */ public RemediationInner withFilters(RemediationFilters filters) { - this.filters = filters; + if (this.innerProperties() == null) { + this.innerProperties = new RemediationProperties(); + } + this.innerProperties().withFilters(filters); return this; } @@ -191,7 +181,102 @@ public RemediationInner withFilters(RemediationFilters filters) { * @return the deploymentStatus value. */ public RemediationDeploymentSummary deploymentStatus() { - return this.deploymentStatus; + return this.innerProperties() == null ? null : this.innerProperties().deploymentStatus(); + } + + /** + * Get the statusMessage property: The remediation status message. Provides additional details regarding the state + * of the remediation. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.innerProperties() == null ? null : this.innerProperties().statusMessage(); + } + + /** + * Get the correlationId property: The remediation correlation Id. Can be used to find events related to the + * remediation in the activity log. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.innerProperties() == null ? null : this.innerProperties().correlationId(); + } + + /** + * Get the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @return the resourceCount value. + */ + public Integer resourceCount() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCount(); + } + + /** + * Set the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @param resourceCount the resourceCount value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withResourceCount(Integer resourceCount) { + if (this.innerProperties() == null) { + this.innerProperties = new RemediationProperties(); + } + this.innerProperties().withResourceCount(resourceCount); + return this; + } + + /** + * Get the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @return the parallelDeployments value. + */ + public Integer parallelDeployments() { + return this.innerProperties() == null ? null : this.innerProperties().parallelDeployments(); + } + + /** + * Set the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @param parallelDeployments the parallelDeployments value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withParallelDeployments(Integer parallelDeployments) { + if (this.innerProperties() == null) { + this.innerProperties = new RemediationProperties(); + } + this.innerProperties().withParallelDeployments(parallelDeployments); + return this; + } + + /** + * Get the failureThreshold property: The remediation failure threshold settings. + * + * @return the failureThreshold value. + */ + public RemediationPropertiesFailureThreshold failureThreshold() { + return this.innerProperties() == null ? null : this.innerProperties().failureThreshold(); + } + + /** + * Set the failureThreshold property: The remediation failure threshold settings. + * + * @param failureThreshold the failureThreshold value to set. + * @return the RemediationInner object itself. + */ + public RemediationInner withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold) { + if (this.innerProperties() == null) { + this.innerProperties = new RemediationProperties(); + } + this.innerProperties().withFailureThreshold(failureThreshold); + return this; } /** @@ -200,11 +285,8 @@ public RemediationDeploymentSummary deploymentStatus() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (filters() != null) { - filters().validate(); - } - if (deploymentStatus() != null) { - deploymentStatus().validate(); + if (innerProperties() != null) { + innerProperties().validate(); } } } diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationProperties.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationProperties.java new file mode 100644 index 0000000000000..65f0de7f1511f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/fluent/models/RemediationProperties.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +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.RemediationPropertiesFailureThreshold; +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 properties. */ +@Fluent +public final class RemediationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationProperties.class); + + /* + * The resource ID of the policy assignment that should be remediated. + */ + @JsonProperty(value = "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 = "policyDefinitionReferenceId") + private String policyDefinitionReferenceId; + + /* + * The way resources to remediate are discovered. Defaults to + * ExistingNonCompliant if not specified. + */ + @JsonProperty(value = "resourceDiscoveryMode") + private ResourceDiscoveryMode resourceDiscoveryMode; + + /* + * The status of the remediation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * 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 was last updated. + */ + @JsonProperty(value = "lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedOn; + + /* + * The filters that will be applied to determine which resources to + * remediate. + */ + @JsonProperty(value = "filters") + private RemediationFilters filters; + + /* + * The deployment status summary for all deployments created by the + * remediation. + */ + @JsonProperty(value = "deploymentStatus", access = JsonProperty.Access.WRITE_ONLY) + private RemediationDeploymentSummary deploymentStatus; + + /* + * The remediation status message. Provides additional details regarding + * the state of the remediation. + */ + @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private String statusMessage; + + /* + * The remediation correlation Id. Can be used to find events related to + * the remediation in the activity log. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /* + * Determines the max number of resources that can be remediated by the + * remediation job. If not provided, the default resource count is used. + */ + @JsonProperty(value = "resourceCount") + private Integer resourceCount; + + /* + * Determines how many resources to remediate at any given time. Can be + * used to increase or reduce the pace of the remediation. If not provided, + * the default parallel deployments value is used. + */ + @JsonProperty(value = "parallelDeployments") + private Integer parallelDeployments; + + /* + * The remediation failure threshold settings + */ + @JsonProperty(value = "failureThreshold") + private RemediationPropertiesFailureThreshold failureThreshold; + + /** + * 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 RemediationProperties object itself. + */ + public RemediationProperties 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 RemediationProperties object itself. + */ + public RemediationProperties 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 RemediationProperties object itself. + */ + public RemediationProperties 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 RemediationProperties object itself. + */ + public RemediationProperties 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; + } + + /** + * Get the statusMessage property: The remediation status message. Provides additional details regarding the state + * of the remediation. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.statusMessage; + } + + /** + * Get the correlationId property: The remediation correlation Id. Can be used to find events related to the + * remediation in the activity log. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @return the resourceCount value. + */ + public Integer resourceCount() { + return this.resourceCount; + } + + /** + * Set the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @param resourceCount the resourceCount value to set. + * @return the RemediationProperties object itself. + */ + public RemediationProperties withResourceCount(Integer resourceCount) { + this.resourceCount = resourceCount; + return this; + } + + /** + * Get the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @return the parallelDeployments value. + */ + public Integer parallelDeployments() { + return this.parallelDeployments; + } + + /** + * Set the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @param parallelDeployments the parallelDeployments value to set. + * @return the RemediationProperties object itself. + */ + public RemediationProperties withParallelDeployments(Integer parallelDeployments) { + this.parallelDeployments = parallelDeployments; + return this; + } + + /** + * Get the failureThreshold property: The remediation failure threshold settings. + * + * @return the failureThreshold value. + */ + public RemediationPropertiesFailureThreshold failureThreshold() { + return this.failureThreshold; + } + + /** + * Set the failureThreshold property: The remediation failure threshold settings. + * + * @param failureThreshold the failureThreshold value to set. + * @return the RemediationProperties object itself. + */ + public RemediationProperties withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold) { + this.failureThreshold = failureThreshold; + return this; + } + + /** + * 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(); + } + if (failureThreshold() != null) { + failureThreshold().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 index ec28ced5383ff..df64930f9da96 100644 --- 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 @@ -4,18 +4,22 @@ package com.azure.resourcemanager.policyinsights.fluent.models; -import com.azure.core.annotation.Immutable; -import com.azure.core.annotation.JsonFlatten; +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; /** Slim version of policy metadata resource definition, excluding properties with large strings. */ -@JsonFlatten -@Immutable -public class SlimPolicyMetadataInner { +@Fluent +public final class SlimPolicyMetadataInner { @JsonIgnore private final ClientLogger logger = new ClientLogger(SlimPolicyMetadataInner.class); + /* + * Properties of the policy metadata. + */ + @JsonProperty(value = "properties") + private PolicyMetadataSlimProperties innerProperties; + /* * The ID of the policy metadata. */ @@ -34,41 +38,14 @@ public class SlimPolicyMetadataInner { @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. + /** + * Get the innerProperties property: Properties of the policy metadata. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.metadata", access = JsonProperty.Access.WRITE_ONLY) - private Object metadata; + private PolicyMetadataSlimProperties innerProperties() { + return this.innerProperties; + } /** * Get the id property: The ID of the policy metadata. @@ -103,7 +80,7 @@ public String name() { * @return the metadataId value. */ public String metadataId() { - return this.metadataId; + return this.innerProperties() == null ? null : this.innerProperties().metadataId(); } /** @@ -112,7 +89,7 @@ public String metadataId() { * @return the category value. */ public String category() { - return this.category; + return this.innerProperties() == null ? null : this.innerProperties().category(); } /** @@ -121,7 +98,7 @@ public String category() { * @return the title value. */ public String title() { - return this.title; + return this.innerProperties() == null ? null : this.innerProperties().title(); } /** @@ -130,7 +107,7 @@ public String title() { * @return the owner value. */ public String owner() { - return this.owner; + return this.innerProperties() == null ? null : this.innerProperties().owner(); } /** @@ -139,7 +116,7 @@ public String owner() { * @return the additionalContentUrl value. */ public String additionalContentUrl() { - return this.additionalContentUrl; + return this.innerProperties() == null ? null : this.innerProperties().additionalContentUrl(); } /** @@ -148,7 +125,7 @@ public String additionalContentUrl() { * @return the metadata value. */ public Object metadata() { - return this.metadata; + return this.innerProperties() == null ? null : this.innerProperties().metadata(); } /** @@ -157,5 +134,8 @@ public Object metadata() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } } } 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 index 453253776c3b1..b932a1ea21229 100644 --- 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 @@ -540,7 +540,7 @@ private Mono>> createOrUpdateAtSubscriptionWithRespons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AttestationInner> beginCreateOrUpdateAtSubscriptionAsync( String attestationName, AttestationInner parameters) { Mono>> mono = @@ -562,7 +562,7 @@ private PollerFlux, AttestationInner> beginCreateOr * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AttestationInner> beginCreateOrUpdateAtSubscriptionAsync( String attestationName, AttestationInner parameters, Context context) { context = this.client.mergeContext(context); @@ -584,7 +584,7 @@ private PollerFlux, AttestationInner> beginCreateOr * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( String attestationName, AttestationInner parameters) { return beginCreateOrUpdateAtSubscriptionAsync(attestationName, parameters).getSyncPoller(); @@ -601,7 +601,7 @@ public SyncPoller, AttestationInner> beginCreateOrU * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AttestationInner> beginCreateOrUpdateAtSubscription( String attestationName, AttestationInner parameters, Context context) { return beginCreateOrUpdateAtSubscriptionAsync(attestationName, parameters, context).getSyncPoller(); @@ -1263,7 +1263,7 @@ private Mono>> createOrUpdateAtResourceGroupWithRespon * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceGroupAsync( String resourceGroupName, String attestationName, AttestationInner parameters) { Mono>> mono = @@ -1286,7 +1286,7 @@ private PollerFlux, AttestationInner> beginCreateOr * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceGroupAsync( String resourceGroupName, String attestationName, AttestationInner parameters, Context context) { context = this.client.mergeContext(context); @@ -1309,7 +1309,7 @@ private PollerFlux, AttestationInner> beginCreateOr * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( String resourceGroupName, String attestationName, AttestationInner parameters) { return beginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters).getSyncPoller(); @@ -1327,7 +1327,7 @@ public SyncPoller, AttestationInner> beginCreateOrU * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AttestationInner> beginCreateOrUpdateAtResourceGroup( String resourceGroupName, String attestationName, AttestationInner parameters, Context context) { return beginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, attestationName, parameters, context) @@ -1978,7 +1978,7 @@ private Mono>> createOrUpdateAtResourceWithResponseAsy * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceAsync( String resourceId, String attestationName, AttestationInner parameters) { Mono>> mono = @@ -2001,7 +2001,7 @@ private PollerFlux, AttestationInner> beginCreateOr * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AttestationInner> beginCreateOrUpdateAtResourceAsync( String resourceId, String attestationName, AttestationInner parameters, Context context) { context = this.client.mergeContext(context); @@ -2024,7 +2024,7 @@ private PollerFlux, AttestationInner> beginCreateOr * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( String resourceId, String attestationName, AttestationInner parameters) { return beginCreateOrUpdateAtResourceAsync(resourceId, attestationName, parameters).getSyncPoller(); @@ -2042,7 +2042,7 @@ public SyncPoller, AttestationInner> beginCreateOrU * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an attestation resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AttestationInner> beginCreateOrUpdateAtResource( String resourceId, String attestationName, AttestationInner parameters, Context context) { return beginCreateOrUpdateAtResourceAsync(resourceId, attestationName, parameters, context).getSyncPoller(); 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 index 1292534dc8985..000c8e026abb1 100644 --- 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 @@ -251,85 +251,12 @@ Mono> listQueryResultsForResourceGroupLevelPo @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"}) + @Headers({"Accept: application/json", "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); + Mono> nextLink( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); } /** @@ -526,7 +453,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -552,7 +479,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync(Stri () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -594,7 +521,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( () -> listQueryResultsForManagementGroupSinglePageAsync( managementGroupName, top, orderBy, select, from, to, filter, apply, skipToken, context), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -849,7 +776,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -875,7 +802,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync(String () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -917,7 +844,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1188,7 +1115,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( () -> listQueryResultsForResourceGroupSinglePageAsync( subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1216,7 +1143,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( () -> listQueryResultsForResourceGroupSinglePageAsync( subscriptionId, resourceGroupName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1270,7 +1197,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1537,7 +1464,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1564,7 +1491,7 @@ private PagedFlux listQueryResultsForResourceAsync(String reso () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1608,7 +1535,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken, context), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1888,7 +1815,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( () -> listQueryResultsForPolicySetDefinitionSinglePageAsync( subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1916,7 +1843,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( () -> listQueryResultsForPolicySetDefinitionSinglePageAsync( subscriptionId, policySetDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1970,7 +1897,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -2259,7 +2186,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( () -> listQueryResultsForPolicyDefinitionSinglePageAsync( subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2287,7 +2214,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( () -> listQueryResultsForPolicyDefinitionSinglePageAsync( subscriptionId, policyDefinitionName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2341,7 +2268,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -2630,7 +2557,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs () -> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2658,7 +2585,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs () -> listQueryResultsForSubscriptionLevelPolicyAssignmentSinglePageAsync( subscriptionId, policyAssignmentName, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2712,7 +2639,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -3027,7 +2954,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3066,7 +2993,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3123,7 +3050,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -3228,171 +3155,12 @@ public PagedIterable listQueryResultsForResourceGroupLevelPoli * @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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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) { + private Mono> nextLinkSinglePageAsync(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)) + .withContext(context -> service.nextLink(nextLink, context)) .>map( res -> new PagedResponseBase<>( @@ -3416,404 +3184,13 @@ private Mono> listQueryResultsForResourceGroupNe * @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) { + private Mono> nextLinkSinglePageAsync(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"; - 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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) + .nextLink(nextLink, context) .map( res -> new PagedResponseBase<>( 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 index 8c0dfb471f5c2..fbb54b7247331 100644 --- 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 @@ -31,6 +31,14 @@ public String name() { return this.innerModel().name(); } + public String description() { + return this.innerModel().description(); + } + + public String requirements() { + return this.innerModel().requirements(); + } + public String metadataId() { return this.innerModel().metadataId(); } @@ -55,14 +63,6 @@ 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; } 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 index 3be83bbff99ed..ed2557cd675ec 100644 --- 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 @@ -441,85 +441,12 @@ Mono> summarizeForResourceGroupLevelPolicyAssign @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"}) + @Headers({"Accept: application/json", "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); + Mono> nextLink( + @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); } /** @@ -740,7 +667,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -778,7 +705,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -833,7 +760,7 @@ private PagedFlux listQueryResultsForManagementGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForManagementGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1325,7 +1252,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1354,7 +1281,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( () -> listQueryResultsForSubscriptionSinglePageAsync( policyStatesResource, subscriptionId, top, orderBy, select, from, to, filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1409,7 +1336,7 @@ private PagedFlux listQueryResultsForSubscriptionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -1910,7 +1837,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -1950,7 +1877,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2008,7 +1935,7 @@ private PagedFlux listQueryResultsForResourceGroupAsync( apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -2546,7 +2473,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2576,7 +2503,7 @@ private PagedFlux listQueryResultsForResourceAsync( () -> listQueryResultsForResourceSinglePageAsync( policyStatesResource, resourceId, top, orderBy, select, from, to, filter, apply, expand, skipToken), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -2634,7 +2561,7 @@ private PagedFlux listQueryResultsForResourceAsync( expand, skipToken, context), - nextLink -> listQueryResultsForResourceNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -2979,7 +2906,7 @@ private Mono>> triggerSubscriptionEvaluationWithRespon * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginTriggerSubscriptionEvaluationAsync(String subscriptionId) { Mono>> mono = triggerSubscriptionEvaluationWithResponseAsync(subscriptionId); return this @@ -2997,7 +2924,7 @@ private PollerFlux, Void> beginTriggerSubscriptionEvaluationAsy * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginTriggerSubscriptionEvaluationAsync( String subscriptionId, Context context) { context = this.client.mergeContext(context); @@ -3016,7 +2943,7 @@ private PollerFlux, Void> beginTriggerSubscriptionEvaluationAsy * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginTriggerSubscriptionEvaluation(String subscriptionId) { return beginTriggerSubscriptionEvaluationAsync(subscriptionId).getSyncPoller(); } @@ -3031,7 +2958,7 @@ public SyncPoller, Void> beginTriggerSubscriptionEvaluation(Str * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginTriggerSubscriptionEvaluation( String subscriptionId, Context context) { return beginTriggerSubscriptionEvaluationAsync(subscriptionId, context).getSyncPoller(); @@ -3179,7 +3106,7 @@ private Mono>> triggerResourceGroupEvaluationWithRespo * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginTriggerResourceGroupEvaluationAsync( String subscriptionId, String resourceGroupName) { Mono>> mono = @@ -3200,7 +3127,7 @@ private PollerFlux, Void> beginTriggerResourceGroupEvaluationAs * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginTriggerResourceGroupEvaluationAsync( String subscriptionId, String resourceGroupName, Context context) { context = this.client.mergeContext(context); @@ -3221,7 +3148,7 @@ private PollerFlux, Void> beginTriggerResourceGroupEvaluationAs * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginTriggerResourceGroupEvaluation( String subscriptionId, String resourceGroupName) { return beginTriggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName).getSyncPoller(); @@ -3238,7 +3165,7 @@ public SyncPoller, Void> beginTriggerResourceGroupEvaluation( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginTriggerResourceGroupEvaluation( String subscriptionId, String resourceGroupName, Context context) { return beginTriggerResourceGroupEvaluationAsync(subscriptionId, resourceGroupName, context).getSyncPoller(); @@ -3544,7 +3471,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3584,7 +3511,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -3642,7 +3569,7 @@ private PagedFlux listQueryResultsForPolicySetDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicySetDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -4212,7 +4139,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4252,7 +4179,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( filter, apply, skipToken), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4310,7 +4237,7 @@ private PagedFlux listQueryResultsForPolicyDefinitionAsync( apply, skipToken, context), - nextLink -> listQueryResultsForPolicyDefinitionNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -4876,7 +4803,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4916,7 +4843,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs filter, apply, skipToken), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -4974,7 +4901,7 @@ private PagedFlux listQueryResultsForSubscriptionLevelPolicyAs apply, skipToken, context), - nextLink -> listQueryResultsForSubscriptionLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -5560,7 +5487,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -5605,7 +5532,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA filter, apply, skipToken), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink)); + nextLink -> nextLinkSinglePageAsync(nextLink)); } /** @@ -5666,7 +5593,7 @@ private PagedFlux listQueryResultsForResourceGroupLevelPolicyA apply, skipToken, context), - nextLink -> listQueryResultsForResourceGroupLevelPolicyAssignmentNextSinglePageAsync(nextLink, context)); + nextLink -> nextLinkSinglePageAsync(nextLink, context)); } /** @@ -6040,171 +5967,12 @@ public Response summarizeForResourceGroupLevelPolicyAssig * @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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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) { + private Mono> nextLinkSinglePageAsync(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)) + .withContext(context -> service.nextLink(nextLink, context)) .>map( res -> new PagedResponseBase<>( @@ -6228,404 +5996,13 @@ private Mono> listQueryResultsForResourceGroupNe * @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) { + private Mono> nextLinkSinglePageAsync(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"; - 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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) + .nextLink(nextLink, context) .map( res -> new PagedResponseBase<>( 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 index a627d6c15a81d..2ea8054111e77 100644 --- 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 @@ -4,11 +4,16 @@ package com.azure.resourcemanager.policyinsights.implementation; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; 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.RemediationDeploymentSummary; import com.azure.resourcemanager.policyinsights.models.RemediationFilters; +import com.azure.resourcemanager.policyinsights.models.RemediationPropertiesFailureThreshold; import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode; import java.time.OffsetDateTime; @@ -29,6 +34,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String policyAssignmentId() { return this.innerModel().policyAssignmentId(); } @@ -61,6 +70,26 @@ public RemediationDeploymentSummary deploymentStatus() { return this.innerModel().deploymentStatus(); } + public String statusMessage() { + return this.innerModel().statusMessage(); + } + + public String correlationId() { + return this.innerModel().correlationId(); + } + + public Integer resourceCount() { + return this.innerModel().resourceCount(); + } + + public Integer parallelDeployments() { + return this.innerModel().parallelDeployments(); + } + + public RemediationPropertiesFailureThreshold failureThreshold() { + return this.innerModel().failureThreshold(); + } + public RemediationInner innerModel() { return this.innerObject; } @@ -160,6 +189,26 @@ public Remediation refresh(Context context) { return this; } + public PagedIterable listDeploymentsAtResourceGroup() { + return serviceManager.remediations().listDeploymentsAtResourceGroup(resourceGroupName, remediationName); + } + + public PagedIterable listDeploymentsAtResourceGroup(Integer top, Context context) { + return serviceManager + .remediations() + .listDeploymentsAtResourceGroup(resourceGroupName, remediationName, top, context); + } + + public Remediation cancelAtResourceGroup() { + return serviceManager.remediations().cancelAtResourceGroup(resourceGroupName, remediationName); + } + + public Response cancelAtResourceGroupWithResponse(Context context) { + return serviceManager + .remediations() + .cancelAtResourceGroupWithResponse(resourceGroupName, remediationName, context); + } + public RemediationImpl withPolicyAssignmentId(String policyAssignmentId) { this.innerModel().withPolicyAssignmentId(policyAssignmentId); return this; @@ -179,4 +228,19 @@ public RemediationImpl withFilters(RemediationFilters filters) { this.innerModel().withFilters(filters); return this; } + + public RemediationImpl withResourceCount(Integer resourceCount) { + this.innerModel().withResourceCount(resourceCount); + return this; + } + + public RemediationImpl withParallelDeployments(Integer parallelDeployments) { + this.innerModel().withParallelDeployments(parallelDeployments); + return this; + } + + public RemediationImpl withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold) { + this.innerModel().withFailureThreshold(failureThreshold); + 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 index 7b056577ff5c3..ead084752cb6b 100644 --- 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 @@ -514,7 +514,7 @@ private Mono> listDeploymentsAtManagem .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -571,7 +571,7 @@ private Mono> listDeploymentsAtManagem .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -717,7 +717,7 @@ private Mono> cancelAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -763,7 +763,7 @@ private Mono> cancelAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -857,7 +857,7 @@ private Mono> listForManagementGroupSinglePageAs .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -910,7 +910,7 @@ private Mono> listForManagementGroupSinglePageAs .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1059,7 +1059,7 @@ private Mono> createOrUpdateAtManagementGroupWithResp parameters.validate(); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1112,7 +1112,7 @@ private Mono> createOrUpdateAtManagementGroupWithResp parameters.validate(); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1216,7 +1216,7 @@ private Mono> getAtManagementGroupWithResponseAsync( .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1262,7 +1262,7 @@ private Mono> getAtManagementGroupWithResponseAsync( .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1359,7 +1359,7 @@ private Mono> deleteAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1405,7 +1405,7 @@ private Mono> deleteAtManagementGroupWithResponseAsyn .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } final String managementGroupsNamespace = "Microsoft.Management"; - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1503,7 +1503,7 @@ private Mono> listDeploymentsAtSubscri return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1559,7 +1559,7 @@ private Mono> listDeploymentsAtSubscri return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1695,7 +1695,7 @@ private Mono> cancelAtSubscriptionWithResponseAsync(S return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1740,7 +1740,7 @@ private Mono> cancelAtSubscriptionWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -1828,7 +1828,7 @@ private Mono> listSinglePageAsync(Integer top, S new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1879,7 +1879,7 @@ private Mono> listSinglePageAsync(Integer top, S new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2008,7 +2008,7 @@ private Mono> createOrUpdateAtSubscriptionWithRespons } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2060,7 +2060,7 @@ private Mono> createOrUpdateAtSubscriptionWithRespons } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2157,7 +2157,7 @@ private Mono> getAtSubscriptionWithResponseAsync(Stri return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2202,7 +2202,7 @@ private Mono> getAtSubscriptionWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2293,7 +2293,7 @@ private Mono> deleteAtSubscriptionWithResponseAsync(S return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2338,7 +2338,7 @@ private Mono> deleteAtSubscriptionWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2436,7 +2436,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2498,7 +2498,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2649,7 +2649,7 @@ private Mono> cancelAtResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2700,7 +2700,7 @@ private Mono> cancelAtResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2799,7 +2799,7 @@ private Mono> listByResourceGroupSinglePageAsync return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -2857,7 +2857,7 @@ private Mono> listByResourceGroupSinglePageAsync return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3010,7 +3010,7 @@ private Mono> createOrUpdateAtResourceGroupWithRespon } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3068,7 +3068,7 @@ private Mono> createOrUpdateAtResourceGroupWithRespon } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3177,7 +3177,7 @@ private Mono> getByResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3228,7 +3228,7 @@ private Mono> getByResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3329,7 +3329,7 @@ private Mono> deleteWithResponseAsync(String resource return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3380,7 +3380,7 @@ private Mono> deleteWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3476,7 +3476,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3524,7 +3524,7 @@ private Mono> listDeploymentsAtResourc return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3660,7 +3660,7 @@ private Mono> cancelAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3698,7 +3698,7 @@ private Mono> cancelAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3783,7 +3783,7 @@ private Mono> listForResourceSinglePageAsync( if (resourceId == null) { return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -3827,7 +3827,7 @@ private Mono> listForResourceSinglePageAsync( if (resourceId == null) { return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -3965,7 +3965,7 @@ private Mono> createOrUpdateAtResourceWithResponseAsy } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -4015,7 +4015,7 @@ private Mono> createOrUpdateAtResourceWithResponseAsy } else { parameters.validate(); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -4108,7 +4108,7 @@ private Mono> getAtResourceWithResponseAsync(String r return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -4146,7 +4146,7 @@ private Mono> getAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -4234,7 +4234,7 @@ private Mono> deleteAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -4272,7 +4272,7 @@ private Mono> deleteAtResourceWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter remediationName is required and cannot be null.")); } - final String apiVersion = "2019-07-01"; + final String apiVersion = "2021-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service 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 index 6afa75ce983d2..bca9665b013de 100644 --- 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 @@ -29,6 +29,20 @@ public interface PolicyMetadata { */ String name(); + /** + * 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 metadataId property: The policy metadata identifier. * @@ -71,20 +85,6 @@ public interface PolicyMetadata { */ 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. * 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 index f9ceb79ac8644..14ea6273b82f0 100644 --- 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 @@ -4,6 +4,9 @@ package com.azure.resourcemanager.policyinsights.models; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; import java.time.OffsetDateTime; @@ -31,6 +34,13 @@ public interface Remediation { */ 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 should be remediated. * @@ -89,6 +99,46 @@ public interface Remediation { */ RemediationDeploymentSummary deploymentStatus(); + /** + * Gets the statusMessage property: The remediation status message. Provides additional details regarding the state + * of the remediation. + * + * @return the statusMessage value. + */ + String statusMessage(); + + /** + * Gets the correlationId property: The remediation correlation Id. Can be used to find events related to the + * remediation in the activity log. + * + * @return the correlationId value. + */ + String correlationId(); + + /** + * Gets the resourceCount property: Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * + * @return the resourceCount value. + */ + Integer resourceCount(); + + /** + * Gets the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used + * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is + * used. + * + * @return the parallelDeployments value. + */ + Integer parallelDeployments(); + + /** + * Gets the failureThreshold property: The remediation failure threshold settings. + * + * @return the failureThreshold value. + */ + RemediationPropertiesFailureThreshold failureThreshold(); + /** * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner object. * @@ -123,7 +173,10 @@ interface WithCreate extends DefinitionStages.WithPolicyAssignmentId, DefinitionStages.WithPolicyDefinitionReferenceId, DefinitionStages.WithResourceDiscoveryMode, - DefinitionStages.WithFilters { + DefinitionStages.WithFilters, + DefinitionStages.WithResourceCount, + DefinitionStages.WithParallelDeployments, + DefinitionStages.WithFailureThreshold { /** * Executes the create request. * @@ -187,6 +240,42 @@ interface WithFilters { */ WithCreate withFilters(RemediationFilters filters); } + /** The stage of the Remediation definition allowing to specify resourceCount. */ + interface WithResourceCount { + /** + * Specifies the resourceCount property: Determines the max number of resources that can be remediated by + * the remediation job. If not provided, the default resource count is used.. + * + * @param resourceCount Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * @return the next definition stage. + */ + WithCreate withResourceCount(Integer resourceCount); + } + /** The stage of the Remediation definition allowing to specify parallelDeployments. */ + interface WithParallelDeployments { + /** + * Specifies the parallelDeployments property: Determines how many resources to remediate at any given time. + * Can be used to increase or reduce the pace of the remediation. If not provided, the default parallel + * deployments value is used.. + * + * @param parallelDeployments Determines how many resources to remediate at any given time. Can be used to + * increase or reduce the pace of the remediation. If not provided, the default parallel deployments + * value is used. + * @return the next definition stage. + */ + WithCreate withParallelDeployments(Integer parallelDeployments); + } + /** The stage of the Remediation definition allowing to specify failureThreshold. */ + interface WithFailureThreshold { + /** + * Specifies the failureThreshold property: The remediation failure threshold settings. + * + * @param failureThreshold The remediation failure threshold settings. + * @return the next definition stage. + */ + WithCreate withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold); + } } /** * Begins update for the Remediation resource. @@ -200,7 +289,10 @@ interface Update extends UpdateStages.WithPolicyAssignmentId, UpdateStages.WithPolicyDefinitionReferenceId, UpdateStages.WithResourceDiscoveryMode, - UpdateStages.WithFilters { + UpdateStages.WithFilters, + UpdateStages.WithResourceCount, + UpdateStages.WithParallelDeployments, + UpdateStages.WithFailureThreshold { /** * Executes the update request. * @@ -266,6 +358,42 @@ interface WithFilters { */ Update withFilters(RemediationFilters filters); } + /** The stage of the Remediation update allowing to specify resourceCount. */ + interface WithResourceCount { + /** + * Specifies the resourceCount property: Determines the max number of resources that can be remediated by + * the remediation job. If not provided, the default resource count is used.. + * + * @param resourceCount Determines the max number of resources that can be remediated by the remediation + * job. If not provided, the default resource count is used. + * @return the next definition stage. + */ + Update withResourceCount(Integer resourceCount); + } + /** The stage of the Remediation update allowing to specify parallelDeployments. */ + interface WithParallelDeployments { + /** + * Specifies the parallelDeployments property: Determines how many resources to remediate at any given time. + * Can be used to increase or reduce the pace of the remediation. If not provided, the default parallel + * deployments value is used.. + * + * @param parallelDeployments Determines how many resources to remediate at any given time. Can be used to + * increase or reduce the pace of the remediation. If not provided, the default parallel deployments + * value is used. + * @return the next definition stage. + */ + Update withParallelDeployments(Integer parallelDeployments); + } + /** The stage of the Remediation update allowing to specify failureThreshold. */ + interface WithFailureThreshold { + /** + * Specifies the failureThreshold property: The remediation failure threshold settings. + * + * @param failureThreshold The remediation failure threshold settings. + * @return the next definition stage. + */ + Update withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold); + } } /** * Refreshes the resource to sync with Azure. @@ -281,4 +409,45 @@ interface WithFilters { * @return the refreshed resource. */ Remediation refresh(Context context); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all deployments for a remediation at resource group scope. + */ + PagedIterable listDeploymentsAtResourceGroup(); + + /** + * Gets all deployments for a remediation at resource group scope. + * + * @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(Integer top, Context context); + + /** + * Cancels a remediation at resource group scope. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Remediation cancelAtResourceGroup(); + + /** + * Cancels a remediation at resource group scope. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the remediation definition. + */ + Response cancelAtResourceGroupWithResponse(Context context); } diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationPropertiesFailureThreshold.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationPropertiesFailureThreshold.java new file mode 100644 index 0000000000000..4c64f6d798a80 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/RemediationPropertiesFailureThreshold.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.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The remediation failure threshold settings. */ +@Fluent +public final class RemediationPropertiesFailureThreshold { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RemediationPropertiesFailureThreshold.class); + + /* + * A number between 0.0 to 1.0 representing the percentage failure + * threshold. The remediation will fail if the percentage of failed + * remediation operations (i.e. failed deployments) exceeds this threshold. + */ + @JsonProperty(value = "percentage") + private Float percentage; + + /** + * Get the percentage property: A number between 0.0 to 1.0 representing the percentage failure threshold. The + * remediation will fail if the percentage of failed remediation operations (i.e. failed deployments) exceeds this + * threshold. + * + * @return the percentage value. + */ + public Float percentage() { + return this.percentage; + } + + /** + * Set the percentage property: A number between 0.0 to 1.0 representing the percentage failure threshold. The + * remediation will fail if the percentage of failed remediation operations (i.e. failed deployments) exceeds this + * threshold. + * + * @param percentage the percentage value to set. + * @return the RemediationPropertiesFailureThreshold object itself. + */ + public RemediationPropertiesFailureThreshold withPercentage(Float percentage) { + this.percentage = percentage; + 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/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtResourceGroupSamples.java new file mode 100644 index 0000000000000..bb01c09ca854e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtResourceGroupSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for Attestations CreateOrUpdateAtResourceGroup. */ +public final class AttestationsCreateOrUpdateAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateResourceGroupScope.json + */ + /** + * Sample code: Create attestation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .define("790996e6-9871-4b1f-9cd9-ec42cd6ced1e") + .withExistingResourceGroup("myRg") + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("0b158b46-ff42-4799-8e39-08a5c23b4551") + .withComplianceState(ComplianceState.COMPLIANT) + .withExpiresOn(OffsetDateTime.parse("2021-06-15T00:00:00Z")) + .withOwner("55a32e28-3aa5-4eea-9b5a-4cd85153b966") + .withComments("This subscription has passed a security audit.") + .withEvidence( + Arrays + .asList( + new AttestationEvidence() + .withDescription("The results of the security audit.") + .withSourceUri("https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"))) + .create(); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtResourceSamples.java new file mode 100644 index 0000000000000..27c90bcf92bdf --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtResourceSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for Attestations CreateOrUpdateAtResource. */ +public final class AttestationsCreateOrUpdateAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateResourceScope.json + */ + /** + * Sample code: Create attestation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .createOrUpdateAtResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + new AttestationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("0b158b46-ff42-4799-8e39-08a5c23b4551") + .withComplianceState(ComplianceState.COMPLIANT) + .withExpiresOn(OffsetDateTime.parse("2021-06-15T00:00:00Z")) + .withOwner("55a32e28-3aa5-4eea-9b5a-4cd85153b966") + .withComments("This subscription has passed a security audit.") + .withEvidence( + Arrays + .asList( + new AttestationEvidence() + .withDescription("The results of the security audit.") + .withSourceUri( + "https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"))), + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtSubscriptionSamples.java new file mode 100644 index 0000000000000..30f08f4ea19e8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsCreateOrUpdateAtSubscriptionSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; +import com.azure.resourcemanager.policyinsights.models.AttestationEvidence; +import com.azure.resourcemanager.policyinsights.models.ComplianceState; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for Attestations CreateOrUpdateAtSubscription. */ +public final class AttestationsCreateOrUpdateAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateSubscriptionScope.json + */ + /** + * Sample code: Create attestation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .createOrUpdateAtSubscription( + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + new AttestationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withComplianceState(ComplianceState.COMPLIANT), + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_CreateSubscriptionScope_AllProperties.json + */ + /** + * Sample code: Create attestation at subscription scope with all properties. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createAttestationAtSubscriptionScopeWithAllProperties( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .createOrUpdateAtSubscription( + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + new AttestationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("0b158b46-ff42-4799-8e39-08a5c23b4551") + .withComplianceState(ComplianceState.COMPLIANT) + .withExpiresOn(OffsetDateTime.parse("2021-06-15T00:00:00Z")) + .withOwner("55a32e28-3aa5-4eea-9b5a-4cd85153b966") + .withComments("This subscription has passed a security audit.") + .withEvidence( + Arrays + .asList( + new AttestationEvidence() + .withDescription("The results of the security audit.") + .withSourceUri( + "https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"))), + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteAtResourceSamples.java new file mode 100644 index 0000000000000..1107cd478613b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteAtResourceSamples.java @@ -0,0 +1,28 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations DeleteAtResource. */ +public final class AttestationsDeleteAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_DeleteResourceScope.json + */ + /** + * Sample code: Delete attestation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteAttestationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .deleteAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteAtSubscriptionSamples.java new file mode 100644 index 0000000000000..c87523eb85b53 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteAtSubscriptionSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations DeleteAtSubscription. */ +public final class AttestationsDeleteAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_DeleteSubscriptionScope.json + */ + /** + * Sample code: Delete attestation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteAttestationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().deleteAtSubscriptionWithResponse("790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteSamples.java new file mode 100644 index 0000000000000..4d84d9811911e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsDeleteSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations Delete. */ +public final class AttestationsDeleteSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_DeleteResourceGroupScope.json + */ + /** + * Sample code: Delete attestation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteAttestationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().deleteWithResponse("myRg", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetAtResourceSamples.java new file mode 100644 index 0000000000000..894d95cb393d5 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetAtResourceSamples.java @@ -0,0 +1,28 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations GetAtResource. */ +public final class AttestationsGetAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_GetResourceScope.json + */ + /** + * Sample code: Get attestation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getAttestationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .getAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetAtSubscriptionSamples.java new file mode 100644 index 0000000000000..3fee411d5392b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetAtSubscriptionSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations GetAtSubscription. */ +public final class AttestationsGetAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_GetSubscriptionScope.json + */ + /** + * Sample code: Get attestation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getAttestationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().getAtSubscriptionWithResponse("790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetByResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..5b19dd6e25421 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations GetByResourceGroup. */ +public final class AttestationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_GetResourceGroupScope.json + */ + /** + * Sample code: Get attestation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getAttestationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .getByResourceGroupWithResponse("myRg", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListByResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f3d713d16781f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations ListByResourceGroup. */ +public final class AttestationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceGroupScope_WithQuery.json + */ + /** + * Sample code: List attestations at resource group scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtResourceGroupScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .listByResourceGroup( + "myRg", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceGroupScope.json + */ + /** + * Sample code: List attestations at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().listByResourceGroup("myRg", null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListForResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListForResourceSamples.java new file mode 100644 index 0000000000000..8459563fb689f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListForResourceSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations ListForResource. */ +public final class AttestationsListForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceScope_WithQuery.json + */ + /** + * Sample code: List attestations at individual resource scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtIndividualResourceScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListResourceScope.json + */ + /** + * Sample code: List attestations at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListSamples.java new file mode 100644 index 0000000000000..6dee39087f16c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/AttestationsListSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for Attestations List. */ +public final class AttestationsListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListSubscriptionScope.json + */ + /** + * Sample code: List attestations at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.attestations().list(null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-01-01/examples/Attestations_ListSubscriptionScope_WithQuery.json + */ + /** + * Sample code: List attestations at subscription scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listAttestationsAtSubscriptionScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .attestations() + .list( + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/OperationsListSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..4db1a84205b0c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_ListOperations.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listOperations(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.operations().listWithResponse(Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForManagementGroupSamples.java new file mode 100644 index 0000000000000..830851bce11a0 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForManagementGroupSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForManagementGroup. */ +public final class PolicyEventsListQueryResultsForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryManagementGroupScopeNextLink.json + */ + /** + * Sample code: Query at management group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForManagementGroup( + "myManagementGroup", null, null, null, null, null, null, null, "WpmWfBSvPhkAK6QD", Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryManagementGroupScope.json + */ + /** + * Sample code: Query at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForManagementGroup( + "myManagementGroup", null, null, null, null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForPolicyDefinitionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForPolicyDefinitionSamples.java new file mode 100644 index 0000000000000..eea88259465ae --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForPolicyDefinitionSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForPolicyDefinition. */ +public final class PolicyEventsListQueryResultsForPolicyDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyDefinitionScope.json + */ + /** + * Sample code: Query at subscription level policy definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicyDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyDefinitionScopeNextLink.json + */ + /** + * Sample code: Query at subscription level policy definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicyDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForPolicySetDefinitionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForPolicySetDefinitionSamples.java new file mode 100644 index 0000000000000..276529e421f8d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForPolicySetDefinitionSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForPolicySetDefinition. */ +public final class PolicyEventsListQueryResultsForPolicySetDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicySetDefinitionScope.json + */ + /** + * Sample code: Query at subscription level policy set definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicySetDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicySetDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicySetDefinitionScopeNextLink.json + */ + /** + * Sample code: Query at subscription level policy set definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicySetDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForPolicySetDefinition( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceGroupLevelPolicyAssignmentSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceGroupLevelPolicyAssignmentSamples.java new file mode 100644 index 0000000000000..8a164439b529e --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceGroupLevelPolicyAssignmentSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForResourceGroupLevelPolicyAssignment. */ +public final class PolicyEventsListQueryResultsForResourceGroupLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query at resource group level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query at resource group level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceGroupSamples.java new file mode 100644 index 0000000000000..e501d26d55a33 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceGroupSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForResourceGroup. */ +public final class PolicyEventsListQueryResultsForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupScope.json + */ + /** + * Sample code: Query at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroup( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupScopeNextLink.json + */ + /** + * Sample code: Query at resource group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResourceGroup( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceSamples.java new file mode 100644 index 0000000000000..d24c61f0cd5db --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForResourceSamples.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForResource. */ +public final class PolicyEventsListQueryResultsForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelResourceScope.json + */ + /** + * Sample code: Query at subscription level resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResourceName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryNestedResourceScope.json + */ + /** + * Sample code: Query at nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApplication", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelNestedResourceScope.json + */ + /** + * Sample code: Query at subscription level nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResource/someNestedResourceType/someNestedResource", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScope.json + */ + /** + * Sample code: Query at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScope(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeExpandComponents.json + */ + /** + * Sample code: Query components policy events for resource scope filtered by given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryComponentsPolicyEventsForResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeExpandComponentsGroupByWithAggregate.json + */ + /** + * Sample code: Query components policy events count grouped by user and action type for resource scope filtered by + * given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void + queryComponentsPolicyEventsCountGroupedByUserAndActionTypeForResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components($apply=groupby((tenantId, principalOid, policyDefinitionAction), aggregate($count as" + + " totalActions)))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeNextLink.json + */ + /** + * Sample code: Query at resource scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForResource( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForSubscriptionLevelPolicyAssignmentSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForSubscriptionLevelPolicyAssignmentSamples.java new file mode 100644 index 0000000000000..b41f3ba299ff1 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForSubscriptionLevelPolicyAssignmentSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyEvents ListQueryResultsForSubscriptionLevelPolicyAssignment. */ +public final class PolicyEventsListQueryResultsForSubscriptionLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query at subscription level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query at subscription level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForSubscriptionSamples.java new file mode 100644 index 0000000000000..f41af07cc5a3b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyEventsListQueryResultsForSubscriptionSamples.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for PolicyEvents ListQueryResultsForSubscription. */ +public final class PolicyEventsListQueryResultsForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_TimeRangeSortSelectTop.json + */ + /** + * Sample code: Time range; sort, select and limit. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void timeRangeSortSelectAndLimit( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + "Timestamp desc, PolicyAssignmentId asc, SubscriptionId asc, ResourceGroup asc, ResourceId", + "Timestamp, PolicyAssignmentId, PolicyDefinitionId, SubscriptionId, ResourceGroup, ResourceId", + OffsetDateTime.parse("2018-02-05T18:00:00Z"), + OffsetDateTime.parse("2018-02-06T18:00:00Z"), + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndAggregateOnly.json + */ + /** + * Sample code: Filter and aggregate only. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndAggregateOnly(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + OffsetDateTime.parse("2018-02-05T18:00:00Z"), + null, + "PolicyDefinitionAction eq 'deny'", + "aggregate($count as NumDenyEvents)", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndGroupByWithoutAggregate.json + */ + /** + * Sample code: Filter and group without aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithoutAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + null, + null, + OffsetDateTime.parse("2018-01-05T18:00:00Z"), + null, + "PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append'", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionScopeNextLink.json + */ + /** + * Sample code: Query at subscription scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndMultipleGroups.json + */ + /** + * Sample code: Filter and multiple groups. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndMultipleGroups(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 10, + "NumDeniedResources desc", + null, + OffsetDateTime.parse("2018-01-01T00:00:00Z"), + null, + "PolicyDefinitionAction eq 'deny'", + "groupby((PolicyAssignmentId, PolicyDefinitionId, ResourceId))/groupby((PolicyAssignmentId," + + " PolicyDefinitionId), aggregate($count as NumDeniedResources))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndGroupByWithAggregate.json + */ + /** + * Sample code: Filter and group with aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + null, + null, + OffsetDateTime.parse("2018-02-05T18:00:00Z"), + null, + "PolicyDefinitionAction eq 'audit' or PolicyDefinitionAction eq 'deny'", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId)," + + " aggregate($count as NumEvents))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionScope.json + */ + /** + * Sample code: Query at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyEvents() + .listQueryResultsForSubscription( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", null, null, null, null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyMetadataGetResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyMetadataGetResourceSamples.java new file mode 100644 index 0000000000000..ebb3ca18189f5 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyMetadataGetResourceSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyMetadata GetResource. */ +public final class PolicyMetadataGetResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_GetResource.json + */ + /** + * Sample code: Get a single policy metadata resource. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getASinglePolicyMetadataResource( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyMetadatas().getResourceWithResponse("NIST_SP_800-53_R4_AC-2", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyMetadataListSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyMetadataListSamples.java new file mode 100644 index 0000000000000..cb32a3e0a0670 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyMetadataListSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyMetadata List. */ +public final class PolicyMetadataListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List.json + */ + /** + * Sample code: Get collection of policy metadata resources. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getCollectionOfPolicyMetadataResources( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyMetadatas().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List_WithTop.json + */ + /** + * Sample code: Get collection of policy metadata resources using top query parameter. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getCollectionOfPolicyMetadataResourcesUsingTopQueryParameter( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyMetadatas().list(1, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyRestrictionsCheckAtResourceGroupScopeSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyRestrictionsCheckAtResourceGroupScopeSamples.java new file mode 100644 index 0000000000000..796e120d2ad03 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyRestrictionsCheckAtResourceGroupScopeSamples.java @@ -0,0 +1,53 @@ +// 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.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsRequest; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResourceDetails; +import com.azure.resourcemanager.policyinsights.models.PendingField; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for PolicyRestrictions CheckAtResourceGroupScope. */ +public final class PolicyRestrictionsCheckAtResourceGroupScopeSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2020-07-01/examples/PolicyRestrictions_CheckAtResourceGroupScope.json + */ + /** + * Sample code: Check policy restrictions at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void checkPolicyRestrictionsAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) throws IOException { + manager + .policyRestrictions() + .checkAtResourceGroupScopeWithResponse( + "vmRg", + new CheckRestrictionsRequest() + .withResourceDetails( + new CheckRestrictionsResourceDetails() + .withResourceContent( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"type\":\"Microsoft.Compute/virtualMachines\",\"properties\":{\"priority\":\"Spot\"}}", + Object.class, + SerializerEncoding.JSON)) + .withApiVersion("2019-12-01")) + .withPendingFields( + Arrays + .asList( + new PendingField().withField("name").withValues(Arrays.asList("myVMName")), + new PendingField() + .withField("location") + .withValues(Arrays.asList("eastus", "westus", "westus2", "westeurope")), + new PendingField().withField("tags"))), + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyRestrictionsCheckAtSubscriptionScopeSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyRestrictionsCheckAtSubscriptionScopeSamples.java new file mode 100644 index 0000000000000..232bbb2ebc87a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyRestrictionsCheckAtSubscriptionScopeSamples.java @@ -0,0 +1,52 @@ +// 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.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsRequest; +import com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResourceDetails; +import com.azure.resourcemanager.policyinsights.models.PendingField; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for PolicyRestrictions CheckAtSubscriptionScope. */ +public final class PolicyRestrictionsCheckAtSubscriptionScopeSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2020-07-01/examples/PolicyRestrictions_CheckAtSubscriptionScope.json + */ + /** + * Sample code: Check policy restrictions at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void checkPolicyRestrictionsAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) throws IOException { + manager + .policyRestrictions() + .checkAtSubscriptionScopeWithResponse( + new CheckRestrictionsRequest() + .withResourceDetails( + new CheckRestrictionsResourceDetails() + .withResourceContent( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"type\":\"Microsoft.Compute/virtualMachines\",\"properties\":{\"priority\":\"Spot\"}}", + Object.class, + SerializerEncoding.JSON)) + .withApiVersion("2019-12-01")) + .withPendingFields( + Arrays + .asList( + new PendingField().withField("name").withValues(Arrays.asList("myVMName")), + new PendingField() + .withField("location") + .withValues(Arrays.asList("eastus", "westus", "westus2", "westeurope")), + new PendingField().withField("tags"))), + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForManagementGroupSamples.java new file mode 100644 index 0000000000000..e607645089193 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForManagementGroupSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForManagementGroup. */ +public final class PolicyStatesListQueryResultsForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryManagementGroupScope.json + */ + /** + * Sample code: Query latest at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForManagementGroup( + PolicyStatesResource.LATEST, + "myManagementGroup", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryManagementGroupScopeNextLink.json + */ + /** + * Sample code: Query latest at management group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtManagementGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForManagementGroup( + PolicyStatesResource.LATEST, + "myManagementGroup", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForPolicyDefinitionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForPolicyDefinitionSamples.java new file mode 100644 index 0000000000000..eae9af02d56da --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForPolicyDefinitionSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForPolicyDefinition. */ +public final class PolicyStatesListQueryResultsForPolicyDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyDefinitionScope.json + */ + /** + * Sample code: Query latest at subscription level policy definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicyDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyDefinitionScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription level policy definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicyDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForPolicySetDefinitionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForPolicySetDefinitionSamples.java new file mode 100644 index 0000000000000..d16a370113314 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForPolicySetDefinitionSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForPolicySetDefinition. */ +public final class PolicyStatesListQueryResultsForPolicySetDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicySetDefinitionScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription level policy set definition scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicySetDefinitionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicySetDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicySetDefinitionScope.json + */ + /** + * Sample code: Query latest at subscription level policy set definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicySetDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForPolicySetDefinition( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceGroupLevelPolicyAssignmentSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceGroupLevelPolicyAssignmentSamples.java new file mode 100644 index 0000000000000..2b1680aef87dd --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceGroupLevelPolicyAssignmentSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForResourceGroupLevelPolicyAssignment. */ +public final class PolicyStatesListQueryResultsForResourceGroupLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query latest at resource group level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query latest at resource group level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroupLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "myPolicyAssignment", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceGroupSamples.java new file mode 100644 index 0000000000000..f45b0dcb209ff --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForResourceGroup. */ +public final class PolicyStatesListQueryResultsForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupScopeNextLink.json + */ + /** + * Sample code: Query latest at resource group scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroup( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupScope.json + */ + /** + * Sample code: Query latest at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResourceGroup( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceSamples.java new file mode 100644 index 0000000000000..23de7d0190b99 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForResourceSamples.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForResource. */ +public final class PolicyStatesListQueryResultsForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandPolicyEvaluationDetails.json + */ + /** + * Sample code: Query all policy states at resource scope and expand policyEvaluationDetails. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtResourceScopeAndExpandPolicyEvaluationDetails( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.LATEST, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + "PolicyEvaluationDetails", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeNextLink.json + */ + /** + * Sample code: Query all policy states at resource scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtResourceScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelNestedResourceScope.json + */ + /** + * Sample code: Query all policy states at subscription level nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtSubscriptionLevelNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResource/someNestedResourceType/someNestedResource", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandComponents.json + */ + /** + * Sample code: Query component policy compliance state at resource scope filtered by given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryComponentPolicyComplianceStateAtResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.LATEST, + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components($filter=ComplianceState eq 'NonCompliant' or ComplianceState eq 'Compliant')", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandComponentsGroupByWithAggregate.json + */ + /** + * Sample code: Query component policy compliance state count grouped by state type at resource scope filtered by + * given assignment. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void + queryComponentPolicyComplianceStateCountGroupedByStateTypeAtResourceScopeFilteredByGivenAssignment( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.LATEST, + "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", + null, + null, + null, + null, + null, + "policyAssignmentId eq" + + " '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'", + null, + "components($filter=ComplianceState eq 'NonCompliant' or ComplianceState eq" + + " 'Compliant';$apply=groupby((complianceState),aggregate($count as count)))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelResourceScope.json + */ + /** + * Sample code: Query all policy states at subscription level resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtSubscriptionLevelResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResourceName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScope.json + */ + /** + * Sample code: Query all policy states at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryNestedResourceScope.json + */ + /** + * Sample code: Query all policy states at nested resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAllPolicyStatesAtNestedResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForResource( + PolicyStatesResource.DEFAULT, + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApplication", + null, + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForSubscriptionLevelPolicyAssignmentSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForSubscriptionLevelPolicyAssignmentSamples.java new file mode 100644 index 0000000000000..9168641b5a3be --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForSubscriptionLevelPolicyAssignmentSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; + +/** Samples for PolicyStates ListQueryResultsForSubscriptionLevelPolicyAssignment. */ +public final class PolicyStatesListQueryResultsForSubscriptionLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyAssignmentScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription level policy assignment scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyAssignmentScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Query latest at subscription level policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionLevelPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscriptionLevelPolicyAssignment( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForSubscriptionSamples.java new file mode 100644 index 0000000000000..034834ad3e543 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesListQueryResultsForSubscriptionSamples.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.models.PolicyStatesResource; +import java.time.OffsetDateTime; + +/** Samples for PolicyStates ListQueryResultsForSubscription. */ +public final class PolicyStatesListQueryResultsForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionScope.json + */ + /** + * Sample code: Query latest at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionScopeNextLink.json + */ + /** + * Sample code: Query latest at subscription scope with next link. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryLatestAtSubscriptionScopeWithNextLink( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + null, + null, + null, + null, + "WpmWfBSvPhkAK6QD", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TimeRangeSortSelectTop.json + */ + /** + * Sample code: Time range; sort, select and limit. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void timeRangeSortSelectAndLimit( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + "Timestamp desc, PolicyAssignmentId asc, SubscriptionId asc, ResourceGroup asc, ResourceId", + "Timestamp, PolicyAssignmentId, PolicyDefinitionId, SubscriptionId, ResourceGroup, ResourceId," + + " policyDefinitionGroupNames", + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + OffsetDateTime.parse("2019-10-06T18:00:00Z"), + null, + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndAggregateOnly.json + */ + /** + * Sample code: Filter and aggregate only. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndAggregateOnly(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + null, + null, + null, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + null, + "PolicyDefinitionAction eq 'deny'", + "aggregate($count as NumDenyStates)", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndGroupByWithoutAggregate.json + */ + /** + * Sample code: Filter and group without aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithoutAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + null, + null, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + null, + "IsCompliant eq false and (PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append')", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndMultipleGroups.json + */ + /** + * Sample code: Filter and multiple groups. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndMultipleGroups(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 10, + "NumNonCompliantResources desc", + null, + null, + null, + "IsCompliant eq false", + "groupby((PolicyAssignmentId, PolicySetDefinitionId, PolicyDefinitionId, PolicyDefinitionReferenceId," + + " ResourceId))/groupby((PolicyAssignmentId, PolicySetDefinitionId, PolicyDefinitionId," + + " PolicyDefinitionReferenceId), aggregate($count as NumNonCompliantResources))", + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndGroupByWithAggregate.json + */ + /** + * Sample code: Filter and group with aggregate. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void filterAndGroupWithAggregate( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .listQueryResultsForSubscription( + PolicyStatesResource.LATEST, + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 2, + "NumAuditDenyNonComplianceRecords desc", + null, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + null, + "IsCompliant eq false and (PolicyDefinitionAction eq 'audit' or PolicyDefinitionAction eq 'deny')", + "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId)," + + " aggregate($count as NumAuditDenyNonComplianceRecords))", + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForManagementGroupSamples.java new file mode 100644 index 0000000000000..bcdddffa80046 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForManagementGroupSamples.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.generated; + +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for PolicyStates SummarizeForManagementGroup. */ +public final class PolicyStatesSummarizeForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeManagementGroupScope.json + */ + /** + * Sample code: Summarize at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForManagementGroupWithResponse( + "myManagementGroup", + 0, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + OffsetDateTime.parse("2019-10-06T18:00:00Z"), + "PolicyDefinitionAction eq 'deny' or PolicyDefinitionAction eq 'audit'", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForPolicyDefinitionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForPolicyDefinitionSamples.java new file mode 100644 index 0000000000000..566d2a128d97b --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForPolicyDefinitionSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForPolicyDefinition. */ +public final class PolicyStatesSummarizeForPolicyDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicyDefinitionScope.json + */ + /** + * Sample code: Summarize at policy definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicyDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForPolicyDefinitionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "24813039-7534-408a-9842-eb99f45721b1", + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForPolicySetDefinitionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForPolicySetDefinitionSamples.java new file mode 100644 index 0000000000000..a8b8afd556579 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForPolicySetDefinitionSamples.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.generated; + +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for PolicyStates SummarizeForPolicySetDefinition. */ +public final class PolicyStatesSummarizeForPolicySetDefinitionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicySetDefinitionScope.json + */ + /** + * Sample code: Summarize at policy set definition scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicySetDefinitionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForPolicySetDefinitionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "3e3807c1-65c9-49e0-a406-82d8ae3e338c", + 1, + OffsetDateTime.parse("2019-10-05T18:00:00Z"), + OffsetDateTime.parse("2019-10-06T18:00:00Z"), + "PolicyDefinitionAction eq 'deny'", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceGroupLevelPolicyAssignmentSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceGroupLevelPolicyAssignmentSamples.java new file mode 100644 index 0000000000000..553478a305a88 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceGroupLevelPolicyAssignmentSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForResourceGroupLevelPolicyAssignment. */ +public final class PolicyStatesSummarizeForResourceGroupLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceGroupLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Summarize at policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForResourceGroupLevelPolicyAssignmentWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "myResourceGroup", + "b7a1ca2596524e3ab19597f2", + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceGroupSamples.java new file mode 100644 index 0000000000000..b74ca603452d4 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceGroupSamples.java @@ -0,0 +1,26 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForResourceGroup. */ +public final class PolicyStatesSummarizeForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceGroupScope.json + */ + /** + * Sample code: Summarize at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForResourceGroupWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", null, null, null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceSamples.java new file mode 100644 index 0000000000000..7dd78ad261146 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForResourceSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForResource. */ +public final class PolicyStatesSummarizeForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceScope.json + */ + /** + * Sample code: Summarize at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForResourceWithResponse( + "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/my-vault", + 2, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForSubscriptionLevelPolicyAssignmentSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForSubscriptionLevelPolicyAssignmentSamples.java new file mode 100644 index 0000000000000..76bbb54c9372d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForSubscriptionLevelPolicyAssignmentSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForSubscriptionLevelPolicyAssignment. */ +public final class PolicyStatesSummarizeForSubscriptionLevelPolicyAssignmentSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicyAssignmentScope.json + */ + /** + * Sample code: Summarize at policy assignment scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtPolicyAssignmentScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForSubscriptionLevelPolicyAssignmentWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForSubscriptionSamples.java new file mode 100644 index 0000000000000..4a08f761f79dd --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesSummarizeForSubscriptionSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates SummarizeForSubscription. */ +public final class PolicyStatesSummarizeForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionScopeForPolicyGroup.json + */ + /** + * Sample code: Summarize at subscription scope for a policy definition group. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtSubscriptionScopeForAPolicyDefinitionGroup( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForSubscriptionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", + 1, + null, + null, + "'group1' IN PolicyDefinitionGroupNames", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionScope.json + */ + /** + * Sample code: Summarize at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void summarizeAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .summarizeForSubscriptionWithResponse( + "fffedd8f-ffff-fffd-fffd-fffed2f84852", 5, null, null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesTriggerResourceGroupEvaluationSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesTriggerResourceGroupEvaluationSamples.java new file mode 100644 index 0000000000000..1da93631d2543 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesTriggerResourceGroupEvaluationSamples.java @@ -0,0 +1,25 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates TriggerResourceGroupEvaluation. */ +public final class PolicyStatesTriggerResourceGroupEvaluationSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TriggerResourceGroupEvaluation.json + */ + /** + * Sample code: Trigger evaluations for all resources in a resource group. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void triggerEvaluationsForAllResourcesInAResourceGroup( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyStates() + .triggerResourceGroupEvaluation("fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesTriggerSubscriptionEvaluationSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesTriggerSubscriptionEvaluationSamples.java new file mode 100644 index 0000000000000..2c114fd61391a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyStatesTriggerSubscriptionEvaluationSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyStates TriggerSubscriptionEvaluation. */ +public final class PolicyStatesTriggerSubscriptionEvaluationSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TriggerSubscriptionEvaluation.json + */ + /** + * Sample code: Trigger evaluations for all resources in a subscription. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void triggerEvaluationsForAllResourcesInASubscription( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyStates().triggerSubscriptionEvaluation("fffedd8f-ffff-fffd-fffd-fffed2f84852", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForManagementGroupSamples.java new file mode 100644 index 0000000000000..2298c52af7f3c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForManagementGroupSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForManagementGroup. */ +public final class PolicyTrackedResourcesListQueryResultsForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryManagementGroupScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at management group scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForManagementGroup( + "myManagementGroup", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryManagementGroupScope.json + */ + /** + * Sample code: Query at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForManagementGroup("myManagementGroup", null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForResourceGroupSamples.java new file mode 100644 index 0000000000000..3d915eb978b05 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForResourceGroup. */ +public final class PolicyTrackedResourcesListQueryResultsForResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceGroupScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at resource group scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForResourceGroup( + "myResourceGroup", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceGroupScope.json + */ + /** + * Sample code: Query at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyTrackedResources().listQueryResultsForResourceGroup("myResourceGroup", null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForResourceSamples.java new file mode 100644 index 0000000000000..87aea76d3b91d --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForResourceSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForResource. */ +public final class PolicyTrackedResourcesListQueryResultsForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at resource scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForResource( + "subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceScope.json + */ + /** + * Sample code: Query at resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtResourceScope(com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForResource( + "subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource", + null, + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForSubscriptionSamples.java new file mode 100644 index 0000000000000..1907604147b39 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/PolicyTrackedResourcesListQueryResultsForSubscriptionSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PolicyTrackedResources ListQueryResultsForSubscription. */ +public final class PolicyTrackedResourcesListQueryResultsForSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QuerySubscriptionScopeWithFilterAndTop.json + */ + /** + * Sample code: Query at subscription scope using query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScopeUsingQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .policyTrackedResources() + .listQueryResultsForSubscription( + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment'" + + " AND TrackedResourceId eq" + + " '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QuerySubscriptionScope.json + */ + /** + * Sample code: Query at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void queryAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.policyTrackedResources().listQueryResultsForSubscription(null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtManagementGroupSamples.java new file mode 100644 index 0000000000000..6af6cb8172d04 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtManagementGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtManagementGroup. */ +public final class RemediationsCancelAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelManagementGroupScope.json + */ + /** + * Sample code: Cancel a remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().cancelAtManagementGroupWithResponse("financeMg", "myRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtResourceGroupSamples.java new file mode 100644 index 0000000000000..9fbf07407643c --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtResourceGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtResourceGroup. */ +public final class RemediationsCancelAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelResourceGroupScope.json + */ + /** + * Sample code: Cancel a remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().cancelAtResourceGroupWithResponse("myResourceGroup", "myRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtResourceSamples.java new file mode 100644 index 0000000000000..c8e8ded318fa1 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtResourceSamples.java @@ -0,0 +1,28 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtResource. */ +public final class RemediationsCancelAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelResourceScope.json + */ + /** + * Sample code: Cancel a remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .cancelAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "myRemediation", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtSubscriptionSamples.java new file mode 100644 index 0000000000000..0de8a4e3981b8 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCancelAtSubscriptionSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations CancelAtSubscription. */ +public final class RemediationsCancelAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelSubscriptionScope.json + */ + /** + * Sample code: Cancel a remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void cancelARemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().cancelAtSubscriptionWithResponse("myRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtManagementGroupSamples.java new file mode 100644 index 0000000000000..dc2b24d8b11a6 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtManagementGroupSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; + +/** Samples for Remediations CreateOrUpdateAtManagementGroup. */ +public final class RemediationsCreateOrUpdateAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateManagementGroupScope.json + */ + /** + * Sample code: Create remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtManagementGroupWithResponse( + "financeMg", + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/providers/microsoft.management/managementGroups/financeMg/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"), + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtResourceGroupSamples.java new file mode 100644 index 0000000000000..79996ec6482d7 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +/** Samples for Remediations CreateOrUpdateAtResourceGroup. */ +public final class RemediationsCreateOrUpdateAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateResourceGroupScope.json + */ + /** + * Sample code: Create remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .define("storageRemediation") + .withExistingResourceGroup("myResourceGroup") + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .create(); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtResourceSamples.java new file mode 100644 index 0000000000000..9883ca88750fc --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtResourceSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; + +/** Samples for Remediations CreateOrUpdateAtResource. */ +public final class RemediationsCreateOrUpdateAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateResourceScope.json + */ + /** + * Sample code: Create remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"), + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtSubscriptionSamples.java new file mode 100644 index 0000000000000..c83ba403b2ef9 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsCreateOrUpdateAtSubscriptionSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner; +import com.azure.resourcemanager.policyinsights.models.RemediationFilters; +import com.azure.resourcemanager.policyinsights.models.RemediationPropertiesFailureThreshold; +import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode; +import java.util.Arrays; + +/** Samples for Remediations CreateOrUpdateAtSubscription. */ +public final class RemediationsCreateOrUpdateAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateSubscriptionScope.json + */ + /** + * Sample code: Create remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtSubscriptionWithResponse( + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateSubscriptionScope_AllProperties.json + */ + /** + * Sample code: Create remediation at subscription scope with all properties. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void createRemediationAtSubscriptionScopeWithAllProperties( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .createOrUpdateAtSubscriptionWithResponse( + "storageRemediation", + new RemediationInner() + .withPolicyAssignmentId( + "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5") + .withPolicyDefinitionReferenceId("8c8fa9e4") + .withResourceDiscoveryMode(ResourceDiscoveryMode.RE_EVALUATE_COMPLIANCE) + .withFilters(new RemediationFilters().withLocations(Arrays.asList("eastus", "westus"))) + .withResourceCount(42) + .withParallelDeployments(6) + .withFailureThreshold(new RemediationPropertiesFailureThreshold().withPercentage(0.1f)), + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtManagementGroupSamples.java new file mode 100644 index 0000000000000..a57338b231dca --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtManagementGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations DeleteAtManagementGroup. */ +public final class RemediationsDeleteAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteManagementGroupScope.json + */ + /** + * Sample code: Delete remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().deleteAtManagementGroupWithResponse("financeMg", "storageRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtResourceSamples.java new file mode 100644 index 0000000000000..98dc88a1c9cb9 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtResourceSamples.java @@ -0,0 +1,28 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations DeleteAtResource. */ +public final class RemediationsDeleteAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteResourceScope.json + */ + /** + * Sample code: Delete remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .deleteAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "storageRemediation", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtSubscriptionSamples.java new file mode 100644 index 0000000000000..b8a642550aeb5 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteAtSubscriptionSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations DeleteAtSubscription. */ +public final class RemediationsDeleteAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteSubscriptionScope.json + */ + /** + * Sample code: Delete remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().deleteAtSubscriptionWithResponse("storageRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteSamples.java new file mode 100644 index 0000000000000..c01f91ccf4bd5 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsDeleteSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations Delete. */ +public final class RemediationsDeleteSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteResourceGroupScope.json + */ + /** + * Sample code: Delete remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void deleteRemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().deleteWithResponse("myResourceGroup", "storageRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtManagementGroupSamples.java new file mode 100644 index 0000000000000..506d025a6883f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtManagementGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations GetAtManagementGroup. */ +public final class RemediationsGetAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetManagementGroupScope.json + */ + /** + * Sample code: Get remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().getAtManagementGroupWithResponse("financeMg", "storageRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtResourceSamples.java new file mode 100644 index 0000000000000..6a6585561ce1a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtResourceSamples.java @@ -0,0 +1,28 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations GetAtResource. */ +public final class RemediationsGetAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetResourceScope.json + */ + /** + * Sample code: Get remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .getAtResourceWithResponse( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "storageRemediation", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtSubscriptionSamples.java new file mode 100644 index 0000000000000..5a117556a5b26 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetAtSubscriptionSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations GetAtSubscription. */ +public final class RemediationsGetAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetSubscriptionScope.json + */ + /** + * Sample code: Get remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().getAtSubscriptionWithResponse("storageRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetByResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b8ba8298bc878 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations GetByResourceGroup. */ +public final class RemediationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetResourceGroupScope.json + */ + /** + * Sample code: Get remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void getRemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().getByResourceGroupWithResponse("myResourceGroup", "storageRemediation", Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListByResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..fc608dbd70e9f --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListByResourceGroupSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations ListByResourceGroup. */ +public final class RemediationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceGroupScope_WithQuery.json + */ + /** + * Sample code: List remediations at resource group scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtResourceGroupScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listByResourceGroup( + "myResourceGroup", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceGroupScope.json + */ + /** + * Sample code: List remediations at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listByResourceGroup("myResourceGroup", null, null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtManagementGroupSamples.java new file mode 100644 index 0000000000000..b502b1a98f62a --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtManagementGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtManagementGroup. */ +public final class RemediationsListDeploymentsAtManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsManagementGroupScope.json + */ + /** + * Sample code: List deployments for a remediation at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listDeploymentsAtManagementGroup("financeMg", "myRemediation", null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtResourceGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtResourceGroupSamples.java new file mode 100644 index 0000000000000..f9fbc095114e2 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtResourceGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtResourceGroup. */ +public final class RemediationsListDeploymentsAtResourceGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceGroupScope.json + */ + /** + * Sample code: List deployments for a remediation at resource group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtResourceGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listDeploymentsAtResourceGroup("myResourceGroup", "myRemediation", null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtResourceSamples.java new file mode 100644 index 0000000000000..e32211a452119 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtResourceSamples.java @@ -0,0 +1,29 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtResource. */ +public final class RemediationsListDeploymentsAtResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceScope.json + */ + /** + * Sample code: List deployments for a remediation at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listDeploymentsAtResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + "myRemediation", + null, + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtSubscriptionSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtSubscriptionSamples.java new file mode 100644 index 0000000000000..4935735c87866 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListDeploymentsAtSubscriptionSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations ListDeploymentsAtSubscription. */ +public final class RemediationsListDeploymentsAtSubscriptionSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsSubscriptionScope.json + */ + /** + * Sample code: List deployments for a remediation at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listDeploymentsForARemediationAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listDeploymentsAtSubscription("myRemediation", null, Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListForManagementGroupSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListForManagementGroupSamples.java new file mode 100644 index 0000000000000..5bed061193661 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListForManagementGroupSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations ListForManagementGroup. */ +public final class RemediationsListForManagementGroupSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListManagementGroupScope.json + */ + /** + * Sample code: List remediations at management group scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtManagementGroupScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().listForManagementGroup("financeMg", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListManagementGroupScope_WithQuery.json + */ + /** + * Sample code: List remediations at management group scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtManagementGroupScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listForManagementGroup( + "financeMg", + 1, + "PolicyAssignmentId eq" + + " '/providers/microsoft.management/managementGroups/financeMg/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListForResourceSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListForResourceSamples.java new file mode 100644 index 0000000000000..0f625a05c6255 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListForResourceSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations ListForResource. */ +public final class RemediationsListForResourceSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceScope.json + */ + /** + * Sample code: List remediations at individual resource scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtIndividualResourceScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + null, + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceScope_WithQuery.json + */ + /** + * Sample code: List remediations at individual resource scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtIndividualResourceScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .listForResource( + "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'", + Context.NONE); + } +} diff --git a/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListSamples.java b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListSamples.java new file mode 100644 index 0000000000000..00a092fc96371 --- /dev/null +++ b/sdk/policyinsights/azure-resourcemanager-policyinsights/src/samples/java/com/azure/resourcemanager/policyinsights/generated/RemediationsListSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.policyinsights.generated; + +import com.azure.core.util.Context; + +/** Samples for Remediations List. */ +public final class RemediationsListSamples { + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope_WithQuery.json + */ + /** + * Sample code: List remediations at subscription scope with query parameters. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtSubscriptionScopeWithQueryParameters( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager + .remediations() + .list( + 1, + "PolicyAssignmentId eq" + + " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'" + + " AND PolicyDefinitionReferenceId eq 'storageSkuDef'", + Context.NONE); + } + + /* + * x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope.json + */ + /** + * Sample code: List remediations at subscription scope. + * + * @param manager Entry point to PolicyInsightsManager. + */ + public static void listRemediationsAtSubscriptionScope( + com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) { + manager.remediations().list(null, null, Context.NONE); + } +}