diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/CHANGELOG.md b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/CHANGELOG.md index 525a82a70fff3..2db8c0b57b963 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/CHANGELOG.md +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/CHANGELOG.md @@ -1,15 +1,20 @@ # Release History -## 1.2.0-beta.1 (Unreleased) +## 1.2.0-beta.1 (2023-05-31) ### Features Added -### Breaking Changes +- Enable the model factory feature for model mocking, more information can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-mocking-factory-builder). ### Bugs Fixed +- Fixed an issue that exception throws when ResourceIdentifier type field is empty during deserialization of PolicyDetails. + ### Other Changes +- Upgraded dependent Azure.Core to 1.32.0. +- Upgraded dependent Azure.ResourceManager to 1.6.0. + ## 1.1.0 (2023-02-16) ### Features Added 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 889afdb07f7e3..7d01e813f43c7 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 @@ -207,6 +207,36 @@ protected PolicyRemediationResource() { } } namespace Azure.ResourceManager.PolicyInsights.Models { + public static partial class ArmPolicyInsightsModelFactory + { + public static Azure.ResourceManager.PolicyInsights.Models.CheckPolicyRestrictionsResult CheckPolicyRestrictionsResult(System.Collections.Generic.IEnumerable fieldRestrictions = null, System.Collections.Generic.IEnumerable policyEvaluations = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.ComplianceDetail ComplianceDetail(string complianceState = null, int? count = default(int?)) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.ComponentEventDetails ComponentEventDetails(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), System.Guid? tenantId = default(System.Guid?), string principalOid = null, string policyDefinitionAction = null, System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.ComponentStateDetails ComponentStateDetails(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), string complianceState = null, System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.ExpressionEvaluationDetails ExpressionEvaluationDetails(string result = null, string expression = null, string expressionKind = null, string path = null, System.BinaryData expressionValue = null, System.BinaryData targetValue = null, string @operator = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.FieldRestriction FieldRestriction(Azure.ResourceManager.PolicyInsights.Models.FieldRestrictionResult? result = default(Azure.ResourceManager.PolicyInsights.Models.FieldRestrictionResult?), string defaultValue = null, System.Collections.Generic.IEnumerable values = null, Azure.ResourceManager.PolicyInsights.Models.PolicyReference policy = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.FieldRestrictions FieldRestrictions(string field = null, System.Collections.Generic.IEnumerable restrictions = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.IfNotExistsEvaluationDetails IfNotExistsEvaluationDetails(Azure.Core.ResourceIdentifier resourceId = null, int? totalResources = default(int?)) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyAssignmentSummary PolicyAssignmentSummary(Azure.Core.ResourceIdentifier policyAssignmentId = null, Azure.Core.ResourceIdentifier policySetDefinitionId = null, Azure.ResourceManager.PolicyInsights.Models.PolicySummaryResults results = null, System.Collections.Generic.IEnumerable policyDefinitions = null, System.Collections.Generic.IEnumerable policyGroups = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.PolicyAttestationData PolicyAttestationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier policyAssignmentId = null, string policyDefinitionReferenceId = null, Azure.ResourceManager.PolicyInsights.Models.PolicyComplianceState? complianceState = default(Azure.ResourceManager.PolicyInsights.Models.PolicyComplianceState?), System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), string owner = null, string comments = null, System.Collections.Generic.IEnumerable evidence = null, string provisioningState = null, System.DateTimeOffset? lastComplianceStateChangeOn = default(System.DateTimeOffset?), System.DateTimeOffset? assessOn = default(System.DateTimeOffset?), System.BinaryData metadata = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyDefinitionSummary PolicyDefinitionSummary(Azure.Core.ResourceIdentifier policyDefinitionId = null, string policyDefinitionReferenceId = null, System.Collections.Generic.IEnumerable policyDefinitionGroupNames = null, string effect = null, Azure.ResourceManager.PolicyInsights.Models.PolicySummaryResults results = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyDetails PolicyDetails(Azure.Core.ResourceIdentifier policyDefinitionId = null, Azure.Core.ResourceIdentifier policyAssignmentId = null, string policyAssignmentDisplayName = null, string policyAssignmentScope = null, Azure.Core.ResourceIdentifier policySetDefinitionId = null, string policyDefinitionReferenceId = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyEvaluationDetails PolicyEvaluationDetails(System.Collections.Generic.IEnumerable evaluatedExpressions = null, Azure.ResourceManager.PolicyInsights.Models.IfNotExistsEvaluationDetails ifNotExistsDetails = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyEvaluationResult PolicyEvaluationResult(Azure.ResourceManager.PolicyInsights.Models.PolicyReference policyInfo = null, string evaluationResult = null, Azure.ResourceManager.PolicyInsights.Models.PolicyEvaluationDetails evaluationDetails = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyEvent PolicyEvent(string odataId = null, string odataContext = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier resourceId = null, Azure.Core.ResourceIdentifier policyAssignmentId = null, Azure.Core.ResourceIdentifier policyDefinitionId = null, string effectiveParameters = null, bool? isCompliant = default(bool?), string subscriptionId = null, string resourceTypeString = null, Azure.Core.AzureLocation? resourceLocation = default(Azure.Core.AzureLocation?), string resourceGroup = null, string resourceTags = null, string policyAssignmentName = null, string policyAssignmentOwner = null, string policyAssignmentParameters = null, string policyAssignmentScope = null, string policyDefinitionName = null, string policyDefinitionAction = null, string policyDefinitionCategory = null, Azure.Core.ResourceIdentifier policySetDefinitionId = null, string policySetDefinitionName = null, string policySetDefinitionOwner = null, string policySetDefinitionCategory = null, string policySetDefinitionParameters = null, string managementGroupIds = null, string policyDefinitionReferenceId = null, string complianceState = null, System.Guid? tenantId = default(System.Guid?), string principalOid = null, System.Collections.Generic.IEnumerable components = null, System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyGroupSummary PolicyGroupSummary(string policyGroupName = null, Azure.ResourceManager.PolicyInsights.Models.PolicySummaryResults results = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.PolicyMetadataData PolicyMetadataData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string metadataId = null, string category = null, string title = null, string owner = null, System.Uri additionalContentUri = null, System.BinaryData metadata = null, string description = null, string requirements = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyReference PolicyReference(Azure.Core.ResourceIdentifier policyDefinitionId = null, Azure.Core.ResourceIdentifier policySetDefinitionId = null, string policyDefinitionReferenceId = null, Azure.Core.ResourceIdentifier policyAssignmentId = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.PolicyRemediationData PolicyRemediationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier policyAssignmentId = null, string policyDefinitionReferenceId = null, Azure.ResourceManager.PolicyInsights.Models.ResourceDiscoveryMode? resourceDiscoveryMode = default(Azure.ResourceManager.PolicyInsights.Models.ResourceDiscoveryMode?), string provisioningState = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.DateTimeOffset? lastUpdatedOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable filterLocations = null, Azure.ResourceManager.PolicyInsights.Models.RemediationDeploymentSummary deploymentStatus = null, string statusMessage = null, string correlationId = null, int? resourceCount = default(int?), int? parallelDeployments = default(int?), float? failureThresholdPercentage = default(float?)) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyState PolicyState(string odataId = null, string odataContext = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier resourceId = null, Azure.Core.ResourceIdentifier policyAssignmentId = null, Azure.Core.ResourceIdentifier policyDefinitionId = null, string effectiveParameters = null, bool? isCompliant = default(bool?), string subscriptionId = null, string resourceTypeString = null, Azure.Core.AzureLocation? resourceLocation = default(Azure.Core.AzureLocation?), string resourceGroup = null, string resourceTags = null, string policyAssignmentName = null, string policyAssignmentOwner = null, string policyAssignmentParameters = null, string policyAssignmentScope = null, string policyDefinitionName = null, string policyDefinitionAction = null, string policyDefinitionCategory = null, Azure.Core.ResourceIdentifier policySetDefinitionId = null, string policySetDefinitionName = null, string policySetDefinitionOwner = null, string policySetDefinitionCategory = null, string policySetDefinitionParameters = null, string managementGroupIds = null, string policyDefinitionReferenceId = null, string complianceState = null, Azure.ResourceManager.PolicyInsights.Models.PolicyEvaluationDetails policyEvaluationDetails = null, System.Collections.Generic.IEnumerable policyDefinitionGroupNames = null, System.Collections.Generic.IEnumerable components = null, string policyDefinitionVersion = null, string policySetDefinitionVersion = null, string policyAssignmentVersion = null, System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicySummary PolicySummary(string odataId = null, string odataContext = null, Azure.ResourceManager.PolicyInsights.Models.PolicySummaryResults results = null, System.Collections.Generic.IEnumerable policyAssignments = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicySummaryResults PolicySummaryResults(System.Uri queryResultsUri = null, int? nonCompliantResources = default(int?), int? nonCompliantPolicies = default(int?), System.Collections.Generic.IEnumerable resourceDetails = null, System.Collections.Generic.IEnumerable policyDetails = null, System.Collections.Generic.IEnumerable policyGroupDetails = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceRecord PolicyTrackedResourceRecord(Azure.Core.ResourceIdentifier trackedResourceId = null, Azure.ResourceManager.PolicyInsights.Models.PolicyDetails policyDetails = null, Azure.ResourceManager.PolicyInsights.Models.TrackedResourceModificationDetails createdBy = null, Azure.ResourceManager.PolicyInsights.Models.TrackedResourceModificationDetails lastModifiedBy = null, System.DateTimeOffset? lastUpdateOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.RemediationDeployment RemediationDeployment(Azure.Core.ResourceIdentifier remediatedResourceId = null, Azure.Core.ResourceIdentifier deploymentId = null, string status = null, Azure.Core.AzureLocation? resourceLocation = default(Azure.Core.AzureLocation?), Azure.ResponseError error = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.DateTimeOffset? lastUpdatedOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.RemediationDeploymentSummary RemediationDeploymentSummary(int? totalDeployments = default(int?), int? successfulDeployments = default(int?), int? failedDeployments = default(int?)) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.SlimPolicyMetadata SlimPolicyMetadata(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string metadataId = null, string category = null, string title = null, string owner = null, System.Uri additionalContentUri = null, System.BinaryData metadata = null) { throw null; } + public static Azure.ResourceManager.PolicyInsights.Models.TrackedResourceModificationDetails TrackedResourceModificationDetails(Azure.ResourceManager.PolicyInsights.Models.PolicyDetails policyDetails = null, Azure.Core.ResourceIdentifier deploymentId = null, System.DateTimeOffset? deploymentOn = default(System.DateTimeOffset?)) { throw null; } + } public partial class AttestationEvidence { public AttestationEvidence() { } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/ArmPolicyInsightsModelFactory.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/ArmPolicyInsightsModelFactory.cs new file mode 100644 index 0000000000000..3f0129fed7fd5 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/ArmPolicyInsightsModelFactory.cs @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.PolicyInsights; + +namespace Azure.ResourceManager.PolicyInsights.Models +{ + /// Model factory for models. + public static partial class ArmPolicyInsightsModelFactory + { + /// Initializes a new instance of PolicyTrackedResourceRecord. + /// The ID of the policy tracked resource. + /// The details of the policy that require the tracked resource. + /// The details of the policy triggered deployment that created the tracked resource. + /// The details of the policy triggered deployment that modified the tracked resource. + /// Timestamp of the last update to the tracked resource. + /// A new instance for mocking. + public static PolicyTrackedResourceRecord PolicyTrackedResourceRecord(ResourceIdentifier trackedResourceId = null, PolicyDetails policyDetails = null, TrackedResourceModificationDetails createdBy = null, TrackedResourceModificationDetails lastModifiedBy = null, DateTimeOffset? lastUpdateOn = null) + { + return new PolicyTrackedResourceRecord(trackedResourceId, policyDetails, createdBy, lastModifiedBy, lastUpdateOn); + } + + /// Initializes a new instance of PolicyDetails. + /// The ID of the policy definition. + /// The ID of the policy assignment. + /// The display name of the policy assignment. + /// The scope of the policy assignment. + /// The ID of the policy set definition. + /// The policy definition reference ID within the policy set definition. + /// A new instance for mocking. + public static PolicyDetails PolicyDetails(ResourceIdentifier policyDefinitionId = null, ResourceIdentifier policyAssignmentId = null, string policyAssignmentDisplayName = null, string policyAssignmentScope = null, ResourceIdentifier policySetDefinitionId = null, string policyDefinitionReferenceId = null) + { + return new PolicyDetails(policyDefinitionId, policyAssignmentId, policyAssignmentDisplayName, policyAssignmentScope, policySetDefinitionId, policyDefinitionReferenceId); + } + + /// Initializes a new instance of TrackedResourceModificationDetails. + /// The details of the policy that created or modified the tracked resource. + /// The ID of the deployment that created or modified the tracked resource. + /// Timestamp of the deployment that created or modified the tracked resource. + /// A new instance for mocking. + public static TrackedResourceModificationDetails TrackedResourceModificationDetails(PolicyDetails policyDetails = null, ResourceIdentifier deploymentId = null, DateTimeOffset? deploymentOn = null) + { + return new TrackedResourceModificationDetails(policyDetails, deploymentId, deploymentOn); + } + + /// Initializes a new instance of RemediationDeployment. + /// Resource ID of the resource that is being remediated by the deployment. + /// Resource ID of the template deployment that will remediate the resource. + /// Status of the remediation deployment. + /// Location of the resource that is being remediated. + /// Error encountered while remediated the resource. + /// The time at which the remediation was created. + /// The time at which the remediation deployment was last updated. + /// A new instance for mocking. + public static RemediationDeployment RemediationDeployment(ResourceIdentifier remediatedResourceId = null, ResourceIdentifier deploymentId = null, string status = null, AzureLocation? resourceLocation = null, ResponseError error = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastUpdatedOn = null) + { + return new RemediationDeployment(remediatedResourceId, deploymentId, status, resourceLocation, error, createdOn, lastUpdatedOn); + } + + /// Initializes a new instance of PolicyRemediationData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// 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 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. + /// The deployment status summary for all deployments created by the remediation. + /// The remediation status message. Provides additional details regarding the state of the remediation. + /// The remediation correlation Id. Can be used to find events related to the remediation in the activity log. + /// Determines the max number of resources that can be remediated by the remediation job. If not provided, the default resource count is used. + /// Determines how many resources to remediate at any given time. Can be used to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is used. + /// The remediation failure threshold settings. + /// A new instance for mocking. + public static PolicyRemediationData PolicyRemediationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier policyAssignmentId = null, string policyDefinitionReferenceId = null, ResourceDiscoveryMode? resourceDiscoveryMode = null, string provisioningState = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastUpdatedOn = null, IEnumerable filterLocations = null, RemediationDeploymentSummary deploymentStatus = null, string statusMessage = null, string correlationId = null, int? resourceCount = null, int? parallelDeployments = null, float? failureThresholdPercentage = null) + { + filterLocations ??= new List(); + + return new PolicyRemediationData(id, name, resourceType, systemData, policyAssignmentId, policyDefinitionReferenceId, resourceDiscoveryMode, provisioningState, createdOn, lastUpdatedOn, filterLocations != null ? new RemediationFilters(filterLocations?.ToList()) : null, deploymentStatus, statusMessage, correlationId, resourceCount, parallelDeployments, failureThresholdPercentage != null ? new RemediationPropertiesFailureThreshold(failureThresholdPercentage) : null); + } + + /// Initializes a new instance of RemediationDeploymentSummary. + /// The number of deployments required by the remediation. + /// The number of deployments required by the remediation that have succeeded. + /// The number of deployments required by the remediation that have failed. + /// A new instance for mocking. + public static RemediationDeploymentSummary RemediationDeploymentSummary(int? totalDeployments = null, int? successfulDeployments = null, int? failedDeployments = null) + { + return new RemediationDeploymentSummary(totalDeployments, successfulDeployments, failedDeployments); + } + + /// Initializes a new instance of PolicyEvent. + /// OData entity ID; always set to null since policy event records do not have an entity ID. + /// OData context string; used by OData clients to resolve type information based on metadata. + /// Timestamp for the policy event record. + /// Resource ID. + /// Policy assignment ID. + /// Policy definition ID. + /// Effective parameters for the policy assignment. + /// Flag which states whether the resource is compliant against the policy assignment it was evaluated against. + /// Subscription ID. + /// Resource type. + /// Resource location. + /// Resource group name. + /// List of resource tags. + /// 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. + /// Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + /// Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. + /// Compliance state of the resource. + /// Tenant ID for the policy event record. + /// Principal object ID for the user who initiated the resource operation that triggered the policy event. + /// Components events records populated only when URL contains $expand=components clause. + /// Additional Properties. + /// A new instance for mocking. + public static PolicyEvent PolicyEvent(string odataId = null, string odataContext = null, DateTimeOffset? timestamp = null, ResourceIdentifier resourceId = null, ResourceIdentifier policyAssignmentId = null, ResourceIdentifier policyDefinitionId = null, string effectiveParameters = null, bool? isCompliant = null, string subscriptionId = null, string resourceTypeString = null, AzureLocation? resourceLocation = null, string resourceGroup = null, string resourceTags = null, string policyAssignmentName = null, string policyAssignmentOwner = null, string policyAssignmentParameters = null, string policyAssignmentScope = null, string policyDefinitionName = null, string policyDefinitionAction = null, string policyDefinitionCategory = null, ResourceIdentifier policySetDefinitionId = null, string policySetDefinitionName = null, string policySetDefinitionOwner = null, string policySetDefinitionCategory = null, string policySetDefinitionParameters = null, string managementGroupIds = null, string policyDefinitionReferenceId = null, string complianceState = null, Guid? tenantId = null, string principalOid = null, IEnumerable components = null, IReadOnlyDictionary additionalProperties = null) + { + components ??= new List(); + additionalProperties ??= new Dictionary(); + + return new PolicyEvent(odataId, odataContext, timestamp, resourceId, policyAssignmentId, policyDefinitionId, effectiveParameters, isCompliant, subscriptionId, resourceTypeString, resourceLocation, resourceGroup, resourceTags, policyAssignmentName, policyAssignmentOwner, policyAssignmentParameters, policyAssignmentScope, policyDefinitionName, policyDefinitionAction, policyDefinitionCategory, policySetDefinitionId, policySetDefinitionName, policySetDefinitionOwner, policySetDefinitionCategory, policySetDefinitionParameters, managementGroupIds, policyDefinitionReferenceId, complianceState, tenantId, principalOid, components?.ToList(), additionalProperties); + } + + /// Initializes a new instance of ComponentEventDetails. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Timestamp for component policy event record. + /// Tenant ID for the policy event record. + /// Principal object ID for the user who initiated the resource component operation that triggered the policy event. + /// Policy definition action, i.e. effect. + /// Additional Properties. + /// A new instance for mocking. + public static ComponentEventDetails ComponentEventDetails(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? timestamp = null, Guid? tenantId = null, string principalOid = null, string policyDefinitionAction = null, IReadOnlyDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new ComponentEventDetails(id, name, resourceType, systemData, timestamp, tenantId, principalOid, policyDefinitionAction, additionalProperties); + } + + /// Initializes a new instance of PolicyState. + /// OData entity ID; always set to null since 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 policy state record. + /// Resource ID. + /// Policy assignment ID. + /// Policy definition ID. + /// Effective parameters for the policy assignment. + /// Flag which states whether the resource is compliant against the policy assignment it was evaluated against. This property is deprecated; please use ComplianceState instead. + /// Subscription ID. + /// Resource type. + /// Resource location. + /// Resource group name. + /// List of resource tags. + /// 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. + /// Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. + /// 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. + /// Policy definition group names. + /// Components state compliance records populated only when URL contains $expand=components clause. + /// Evaluated policy definition version. + /// Evaluated policy set definition version. + /// Evaluated policy assignment version. + /// Additional Properties. + /// A new instance for mocking. + public static PolicyState PolicyState(string odataId = null, string odataContext = null, DateTimeOffset? timestamp = null, ResourceIdentifier resourceId = null, ResourceIdentifier policyAssignmentId = null, ResourceIdentifier policyDefinitionId = null, string effectiveParameters = null, bool? isCompliant = null, string subscriptionId = null, string resourceTypeString = null, AzureLocation? resourceLocation = null, string resourceGroup = null, string resourceTags = null, string policyAssignmentName = null, string policyAssignmentOwner = null, string policyAssignmentParameters = null, string policyAssignmentScope = null, string policyDefinitionName = null, string policyDefinitionAction = null, string policyDefinitionCategory = null, ResourceIdentifier policySetDefinitionId = null, string policySetDefinitionName = null, string policySetDefinitionOwner = null, string policySetDefinitionCategory = null, string policySetDefinitionParameters = null, string managementGroupIds = null, string policyDefinitionReferenceId = null, string complianceState = null, PolicyEvaluationDetails policyEvaluationDetails = null, IEnumerable policyDefinitionGroupNames = null, IEnumerable components = null, string policyDefinitionVersion = null, string policySetDefinitionVersion = null, string policyAssignmentVersion = null, IReadOnlyDictionary additionalProperties = null) + { + policyDefinitionGroupNames ??= new List(); + components ??= new List(); + additionalProperties ??= new Dictionary(); + + return new PolicyState(odataId, odataContext, timestamp, resourceId, policyAssignmentId, policyDefinitionId, effectiveParameters, isCompliant, subscriptionId, resourceTypeString, resourceLocation, resourceGroup, resourceTags, policyAssignmentName, policyAssignmentOwner, policyAssignmentParameters, policyAssignmentScope, policyDefinitionName, policyDefinitionAction, policyDefinitionCategory, policySetDefinitionId, policySetDefinitionName, policySetDefinitionOwner, policySetDefinitionCategory, policySetDefinitionParameters, managementGroupIds, policyDefinitionReferenceId, complianceState, policyEvaluationDetails, policyDefinitionGroupNames?.ToList(), components?.ToList(), policyDefinitionVersion, policySetDefinitionVersion, policyAssignmentVersion, additionalProperties); + } + + /// Initializes a new instance of PolicyEvaluationDetails. + /// Details of the evaluated expressions. + /// Evaluation details of IfNotExists effect. + /// A new instance for mocking. + public static PolicyEvaluationDetails PolicyEvaluationDetails(IEnumerable evaluatedExpressions = null, IfNotExistsEvaluationDetails ifNotExistsDetails = null) + { + evaluatedExpressions ??= new List(); + + return new PolicyEvaluationDetails(evaluatedExpressions?.ToList(), ifNotExistsDetails); + } + + /// Initializes a new instance of ExpressionEvaluationDetails. + /// 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. + /// A new instance for mocking. + public static ExpressionEvaluationDetails ExpressionEvaluationDetails(string result = null, string expression = null, string expressionKind = null, string path = null, BinaryData expressionValue = null, BinaryData targetValue = null, string @operator = null) + { + return new ExpressionEvaluationDetails(result, expression, expressionKind, path, expressionValue, targetValue, @operator); + } + + /// Initializes a new instance of IfNotExistsEvaluationDetails. + /// ID of the last evaluated resource for IfNotExists effect. + /// Total number of resources to which the existence condition is applicable. + /// A new instance for mocking. + public static IfNotExistsEvaluationDetails IfNotExistsEvaluationDetails(ResourceIdentifier resourceId = null, int? totalResources = null) + { + return new IfNotExistsEvaluationDetails(resourceId, totalResources); + } + + /// Initializes a new instance of ComponentStateDetails. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Component compliance evaluation timestamp. + /// Component compliance state. + /// Additional Properties. + /// A new instance for mocking. + public static ComponentStateDetails ComponentStateDetails(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? timestamp = null, string complianceState = null, IReadOnlyDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new ComponentStateDetails(id, name, resourceType, systemData, timestamp, complianceState, additionalProperties); + } + + /// Initializes a new instance of PolicySummary. + /// OData entity ID; always set to null since summaries do not have an entity ID. + /// OData context string; used by OData clients to resolve type information based on metadata. + /// Compliance summary for all policy assignments. + /// Policy assignments summary. + /// A new instance for mocking. + public static PolicySummary PolicySummary(string odataId = null, string odataContext = null, PolicySummaryResults results = null, IEnumerable policyAssignments = null) + { + policyAssignments ??= new List(); + + return new PolicySummary(odataId, odataContext, results, policyAssignments?.ToList()); + } + + /// Initializes a new instance of PolicySummaryResults. + /// HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the compliance summary. This property will not be available by default in future API versions, but could be queried explicitly. + /// Number of non-compliant resources. + /// Number of non-compliant policies. + /// The resources summary at this level. + /// The policy artifact summary at this level. For query scope level, it represents policy assignment summary. For policy assignment level, it represents policy definitions summary. + /// The policy definition group summary at this level. + /// A new instance for mocking. + public static PolicySummaryResults PolicySummaryResults(Uri queryResultsUri = null, int? nonCompliantResources = null, int? nonCompliantPolicies = null, IEnumerable resourceDetails = null, IEnumerable policyDetails = null, IEnumerable policyGroupDetails = null) + { + resourceDetails ??= new List(); + policyDetails ??= new List(); + policyGroupDetails ??= new List(); + + return new PolicySummaryResults(queryResultsUri, nonCompliantResources, nonCompliantPolicies, resourceDetails?.ToList(), policyDetails?.ToList(), policyGroupDetails?.ToList()); + } + + /// Initializes a new instance of ComplianceDetail. + /// The compliance state. + /// Summarized count value for this compliance state. + /// A new instance for mocking. + public static ComplianceDetail ComplianceDetail(string complianceState = null, int? count = null) + { + return new ComplianceDetail(complianceState, count); + } + + /// Initializes a new instance of PolicyAssignmentSummary. + /// Policy assignment ID. + /// Policy set definition ID, if the policy assignment is for a policy set. + /// Compliance summary for the policy assignment. + /// Policy definitions summary. + /// Policy definition group summary. + /// A new instance for mocking. + public static PolicyAssignmentSummary PolicyAssignmentSummary(ResourceIdentifier policyAssignmentId = null, ResourceIdentifier policySetDefinitionId = null, PolicySummaryResults results = null, IEnumerable policyDefinitions = null, IEnumerable policyGroups = null) + { + policyDefinitions ??= new List(); + policyGroups ??= new List(); + + return new PolicyAssignmentSummary(policyAssignmentId, policySetDefinitionId, results, policyDefinitions?.ToList(), policyGroups?.ToList()); + } + + /// Initializes a new instance of PolicyDefinitionSummary. + /// Policy definition ID. + /// Policy definition reference ID. + /// Policy definition group names. + /// Policy effect, i.e. policy definition action. + /// Compliance summary for the policy definition. + /// A new instance for mocking. + public static PolicyDefinitionSummary PolicyDefinitionSummary(ResourceIdentifier policyDefinitionId = null, string policyDefinitionReferenceId = null, IEnumerable policyDefinitionGroupNames = null, string effect = null, PolicySummaryResults results = null) + { + policyDefinitionGroupNames ??= new List(); + + return new PolicyDefinitionSummary(policyDefinitionId, policyDefinitionReferenceId, policyDefinitionGroupNames?.ToList(), effect, results); + } + + /// Initializes a new instance of PolicyGroupSummary. + /// Policy group name. + /// Compliance summary for the policy definition group. + /// A new instance for mocking. + public static PolicyGroupSummary PolicyGroupSummary(string policyGroupName = null, PolicySummaryResults results = null) + { + return new PolicyGroupSummary(policyGroupName, results); + } + + /// Initializes a new instance of PolicyMetadataData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The policy metadata identifier. + /// The category of the policy metadata. + /// The title of the policy metadata. + /// The owner of the policy metadata. + /// Url for getting additional content about the resource metadata. + /// Additional metadata. + /// The description of the policy metadata. + /// The requirements of the policy metadata. + /// A new instance for mocking. + public static PolicyMetadataData PolicyMetadataData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string metadataId = null, string category = null, string title = null, string owner = null, Uri additionalContentUri = null, BinaryData metadata = null, string description = null, string requirements = null) + { + return new PolicyMetadataData(id, name, resourceType, systemData, metadataId, category, title, owner, additionalContentUri, metadata, description, requirements); + } + + /// Initializes a new instance of SlimPolicyMetadata. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The policy metadata identifier. + /// The category of the policy metadata. + /// The title of the policy metadata. + /// The owner of the policy metadata. + /// Url for getting additional content about the resource metadata. + /// Additional metadata. + /// A new instance for mocking. + public static SlimPolicyMetadata SlimPolicyMetadata(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string metadataId = null, string category = null, string title = null, string owner = null, Uri additionalContentUri = null, BinaryData metadata = null) + { + return new SlimPolicyMetadata(id, name, resourceType, systemData, metadataId, category, title, owner, additionalContentUri, metadata); + } + + /// Initializes a new instance of CheckPolicyRestrictionsResult. + /// The restrictions that will be placed on various fields in the resource by policy. + /// Evaluation results for the provided partial resource content. + /// A new instance for mocking. + public static CheckPolicyRestrictionsResult CheckPolicyRestrictionsResult(IEnumerable fieldRestrictions = null, IEnumerable policyEvaluations = null) + { + fieldRestrictions ??= new List(); + policyEvaluations ??= new List(); + + return new CheckPolicyRestrictionsResult(fieldRestrictions?.ToList(), policyEvaluations != null ? new CheckRestrictionsResultContentEvaluationResult(policyEvaluations?.ToList()) : null); + } + + /// Initializes a new instance of FieldRestrictions. + /// The name of the field. This can be a top-level property like 'name' or 'type' or an Azure Policy field alias. + /// The restrictions placed on that field by policy. + /// A new instance for mocking. + public static FieldRestrictions FieldRestrictions(string field = null, IEnumerable restrictions = null) + { + restrictions ??= new List(); + + return new FieldRestrictions(field, restrictions?.ToList()); + } + + /// Initializes a new instance of FieldRestriction. + /// The type of restriction that is imposed on the field. + /// The value that policy will set for the field if the user does not provide a value. + /// The values that policy either requires or denies for the field. + /// The details of the policy that is causing the field restriction. + /// A new instance for mocking. + public static FieldRestriction FieldRestriction(FieldRestrictionResult? result = null, string defaultValue = null, IEnumerable values = null, PolicyReference policy = null) + { + values ??= new List(); + + return new FieldRestriction(result, defaultValue, values?.ToList(), policy); + } + + /// Initializes a new instance of PolicyReference. + /// The resource identifier of the policy definition. + /// The resource identifier of the policy set definition. + /// The reference identifier of a specific policy definition within a policy set definition. + /// The resource identifier of the policy assignment. + /// A new instance for mocking. + public static PolicyReference PolicyReference(ResourceIdentifier policyDefinitionId = null, ResourceIdentifier policySetDefinitionId = null, string policyDefinitionReferenceId = null, ResourceIdentifier policyAssignmentId = null) + { + return new PolicyReference(policyDefinitionId, policySetDefinitionId, policyDefinitionReferenceId, policyAssignmentId); + } + + /// Initializes a new instance of PolicyEvaluationResult. + /// The details of the policy that was evaluated. + /// The result of the policy evaluation against the resource. This will typically be 'NonCompliant' but may contain other values if errors were encountered. + /// The detailed results of the policy expressions and values that were evaluated. + /// A new instance for mocking. + public static PolicyEvaluationResult PolicyEvaluationResult(PolicyReference policyInfo = null, string evaluationResult = null, PolicyEvaluationDetails evaluationDetails = null) + { + return new PolicyEvaluationResult(policyInfo, evaluationResult, evaluationDetails); + } + + /// Initializes a new instance of PolicyAttestationData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource ID of the policy assignment that the attestation is setting the state for. + /// The policy definition reference ID from a policy set definition that the attestation is setting the state for. If the policy assignment assigns a policy set definition the attestation can choose a definition within the set definition with this property or omit this and set the state for the entire set definition. + /// The compliance state that should be set on the resource. + /// The time the compliance state should expire. + /// The person responsible for setting the state of the resource. This value is typically an Azure Active Directory object ID. + /// Comments describing why this attestation was created. + /// The evidence supporting the compliance state set in this attestation. + /// The status of the attestation. + /// The time the compliance state was last changed in this attestation. + /// The time the evidence was assessed. + /// Additional metadata for this attestation. + /// A new instance for mocking. + public static PolicyAttestationData PolicyAttestationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier policyAssignmentId = null, string policyDefinitionReferenceId = null, PolicyComplianceState? complianceState = null, DateTimeOffset? expireOn = null, string owner = null, string comments = null, IEnumerable evidence = null, string provisioningState = null, DateTimeOffset? lastComplianceStateChangeOn = null, DateTimeOffset? assessOn = null, BinaryData metadata = null) + { + evidence ??= new List(); + + return new PolicyAttestationData(id, name, resourceType, systemData, policyAssignmentId, policyDefinitionReferenceId, complianceState, expireOn, owner, comments, evidence?.ToList(), provisioningState, lastComplianceStateChangeOn, assessOn, metadata); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md index f48a432acf0a3..f4323116ab344 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/autorest.md @@ -5,7 +5,6 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -generate-model-factory: false csharp: true library-name: PolicyInsights namespace: Azure.ResourceManager.PolicyInsights