diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs index b50785defeca..9bbde2fea90c 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs @@ -94,6 +94,16 @@ public static partial class PolicyInsightsExtensions public static Azure.AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetQueryResultsForPolicyDefinitionComponentPolicyStates(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PolicyInsights.Models.SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetQueryResultsForPolicyDefinitionComponentPolicyStatesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PolicyInsights.Models.SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetQueryResultsForResourceGroupComponentPolicyStates(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.PolicyInsights.Models.ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetQueryResultsForResourceGroupComponentPolicyStatesAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.PolicyInsights.Models.ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStates(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.PolicyInsights.Models.ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.PolicyInsights.Models.ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetQueryResultsForSubscriptionComponentPolicyStates(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PolicyInsights.Models.SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetQueryResultsForSubscriptionComponentPolicyStatesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PolicyInsights.Models.SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStates(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PolicyInsights.Models.SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PolicyInsights.Models.SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable SummarizePolicyStates(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable SummarizePolicyStates(this Azure.ResourceManager.Resources.PolicyAssignmentResource policyAssignmentResource, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable SummarizePolicyStates(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -245,6 +255,77 @@ internal ComponentEventDetails() { } public System.Guid? TenantId { get { throw null; } } public System.DateTimeOffset? Timestamp { get { throw null; } } } + public partial class ComponentExpressionEvaluationDetails + { + internal ComponentExpressionEvaluationDetails() { } + public string Expression { get { throw null; } } + public string ExpressionKind { get { throw null; } } + public System.BinaryData ExpressionValue { get { throw null; } } + public string Operator { get { throw null; } } + public string Path { get { throw null; } } + public string Result { get { throw null; } } + public System.BinaryData TargetValue { get { throw null; } } + } + public partial class ComponentPolicyEvaluationDetails + { + internal ComponentPolicyEvaluationDetails() { } + public System.Collections.Generic.IReadOnlyList EvaluatedExpressions { get { throw null; } } + public string Reason { get { throw null; } } + } + public partial class ComponentPolicyState + { + internal ComponentPolicyState() { } + public System.Collections.Generic.IReadOnlyDictionary AdditionalProperties { get { throw null; } } + public string ComplianceState { get { throw null; } } + public string ComponentId { get { throw null; } } + public string ComponentName { get { throw null; } } + public string ComponentType { get { throw null; } } + public string ODataContext { get { throw null; } } + public string ODataId { get { throw null; } } + public string PolicyAssignmentId { get { throw null; } } + public string PolicyAssignmentName { get { throw null; } } + public string PolicyAssignmentOwner { get { throw null; } } + public string PolicyAssignmentParameters { get { throw null; } } + public string PolicyAssignmentScope { get { throw null; } } + public string PolicyAssignmentVersion { get { throw null; } } + public string PolicyDefinitionAction { get { throw null; } } + public string PolicyDefinitionCategory { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PolicyDefinitionGroupNames { get { throw null; } } + public string PolicyDefinitionId { get { throw null; } } + public string PolicyDefinitionName { get { throw null; } } + public string PolicyDefinitionReferenceId { get { throw null; } } + public string PolicyDefinitionVersion { get { throw null; } } + public Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyEvaluationDetails PolicyEvaluationDetails { get { throw null; } } + public string PolicySetDefinitionCategory { get { throw null; } } + public string PolicySetDefinitionId { get { throw null; } } + public string PolicySetDefinitionName { get { throw null; } } + public string PolicySetDefinitionOwner { get { throw null; } } + public string PolicySetDefinitionParameters { get { throw null; } } + public string PolicySetDefinitionVersion { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public string ResourceId { get { throw null; } } + public string ResourceLocation { get { throw null; } } + public string ResourceType { get { throw null; } } + public string SubscriptionId { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ComponentPolicyStatesResource : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ComponentPolicyStatesResource(string value) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource Latest { get { throw null; } } + public bool Equals(Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource left, Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource right) { throw null; } + public static implicit operator Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource left, Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource right) { throw null; } + public override string ToString() { throw null; } + } public partial class ComponentStateDetails : Azure.ResourceManager.Models.ResourceData { internal ComponentStateDetails() { } @@ -602,6 +683,31 @@ internal RemediationDeploymentSummary() { } public static bool operator !=(Azure.ResourceManager.PolicyInsights.Models.ResourceDiscoveryMode left, Azure.ResourceManager.PolicyInsights.Models.ResourceDiscoveryMode right) { throw null; } public override string ToString() { throw null; } } + public partial class ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions + { + public ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions(Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource componentPolicyStatesResource) { } + public string Apply { get { throw null; } set { } } + public Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource ComponentPolicyStatesResource { get { throw null; } } + public string Filter { get { throw null; } set { } } + public System.DateTimeOffset? From { get { throw null; } set { } } + public string OrderBy { get { throw null; } set { } } + public string Select { get { throw null; } set { } } + public System.DateTimeOffset? To { get { throw null; } set { } } + public int? Top { get { throw null; } set { } } + } + public partial class ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions + { + public ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource componentPolicyStatesResource) { } + public string Apply { get { throw null; } set { } } + public Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource ComponentPolicyStatesResource { get { throw null; } } + public string Filter { get { throw null; } set { } } + public System.DateTimeOffset? From { get { throw null; } set { } } + public string OrderBy { get { throw null; } set { } } + public string PolicyAssignmentName { get { throw null; } } + public string Select { get { throw null; } set { } } + public System.DateTimeOffset? To { get { throw null; } set { } } + public int? Top { get { throw null; } set { } } + } public partial class SlimPolicyMetadata : Azure.ResourceManager.Models.ResourceData { internal SlimPolicyMetadata() { } @@ -612,6 +718,44 @@ internal SlimPolicyMetadata() { } public string Owner { get { throw null; } } public string Title { get { throw null; } } } + public partial class SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions + { + public SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions(string policyDefinitionName, Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource componentPolicyStatesResource) { } + public string Apply { get { throw null; } set { } } + public Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource ComponentPolicyStatesResource { get { throw null; } } + public string Filter { get { throw null; } set { } } + public System.DateTimeOffset? From { get { throw null; } set { } } + public string OrderBy { get { throw null; } set { } } + public string PolicyDefinitionName { get { throw null; } } + public string Select { get { throw null; } set { } } + public System.DateTimeOffset? To { get { throw null; } set { } } + public int? Top { get { throw null; } set { } } + } + public partial class SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions + { + public SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions(Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource componentPolicyStatesResource) { } + public string Apply { get { throw null; } set { } } + public Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource ComponentPolicyStatesResource { get { throw null; } } + public string Filter { get { throw null; } set { } } + public System.DateTimeOffset? From { get { throw null; } set { } } + public string OrderBy { get { throw null; } set { } } + public string Select { get { throw null; } set { } } + public System.DateTimeOffset? To { get { throw null; } set { } } + public int? Top { get { throw null; } set { } } + } + public partial class SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions + { + public SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource componentPolicyStatesResource) { } + public string Apply { get { throw null; } set { } } + public Azure.ResourceManager.PolicyInsights.Models.ComponentPolicyStatesResource ComponentPolicyStatesResource { get { throw null; } } + public string Filter { get { throw null; } set { } } + public System.DateTimeOffset? From { get { throw null; } set { } } + public string OrderBy { get { throw null; } set { } } + public string PolicyAssignmentName { get { throw null; } } + public string Select { get { throw null; } set { } } + public System.DateTimeOffset? To { get { throw null; } set { } } + public int? Top { get { throw null; } set { } } + } public partial class TrackedResourceModificationDetails { internal TrackedResourceModificationDetails() { } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs index e7b540bd619e..096311866176 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs @@ -366,6 +366,156 @@ public static Response CheckPolicyRestrictions(th return GetExtensionClient(subscriptionResource).CheckPolicyRestrictions(content, cancellationToken); } + /// + /// Queries component policy states under subscription scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscription + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetQueryResultsForSubscriptionComponentPolicyStatesAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(subscriptionResource).GetQueryResultsForSubscriptionComponentPolicyStatesAsync(options, cancellationToken); + } + + /// + /// Queries component policy states under subscription scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscription + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetQueryResultsForSubscriptionComponentPolicyStates(this SubscriptionResource subscriptionResource, SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(subscriptionResource).GetQueryResultsForSubscriptionComponentPolicyStates(options, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetQueryResultsForPolicyDefinitionComponentPolicyStatesAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(subscriptionResource).GetQueryResultsForPolicyDefinitionComponentPolicyStatesAsync(options, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetQueryResultsForPolicyDefinitionComponentPolicyStates(this SubscriptionResource subscriptionResource, SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(subscriptionResource).GetQueryResultsForPolicyDefinitionComponentPolicyStates(options, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(subscriptionResource).GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesAsync(options, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStates(this SubscriptionResource subscriptionResource, SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(subscriptionResource).GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStates(options, cancellationToken); + } + private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) { return resourceGroupResource.GetCachedClient((client) => @@ -649,6 +799,106 @@ public static Response CheckPolicyRestrictions(th return GetExtensionClient(resourceGroupResource).CheckPolicyRestrictions(content, cancellationToken); } + /// + /// Queries component policy states under resource group scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroup + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetQueryResultsForResourceGroupComponentPolicyStatesAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(resourceGroupResource).GetQueryResultsForResourceGroupComponentPolicyStatesAsync(options, cancellationToken); + } + + /// + /// Queries component policy states under resource group scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroup + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetQueryResultsForResourceGroupComponentPolicyStates(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(resourceGroupResource).GetQueryResultsForResourceGroupComponentPolicyStates(options, cancellationToken); + } + + /// + /// Queries component policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(resourceGroupResource).GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesAsync(options, cancellationToken); + } + + /// + /// Queries component policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// The instance the method will execute against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStates(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return GetExtensionClient(resourceGroupResource).GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStates(options, cancellationToken); + } + private static ManagementGroupResourceExtensionClient GetExtensionClient(ManagementGroupResource managementGroupResource) { return managementGroupResource.GetCachedClient((client) => diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index 7ac88254f87e..2bda7f5cafa9 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -27,6 +27,8 @@ internal partial class ResourceGroupResourceExtensionClient : ArmResource private PolicyStatesRestOperations _policyStatesRestClient; private ClientDiagnostics _policyRestrictionsClientDiagnostics; private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; + private ClientDiagnostics _componentPolicyStatesClientDiagnostics; + private ComponentPolicyStatesRestOperations _componentPolicyStatesRestClient; /// Initializes a new instance of the class for mocking. protected ResourceGroupResourceExtensionClient() @@ -48,6 +50,8 @@ internal ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifi private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ComponentPolicyStatesClientDiagnostics => _componentPolicyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ComponentPolicyStatesRestOperations ComponentPolicyStatesRestClient => _componentPolicyStatesRestClient ??= new ComponentPolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -374,5 +378,93 @@ public virtual Response CheckPolicyRestrictions(C throw; } } + + /// + /// Queries component policy states under resource group scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroup + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForResourceGroupComponentPolicyStatesAsync(ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetQueryResultsForResourceGroupComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states under resource group scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroup + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForResourceGroupComponentPolicyStates(ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreatePageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetQueryResultsForResourceGroupComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesAsync(ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, options.PolicyAssignmentName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStates(ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, options.PolicyAssignmentName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreatePageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStates", "value", null, cancellationToken); + } } } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 43ef2a31f514..4b7aae1badb0 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -27,6 +27,8 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private PolicyStatesRestOperations _policyStatesRestClient; private ClientDiagnostics _policyRestrictionsClientDiagnostics; private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; + private ClientDiagnostics _componentPolicyStatesClientDiagnostics; + private ComponentPolicyStatesRestOperations _componentPolicyStatesRestClient; /// Initializes a new instance of the class for mocking. protected SubscriptionResourceExtensionClient() @@ -48,6 +50,8 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ComponentPolicyStatesClientDiagnostics => _componentPolicyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ComponentPolicyStatesRestOperations ComponentPolicyStatesRestClient => _componentPolicyStatesRestClient ??= new ComponentPolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -374,5 +378,137 @@ public virtual Response CheckPolicyRestrictions(C throw; } } + + /// + /// Queries component policy states under subscription scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscription + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForSubscriptionComponentPolicyStatesAsync(SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQueryResultsForSubscriptionComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states under subscription scope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscription + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForSubscriptionComponentPolicyStates(SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreatePageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQueryResultsForSubscriptionComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForPolicyDefinitionComponentPolicyStatesAsync(SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForPolicyDefinitionRequest(Id.SubscriptionId, options.PolicyDefinitionName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQueryResultsForPolicyDefinitionComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForPolicyDefinitionComponentPolicyStates(SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForPolicyDefinitionRequest(Id.SubscriptionId, options.PolicyDefinitionName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreatePageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQueryResultsForPolicyDefinitionComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesAsync(SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, options.PolicyAssignmentName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries component policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/componentPolicyStates/{componentPolicyStatesResource}/queryResults + /// + /// + /// Operation Id + /// ComponentPolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStates(SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions options, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ComponentPolicyStatesRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, options.PolicyAssignmentName, options.ComponentPolicyStatesResource, options.Top, options.OrderBy, options.Select, options.From, options.To, options.Filter, options.Apply); + return PageableHelpers.CreatePageable(FirstPageRequest, null, ComponentPolicyState.DeserializeComponentPolicyState, ComponentPolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStates", "value", null, cancellationToken); + } } } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentExpressionEvaluationDetails.Serialization.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentExpressionEvaluationDetails.Serialization.cs new file mode 100644 index 000000000000..7d2868ab7474 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentExpressionEvaluationDetails.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + public partial class ComponentExpressionEvaluationDetails + { + internal static ComponentExpressionEvaluationDetails DeserializeComponentExpressionEvaluationDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional result = default; + Optional expression = default; + Optional expressionKind = default; + Optional path = default; + Optional expressionValue = default; + Optional targetValue = default; + Optional @operator = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + result = property.Value.GetString(); + continue; + } + if (property.NameEquals("expression"u8)) + { + expression = property.Value.GetString(); + continue; + } + if (property.NameEquals("expressionKind"u8)) + { + expressionKind = property.Value.GetString(); + continue; + } + if (property.NameEquals("path"u8)) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("expressionValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + expressionValue = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("targetValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + targetValue = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = property.Value.GetString(); + continue; + } + } + return new ComponentExpressionEvaluationDetails(result.Value, expression.Value, expressionKind.Value, path.Value, expressionValue.Value, targetValue.Value, @operator.Value); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentExpressionEvaluationDetails.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentExpressionEvaluationDetails.cs new file mode 100644 index 000000000000..1cb5eb9ef42e --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentExpressionEvaluationDetails.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// Evaluation details of policy language expressions. + public partial class ComponentExpressionEvaluationDetails + { + /// Initializes a new instance of ComponentExpressionEvaluationDetails. + internal ComponentExpressionEvaluationDetails() + { + } + + /// Initializes a new instance of ComponentExpressionEvaluationDetails. + /// Evaluation result. + /// Expression evaluated. + /// The kind of expression that was evaluated. + /// Property path if the expression is a field or an alias. + /// Value of the expression. + /// Target value to be compared with the expression value. + /// Operator to compare the expression value and the target value. + internal ComponentExpressionEvaluationDetails(string result, string expression, string expressionKind, string path, BinaryData expressionValue, BinaryData targetValue, string @operator) + { + Result = result; + Expression = expression; + ExpressionKind = expressionKind; + Path = path; + ExpressionValue = expressionValue; + TargetValue = targetValue; + Operator = @operator; + } + + /// Evaluation result. + public string Result { get; } + /// Expression evaluated. + public string Expression { get; } + /// The kind of expression that was evaluated. + public string ExpressionKind { get; } + /// Property path if the expression is a field or an alias. + public string Path { get; } + /// + /// Value of the expression. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formated json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData ExpressionValue { get; } + /// + /// Target value to be compared with the expression value. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formated json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData TargetValue { get; } + /// Operator to compare the expression value and the target value. + public string Operator { get; } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyEvaluationDetails.Serialization.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyEvaluationDetails.Serialization.cs new file mode 100644 index 000000000000..83d6353bd5d8 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyEvaluationDetails.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + public partial class ComponentPolicyEvaluationDetails + { + internal static ComponentPolicyEvaluationDetails DeserializeComponentPolicyEvaluationDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> evaluatedExpressions = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("evaluatedExpressions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ComponentExpressionEvaluationDetails.DeserializeComponentExpressionEvaluationDetails(item)); + } + evaluatedExpressions = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new ComponentPolicyEvaluationDetails(Optional.ToList(evaluatedExpressions), reason.Value); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyEvaluationDetails.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyEvaluationDetails.cs new file mode 100644 index 000000000000..4700258f3a6f --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyEvaluationDetails.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// Policy evaluation details. + public partial class ComponentPolicyEvaluationDetails + { + /// Initializes a new instance of ComponentPolicyEvaluationDetails. + internal ComponentPolicyEvaluationDetails() + { + EvaluatedExpressions = new ChangeTrackingList(); + } + + /// Initializes a new instance of ComponentPolicyEvaluationDetails. + /// Details of the evaluated expressions. + /// Additional textual reason for the evaluation outcome. + internal ComponentPolicyEvaluationDetails(IReadOnlyList evaluatedExpressions, string reason) + { + EvaluatedExpressions = evaluatedExpressions; + Reason = reason; + } + + /// Details of the evaluated expressions. + public IReadOnlyList EvaluatedExpressions { get; } + /// Additional textual reason for the evaluation outcome. + public string Reason { get; } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyState.Serialization.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyState.Serialization.cs new file mode 100644 index 000000000000..0f8f953c6817 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyState.Serialization.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + public partial class ComponentPolicyState + { + internal static ComponentPolicyState DeserializeComponentPolicyState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional odataId = default; + Optional odataContext = default; + Optional timestamp = default; + Optional componentId = default; + Optional componentType = default; + Optional componentName = default; + Optional resourceId = default; + Optional policyAssignmentId = default; + Optional policyDefinitionId = default; + Optional subscriptionId = default; + Optional resourceType = default; + Optional resourceLocation = default; + Optional resourceGroup = default; + Optional policyAssignmentName = default; + Optional policyAssignmentOwner = default; + Optional policyAssignmentParameters = default; + Optional policyAssignmentScope = default; + Optional policyDefinitionName = default; + Optional policyDefinitionAction = default; + Optional policyDefinitionCategory = default; + Optional policySetDefinitionId = default; + Optional policySetDefinitionName = default; + Optional policySetDefinitionOwner = default; + Optional policySetDefinitionCategory = default; + Optional policySetDefinitionParameters = default; + Optional policyDefinitionReferenceId = default; + Optional complianceState = default; + Optional policyEvaluationDetails = default; + Optional> policyDefinitionGroupNames = default; + Optional policyDefinitionVersion = default; + Optional policySetDefinitionVersion = default; + Optional policyAssignmentVersion = default; + IReadOnlyDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("@odata.id"u8)) + { + odataId = property.Value.GetString(); + continue; + } + if (property.NameEquals("@odata.context"u8)) + { + odataContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("timestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("componentId"u8)) + { + componentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("componentType"u8)) + { + componentType = property.Value.GetString(); + continue; + } + if (property.NameEquals("componentName"u8)) + { + componentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyAssignmentId"u8)) + { + policyAssignmentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyDefinitionId"u8)) + { + policyDefinitionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceLocation"u8)) + { + resourceLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyAssignmentName"u8)) + { + policyAssignmentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyAssignmentOwner"u8)) + { + policyAssignmentOwner = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyAssignmentParameters"u8)) + { + policyAssignmentParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyAssignmentScope"u8)) + { + policyAssignmentScope = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyDefinitionName"u8)) + { + policyDefinitionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyDefinitionAction"u8)) + { + policyDefinitionAction = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyDefinitionCategory"u8)) + { + policyDefinitionCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("policySetDefinitionId"u8)) + { + policySetDefinitionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("policySetDefinitionName"u8)) + { + policySetDefinitionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("policySetDefinitionOwner"u8)) + { + policySetDefinitionOwner = property.Value.GetString(); + continue; + } + if (property.NameEquals("policySetDefinitionCategory"u8)) + { + policySetDefinitionCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("policySetDefinitionParameters"u8)) + { + policySetDefinitionParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyDefinitionReferenceId"u8)) + { + policyDefinitionReferenceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("complianceState"u8)) + { + complianceState = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyEvaluationDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + policyEvaluationDetails = ComponentPolicyEvaluationDetails.DeserializeComponentPolicyEvaluationDetails(property.Value); + continue; + } + if (property.NameEquals("policyDefinitionGroupNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + policyDefinitionGroupNames = array; + continue; + } + if (property.NameEquals("policyDefinitionVersion"u8)) + { + policyDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("policySetDefinitionVersion"u8)) + { + policySetDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("policyAssignmentVersion"u8)) + { + policyAssignmentVersion = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new ComponentPolicyState(odataId.Value, odataContext.Value, Optional.ToNullable(timestamp), componentId.Value, componentType.Value, componentName.Value, resourceId.Value, policyAssignmentId.Value, policyDefinitionId.Value, subscriptionId.Value, resourceType.Value, resourceLocation.Value, resourceGroup.Value, policyAssignmentName.Value, policyAssignmentOwner.Value, policyAssignmentParameters.Value, policyAssignmentScope.Value, policyDefinitionName.Value, policyDefinitionAction.Value, policyDefinitionCategory.Value, policySetDefinitionId.Value, policySetDefinitionName.Value, policySetDefinitionOwner.Value, policySetDefinitionCategory.Value, policySetDefinitionParameters.Value, policyDefinitionReferenceId.Value, complianceState.Value, policyEvaluationDetails.Value, Optional.ToList(policyDefinitionGroupNames), policyDefinitionVersion.Value, policySetDefinitionVersion.Value, policyAssignmentVersion.Value, additionalProperties); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyState.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyState.cs new file mode 100644 index 000000000000..064fded1fef6 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyState.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// Component Policy State record. + public partial class ComponentPolicyState + { + /// Initializes a new instance of ComponentPolicyState. + internal ComponentPolicyState() + { + PolicyDefinitionGroupNames = new ChangeTrackingList(); + AdditionalProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of ComponentPolicyState. + /// OData entity ID; always set to null since component policy state records do not have an entity ID. + /// OData context string; used by OData clients to resolve type information based on metadata. + /// Timestamp for the component policy state record. + /// Component Id. + /// Component type. + /// Component name. + /// Resource ID. + /// Policy assignment ID. + /// Policy definition ID. + /// Subscription ID. + /// Resource type. + /// Resource location. + /// Resource group name. + /// Policy assignment name. + /// Policy assignment owner. + /// Policy assignment parameters. + /// Policy assignment scope. + /// Policy definition name. + /// Policy definition action, i.e. effect. + /// Policy definition category. + /// Policy set definition ID, if the policy assignment is for a policy set. + /// Policy set definition name, if the policy assignment is for a policy set. + /// Policy set definition owner, if the policy assignment is for a policy set. + /// Policy set definition category, if the policy assignment is for a policy set. + /// Policy set definition parameters, if the policy assignment is for a policy set. + /// Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + /// Compliance state of the resource. + /// Policy evaluation details. This is only included in the response if the request contains $expand=PolicyEvaluationDetails. + /// Policy definition group names. + /// Evaluated policy definition version. + /// Evaluated policy set definition version. + /// Evaluated policy assignment version. + /// Additional Properties. + internal ComponentPolicyState(string odataId, string odataContext, DateTimeOffset? timestamp, string componentId, string componentType, string componentName, string resourceId, string policyAssignmentId, string policyDefinitionId, string subscriptionId, string resourceType, string resourceLocation, string resourceGroup, string policyAssignmentName, string policyAssignmentOwner, string policyAssignmentParameters, string policyAssignmentScope, string policyDefinitionName, string policyDefinitionAction, string policyDefinitionCategory, string policySetDefinitionId, string policySetDefinitionName, string policySetDefinitionOwner, string policySetDefinitionCategory, string policySetDefinitionParameters, string policyDefinitionReferenceId, string complianceState, ComponentPolicyEvaluationDetails policyEvaluationDetails, IReadOnlyList policyDefinitionGroupNames, string policyDefinitionVersion, string policySetDefinitionVersion, string policyAssignmentVersion, IReadOnlyDictionary additionalProperties) + { + ODataId = odataId; + ODataContext = odataContext; + Timestamp = timestamp; + ComponentId = componentId; + ComponentType = componentType; + ComponentName = componentName; + ResourceId = resourceId; + PolicyAssignmentId = policyAssignmentId; + PolicyDefinitionId = policyDefinitionId; + SubscriptionId = subscriptionId; + ResourceType = resourceType; + ResourceLocation = resourceLocation; + ResourceGroup = resourceGroup; + PolicyAssignmentName = policyAssignmentName; + PolicyAssignmentOwner = policyAssignmentOwner; + PolicyAssignmentParameters = policyAssignmentParameters; + PolicyAssignmentScope = policyAssignmentScope; + PolicyDefinitionName = policyDefinitionName; + PolicyDefinitionAction = policyDefinitionAction; + PolicyDefinitionCategory = policyDefinitionCategory; + PolicySetDefinitionId = policySetDefinitionId; + PolicySetDefinitionName = policySetDefinitionName; + PolicySetDefinitionOwner = policySetDefinitionOwner; + PolicySetDefinitionCategory = policySetDefinitionCategory; + PolicySetDefinitionParameters = policySetDefinitionParameters; + PolicyDefinitionReferenceId = policyDefinitionReferenceId; + ComplianceState = complianceState; + PolicyEvaluationDetails = policyEvaluationDetails; + PolicyDefinitionGroupNames = policyDefinitionGroupNames; + PolicyDefinitionVersion = policyDefinitionVersion; + PolicySetDefinitionVersion = policySetDefinitionVersion; + PolicyAssignmentVersion = policyAssignmentVersion; + AdditionalProperties = additionalProperties; + } + + /// OData entity ID; always set to null since component policy state records do not have an entity ID. + public string ODataId { get; } + /// OData context string; used by OData clients to resolve type information based on metadata. + public string ODataContext { get; } + /// Timestamp for the component policy state record. + public DateTimeOffset? Timestamp { get; } + /// Component Id. + public string ComponentId { get; } + /// Component type. + public string ComponentType { get; } + /// Component name. + public string ComponentName { get; } + /// Resource ID. + public string ResourceId { get; } + /// Policy assignment ID. + public string PolicyAssignmentId { get; } + /// Policy definition ID. + public string PolicyDefinitionId { get; } + /// Subscription ID. + public string SubscriptionId { get; } + /// Resource type. + public string ResourceType { get; } + /// Resource location. + public string ResourceLocation { get; } + /// Resource group name. + public string ResourceGroup { get; } + /// Policy assignment name. + public string PolicyAssignmentName { get; } + /// Policy assignment owner. + public string PolicyAssignmentOwner { get; } + /// Policy assignment parameters. + public string PolicyAssignmentParameters { get; } + /// Policy assignment scope. + public string PolicyAssignmentScope { get; } + /// Policy definition name. + public string PolicyDefinitionName { get; } + /// Policy definition action, i.e. effect. + public string PolicyDefinitionAction { get; } + /// Policy definition category. + public string PolicyDefinitionCategory { get; } + /// Policy set definition ID, if the policy assignment is for a policy set. + public string PolicySetDefinitionId { get; } + /// Policy set definition name, if the policy assignment is for a policy set. + public string PolicySetDefinitionName { get; } + /// Policy set definition owner, if the policy assignment is for a policy set. + public string PolicySetDefinitionOwner { get; } + /// Policy set definition category, if the policy assignment is for a policy set. + public string PolicySetDefinitionCategory { get; } + /// Policy set definition parameters, if the policy assignment is for a policy set. + public string PolicySetDefinitionParameters { get; } + /// Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + public string PolicyDefinitionReferenceId { get; } + /// Compliance state of the resource. + public string ComplianceState { get; } + /// Policy evaluation details. This is only included in the response if the request contains $expand=PolicyEvaluationDetails. + public ComponentPolicyEvaluationDetails PolicyEvaluationDetails { get; } + /// Policy definition group names. + public IReadOnlyList PolicyDefinitionGroupNames { get; } + /// Evaluated policy definition version. + public string PolicyDefinitionVersion { get; } + /// Evaluated policy set definition version. + public string PolicySetDefinitionVersion { get; } + /// Evaluated policy assignment version. + public string PolicyAssignmentVersion { get; } + /// + /// Additional Properties + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formated json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IReadOnlyDictionary AdditionalProperties { get; } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesQueryResults.Serialization.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesQueryResults.Serialization.cs new file mode 100644 index 000000000000..dec56f0fda6a --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesQueryResults.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + internal partial class ComponentPolicyStatesQueryResults + { + internal static ComponentPolicyStatesQueryResults DeserializeComponentPolicyStatesQueryResults(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional odataContext = default; + Optional odataCount = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("@odata.context"u8)) + { + odataContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("@odata.count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + odataCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ComponentPolicyState.DeserializeComponentPolicyState(item)); + } + value = array; + continue; + } + } + return new ComponentPolicyStatesQueryResults(odataContext.Value, Optional.ToNullable(odataCount), Optional.ToList(value)); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesQueryResults.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesQueryResults.cs new file mode 100644 index 000000000000..6f9b29aa6624 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesQueryResults.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// Query results. + internal partial class ComponentPolicyStatesQueryResults + { + /// Initializes a new instance of ComponentPolicyStatesQueryResults. + internal ComponentPolicyStatesQueryResults() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ComponentPolicyStatesQueryResults. + /// OData context string; used by OData clients to resolve type information based on metadata. + /// OData entity count; represents the number of policy state records returned. + /// Query results. + internal ComponentPolicyStatesQueryResults(string odataContext, int? odataCount, IReadOnlyList value) + { + ODataContext = odataContext; + ODataCount = odataCount; + Value = value; + } + + /// OData context string; used by OData clients to resolve type information based on metadata. + public string ODataContext { get; } + /// OData entity count; represents the number of policy state records returned. + public int? ODataCount { get; } + /// Query results. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesResource.cs new file mode 100644 index 000000000000..161175edd1f5 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ComponentPolicyStatesResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// The ComponentPolicyStatesResource. + public readonly partial struct ComponentPolicyStatesResource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ComponentPolicyStatesResource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LatestValue = "latest"; + + /// latest. + public static ComponentPolicyStatesResource Latest { get; } = new ComponentPolicyStatesResource(LatestValue); + /// Determines if two values are the same. + public static bool operator ==(ComponentPolicyStatesResource left, ComponentPolicyStatesResource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ComponentPolicyStatesResource left, ComponentPolicyStatesResource right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ComponentPolicyStatesResource(string value) => new ComponentPolicyStatesResource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ComponentPolicyStatesResource other && Equals(other); + /// + public bool Equals(ComponentPolicyStatesResource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions.cs new file mode 100644 index 000000000000..2e331fe8f5cc --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// The ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions. + public partial class ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions + { + /// Initializes a new instance of ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + public ResourceGroupResourceGetQueryResultsForResourceGroupComponentPolicyStatesOptions(ComponentPolicyStatesResource componentPolicyStatesResource) + { + ComponentPolicyStatesResource = componentPolicyStatesResource; + } + + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + public ComponentPolicyStatesResource ComponentPolicyStatesResource { get; } + /// Maximum number of records to return. + public int? Top { get; set; } = null; + + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + public string OrderBy { get; set; } = null; + + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + public string Select { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + public DateTimeOffset? From { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + public DateTimeOffset? To { get; set; } = null; + + /// OData filter expression. + public string Filter { get; set; } = null; + + /// OData apply expression for aggregations. + public string Apply { get; set; } = null; + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions.cs new file mode 100644 index 000000000000..bda924707afa --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// The ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions. + public partial class ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions + { + /// Initializes a new instance of ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions. + /// Policy assignment name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// is null. + public ResourceGroupResourceGetQueryResultsForResourceGroupLevelPolicyAssignmentComponentPolicyStatesOptions(string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource) + { + Argument.AssertNotNull(policyAssignmentName, nameof(policyAssignmentName)); + + PolicyAssignmentName = policyAssignmentName; + ComponentPolicyStatesResource = componentPolicyStatesResource; + } + + /// Policy assignment name. + public string PolicyAssignmentName { get; } + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + public ComponentPolicyStatesResource ComponentPolicyStatesResource { get; } + /// Maximum number of records to return. + public int? Top { get; set; } = null; + + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + public string OrderBy { get; set; } = null; + + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + public string Select { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + public DateTimeOffset? From { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + public DateTimeOffset? To { get; set; } = null; + + /// OData filter expression. + public string Filter { get; set; } = null; + + /// OData apply expression for aggregations. + public string Apply { get; set; } = null; + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions.cs new file mode 100644 index 000000000000..b1b293ba77cd --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// The SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions. + public partial class SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions + { + /// Initializes a new instance of SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions. + /// Policy definition name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// is null. + public SubscriptionResourceGetQueryResultsForPolicyDefinitionComponentPolicyStatesOptions(string policyDefinitionName, ComponentPolicyStatesResource componentPolicyStatesResource) + { + Argument.AssertNotNull(policyDefinitionName, nameof(policyDefinitionName)); + + PolicyDefinitionName = policyDefinitionName; + ComponentPolicyStatesResource = componentPolicyStatesResource; + } + + /// Policy definition name. + public string PolicyDefinitionName { get; } + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + public ComponentPolicyStatesResource ComponentPolicyStatesResource { get; } + /// Maximum number of records to return. + public int? Top { get; set; } = null; + + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + public string OrderBy { get; set; } = null; + + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + public string Select { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + public DateTimeOffset? From { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + public DateTimeOffset? To { get; set; } = null; + + /// OData filter expression. + public string Filter { get; set; } = null; + + /// OData apply expression for aggregations. + public string Apply { get; set; } = null; + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions.cs new file mode 100644 index 000000000000..1fe89ebf2314 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// The SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions. + public partial class SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions + { + /// Initializes a new instance of SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + public SubscriptionResourceGetQueryResultsForSubscriptionComponentPolicyStatesOptions(ComponentPolicyStatesResource componentPolicyStatesResource) + { + ComponentPolicyStatesResource = componentPolicyStatesResource; + } + + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + public ComponentPolicyStatesResource ComponentPolicyStatesResource { get; } + /// Maximum number of records to return. + public int? Top { get; set; } = null; + + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + public string OrderBy { get; set; } = null; + + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + public string Select { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + public DateTimeOffset? From { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + public DateTimeOffset? To { get; set; } = null; + + /// OData filter expression. + public string Filter { get; set; } = null; + + /// OData apply expression for aggregations. + public string Apply { get; set; } = null; + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions.cs new file mode 100644 index 000000000000..de3e3d530841 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Models/SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// The SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions. + public partial class SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions + { + /// Initializes a new instance of SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions. + /// Policy assignment name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// is null. + public SubscriptionResourceGetQueryResultsForSubscriptionLevelPolicyAssignmentComponentPolicyStatesOptions(string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource) + { + Argument.AssertNotNull(policyAssignmentName, nameof(policyAssignmentName)); + + PolicyAssignmentName = policyAssignmentName; + ComponentPolicyStatesResource = componentPolicyStatesResource; + } + + /// Policy assignment name. + public string PolicyAssignmentName { get; } + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + public ComponentPolicyStatesResource ComponentPolicyStatesResource { get; } + /// Maximum number of records to return. + public int? Top { get; set; } = null; + + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + public string OrderBy { get; set; } = null; + + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + public string Select { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + public DateTimeOffset? From { get; set; } = null; + + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + public DateTimeOffset? To { get; set; } = null; + + /// OData filter expression. + public string Filter { get; set; } = null; + + /// OData apply expression for aggregations. + public string Apply { get; set; } = null; + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationData.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationData.cs index 089c89875067..878164271710 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationData.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationData.cs @@ -32,7 +32,7 @@ public PolicyRemediationData() /// The resource ID of the policy assignment that should be remediated. /// 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. /// The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified. - /// The status of the remediation. + /// The status of the remediation. This refers to the entire remediation task, not individual deployments. Allowed values are Evaluating, Canceled, Cancelling, Failed, Complete, or Succeeded. /// The time at which the remediation was created. /// The time at which the remediation was last updated. /// The filters that will be applied to determine which resources to remediate. @@ -65,7 +65,7 @@ internal PolicyRemediationData(ResourceIdentifier id, string name, ResourceType public string PolicyDefinitionReferenceId { get; set; } /// The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified. public ResourceDiscoveryMode? ResourceDiscoveryMode { get; set; } - /// The status of the remediation. + /// The status of the remediation. This refers to the entire remediation task, not individual deployments. Allowed values are Evaluating, Canceled, Cancelling, Failed, Complete, or Succeeded. public string ProvisioningState { get; } /// The time at which the remediation was created. public DateTimeOffset? CreatedOn { get; } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/RestOperations/ComponentPolicyStatesRestOperations.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/RestOperations/ComponentPolicyStatesRestOperations.cs new file mode 100644 index 000000000000..431624a86d57 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/RestOperations/ComponentPolicyStatesRestOperations.cs @@ -0,0 +1,758 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights +{ + internal partial class ComponentPolicyStatesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ComponentPolicyStatesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ComponentPolicyStatesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-04-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListQueryResultsForSubscriptionRequest(string subscriptionId, ComponentPolicyStatesResource componentPolicyStatesResource, int? top, string orderBy, string select, DateTimeOffset? @from, DateTimeOffset? to, string filter, string apply) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.PolicyInsights/componentPolicyStates/", false); + uri.AppendPath(componentPolicyStatesResource.ToString(), true); + uri.AppendPath("/queryResults", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (select != null) + { + uri.AppendQuery("$select", select, true); + } + if (@from != null) + { + uri.AppendQuery("$from", @from.Value, "O", true); + } + if (to != null) + { + uri.AppendQuery("$to", to.Value, "O", true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (apply != null) + { + uri.AppendQuery("$apply", apply, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Queries component policy states under subscription scope. + /// Microsoft Azure subscription ID. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListQueryResultsForSubscriptionAsync(string subscriptionId, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListQueryResultsForSubscriptionRequest(subscriptionId, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Queries component policy states under subscription scope. + /// Microsoft Azure subscription ID. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListQueryResultsForSubscription(string subscriptionId, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListQueryResultsForSubscriptionRequest(subscriptionId, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListQueryResultsForResourceGroupRequest(string subscriptionId, string resourceGroupName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top, string orderBy, string select, DateTimeOffset? @from, DateTimeOffset? to, string filter, string apply) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.PolicyInsights/componentPolicyStates/", false); + uri.AppendPath(componentPolicyStatesResource.ToString(), true); + uri.AppendPath("/queryResults", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (select != null) + { + uri.AppendQuery("$select", select, true); + } + if (@from != null) + { + uri.AppendQuery("$from", @from.Value, "O", true); + } + if (to != null) + { + uri.AppendQuery("$to", to.Value, "O", true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (apply != null) + { + uri.AppendQuery("$apply", apply, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Queries component policy states under resource group scope. + /// Microsoft Azure subscription ID. + /// Resource group name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListQueryResultsForResourceGroupAsync(string subscriptionId, string resourceGroupName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListQueryResultsForResourceGroupRequest(subscriptionId, resourceGroupName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Queries component policy states under resource group scope. + /// Microsoft Azure subscription ID. + /// Resource group name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListQueryResultsForResourceGroup(string subscriptionId, string resourceGroupName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListQueryResultsForResourceGroupRequest(subscriptionId, resourceGroupName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListQueryResultsForResourceRequest(string resourceId, ComponentPolicyStatesResource componentPolicyStatesResource, int? top, string orderBy, string select, DateTimeOffset? @from, DateTimeOffset? to, string filter, string apply, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceId, false); + uri.AppendPath("/providers/Microsoft.PolicyInsights/componentPolicyStates/", false); + uri.AppendPath(componentPolicyStatesResource.ToString(), true); + uri.AppendPath("/queryResults", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (select != null) + { + uri.AppendQuery("$select", select, true); + } + if (@from != null) + { + uri.AppendQuery("$from", @from.Value, "O", true); + } + if (to != null) + { + uri.AppendQuery("$to", to.Value, "O", true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (apply != null) + { + uri.AppendQuery("$apply", apply, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Queries component policy states for the resource. + /// Resource ID. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The $expand query parameter. + /// The cancellation token to use. + /// is null. + public async Task> ListQueryResultsForResourceAsync(string resourceId, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + using var message = CreateListQueryResultsForResourceRequest(resourceId, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Queries component policy states for the resource. + /// Resource ID. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The $expand query parameter. + /// The cancellation token to use. + /// is null. + public Response ListQueryResultsForResource(string resourceId, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + using var message = CreateListQueryResultsForResourceRequest(resourceId, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListQueryResultsForPolicyDefinitionRequest(string subscriptionId, string policyDefinitionName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top, string orderBy, string select, DateTimeOffset? @from, DateTimeOffset? to, string filter, string apply) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/", false); + uri.AppendPath("Microsoft.Authorization", true); + uri.AppendPath("/policyDefinitions/", false); + uri.AppendPath(policyDefinitionName, true); + uri.AppendPath("/providers/Microsoft.PolicyInsights/componentPolicyStates/", false); + uri.AppendPath(componentPolicyStatesResource.ToString(), true); + uri.AppendPath("/queryResults", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (select != null) + { + uri.AppendQuery("$select", select, true); + } + if (@from != null) + { + uri.AppendQuery("$from", @from.Value, "O", true); + } + if (to != null) + { + uri.AppendQuery("$to", to.Value, "O", true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (apply != null) + { + uri.AppendQuery("$apply", apply, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Queries component policy states for the subscription level policy definition. + /// Microsoft Azure subscription ID. + /// Policy definition name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListQueryResultsForPolicyDefinitionAsync(string subscriptionId, string policyDefinitionName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var message = CreateListQueryResultsForPolicyDefinitionRequest(subscriptionId, policyDefinitionName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Queries component policy states for the subscription level policy definition. + /// Microsoft Azure subscription ID. + /// Policy definition name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListQueryResultsForPolicyDefinition(string subscriptionId, string policyDefinitionName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + using var message = CreateListQueryResultsForPolicyDefinitionRequest(subscriptionId, policyDefinitionName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(string subscriptionId, string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top, string orderBy, string select, DateTimeOffset? @from, DateTimeOffset? to, string filter, string apply) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/", false); + uri.AppendPath("Microsoft.Authorization", true); + uri.AppendPath("/policyAssignments/", false); + uri.AppendPath(policyAssignmentName, true); + uri.AppendPath("/providers/Microsoft.PolicyInsights/componentPolicyStates/", false); + uri.AppendPath(componentPolicyStatesResource.ToString(), true); + uri.AppendPath("/queryResults", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (select != null) + { + uri.AppendQuery("$select", select, true); + } + if (@from != null) + { + uri.AppendQuery("$from", @from.Value, "O", true); + } + if (to != null) + { + uri.AppendQuery("$to", to.Value, "O", true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (apply != null) + { + uri.AppendQuery("$apply", apply, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Queries component policy states for the subscription level policy assignment. + /// Microsoft Azure subscription ID. + /// Policy assignment name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListQueryResultsForSubscriptionLevelPolicyAssignmentAsync(string subscriptionId, string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + using var message = CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(subscriptionId, policyAssignmentName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Queries component policy states for the subscription level policy assignment. + /// Microsoft Azure subscription ID. + /// Policy assignment name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListQueryResultsForSubscriptionLevelPolicyAssignment(string subscriptionId, string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + using var message = CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(subscriptionId, policyAssignmentName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(string subscriptionId, string resourceGroupName, string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top, string orderBy, string select, DateTimeOffset? @from, DateTimeOffset? to, string filter, string apply) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/", false); + uri.AppendPath("Microsoft.Authorization", true); + uri.AppendPath("/policyAssignments/", false); + uri.AppendPath(policyAssignmentName, true); + uri.AppendPath("/providers/Microsoft.PolicyInsights/componentPolicyStates/", false); + uri.AppendPath(componentPolicyStatesResource.ToString(), true); + uri.AppendPath("/queryResults", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (select != null) + { + uri.AppendQuery("$select", select, true); + } + if (@from != null) + { + uri.AppendQuery("$from", @from.Value, "O", true); + } + if (to != null) + { + uri.AppendQuery("$to", to.Value, "O", true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (apply != null) + { + uri.AppendQuery("$apply", apply, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Queries component policy states for the resource group level policy assignment. + /// Microsoft Azure subscription ID. + /// Resource group name. + /// Policy assignment name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListQueryResultsForResourceGroupLevelPolicyAssignmentAsync(string subscriptionId, string resourceGroupName, string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + using var message = CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(subscriptionId, resourceGroupName, policyAssignmentName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Queries component policy states for the resource group level policy assignment. + /// Microsoft Azure subscription ID. + /// Resource group name. + /// Policy assignment name. + /// The virtual resource under ComponentPolicyStates resource type. In a given time range, 'latest' represents the latest component policy state(s). + /// Maximum number of records to return. + /// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". + /// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId". + /// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day). + /// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time. + /// OData filter expression. + /// OData apply expression for aggregations. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListQueryResultsForResourceGroupLevelPolicyAssignment(string subscriptionId, string resourceGroupName, string policyAssignmentName, ComponentPolicyStatesResource componentPolicyStatesResource, int? top = null, string orderBy = null, string select = null, DateTimeOffset? @from = null, DateTimeOffset? to = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + using var message = CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(subscriptionId, resourceGroupName, policyAssignmentName, componentPolicyStatesResource, top, orderBy, select, @from, to, filter, apply); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentPolicyStatesQueryResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentPolicyStatesQueryResults.DeserializeComponentPolicyStatesQueryResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md index 84792df182db..83a71a29f961 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md @@ -9,7 +9,7 @@ generate-model-factory: false csharp: true library-name: PolicyInsights namespace: Azure.ResourceManager.PolicyInsights -require: https://github.com/Azure/azure-rest-api-specs/blob/05a9cdab363b8ec824094ee73950c04594325172/specification/policyinsights/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/policyinsights/resource-manager/readme.md tag: package-2022-09 output-folder: $(this-folder)/Generated clear-output-folder: true