// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.

package armpolicy_test

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armpolicy/v2"
	"log"
)

// Generated from example definition: 2026-01-01-preview/createPolicyAssignment.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignment() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", armpolicy.Assignment{
		Properties: &armpolicy.AssignmentProperties{
			Description: to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
			DisplayName: to.Ptr("Enforce resource naming rules"),
			Metadata: map[string]any{
				"assignedBy": "Special Someone",
			},
			NonComplianceMessages: []*armpolicy.NonComplianceMessage{
				{
					Message: to.Ptr("Resource names must start with 'DeptA' and end with '-LC'."),
				},
			},
			Parameters: map[string]*armpolicy.ParameterValuesValue{
				"prefix": {
					Value: "DeptA",
				},
				"suffix": {
					Value: "-LC",
				},
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentNonComplianceMessages.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentWithMultipleNonComplianceMessages() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "securityInitAssignment", armpolicy.Assignment{
		Properties: &armpolicy.AssignmentProperties{
			DisplayName: to.Ptr("Enforce security policies"),
			NonComplianceMessages: []*armpolicy.NonComplianceMessage{
				{
					Message: to.Ptr("Resources must comply with all internal security policies. See <internal site URL> for more info."),
				},
				{
					Message:                     to.Ptr("Resource names must start with 'DeptA' and end with '-LC'."),
					PolicyDefinitionReferenceID: to.Ptr("10420126870854049575"),
				},
				{
					Message:                     to.Ptr("Storage accounts must have firewall rules configured."),
					PolicyDefinitionReferenceID: to.Ptr("8572513655450389710"),
				},
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/securityInitiative"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentWithEnrollEnforcement.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentToEnforcePolicyEffectOnlyOnEnrolledResourcesDuringResourceCreationOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNamingEnroll", armpolicy.Assignment{
		Properties: &armpolicy.AssignmentProperties{
			Description:     to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
			DisplayName:     to.Ptr("Enforce resource naming rules"),
			EnforcementMode: to.Ptr(armpolicy.EnforcementModeEnroll),
			Metadata: map[string]any{
				"assignedBy": "Special Someone",
			},
			Parameters: map[string]*armpolicy.ParameterValuesValue{
				"prefix": {
					Value: "DeptA",
				},
				"suffix": {
					Value: "-LC",
				},
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentWithIdentity.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentWithASystemAssignedIdentity() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", armpolicy.Assignment{
		Identity: &armpolicy.Identity{
			Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
		},
		Location: to.Ptr("eastus"),
		Properties: &armpolicy.AssignmentProperties{
			Description:     to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
			DisplayName:     to.Ptr("Enforce resource naming rules"),
			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
			Metadata: map[string]any{
				"assignedBy": "Foo Bar",
			},
			Parameters: map[string]*armpolicy.ParameterValuesValue{
				"prefix": {
					Value: "DeptA",
				},
				"suffix": {
					Value: "-LC",
				},
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentWithOverrides.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentWithOverrides() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", armpolicy.Assignment{
		Properties: &armpolicy.AssignmentProperties{
			Description:       to.Ptr("Limit the resource location and resource SKU"),
			DefinitionVersion: to.Ptr("1.*.*"),
			DisplayName:       to.Ptr("Limit the resource location and resource SKU"),
			Metadata: map[string]any{
				"assignedBy": "Special Someone",
			},
			Overrides: []*armpolicy.Override{
				{
					Kind: to.Ptr(armpolicy.OverrideKindPolicyEffect),
					Selectors: []*armpolicy.Selector{
						{
							In: []*string{
								to.Ptr("Limit_Skus"),
								to.Ptr("Limit_Locations"),
							},
							Kind: to.Ptr(armpolicy.SelectorKindPolicyDefinitionReferenceID),
						},
					},
					Value: to.Ptr("Audit"),
				},
				{
					Kind: to.Ptr(armpolicy.OverrideKindDefinitionVersion),
					Selectors: []*armpolicy.Selector{
						{
							In: []*string{
								to.Ptr("eastUSEuap"),
								to.Ptr("centralUSEuap"),
							},
							Kind: to.Ptr(armpolicy.SelectorKindResourceLocation),
						},
					},
					Value: to.Ptr("2.*.*"),
				},
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentWithResourceSelectors.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentWithResourceSelectors() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", armpolicy.Assignment{
		Properties: &armpolicy.AssignmentProperties{
			Description: to.Ptr("Limit the resource location and resource SKU"),
			DisplayName: to.Ptr("Limit the resource location and resource SKU"),
			Metadata: map[string]any{
				"assignedBy": "Special Someone",
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
			ResourceSelectors: []*armpolicy.ResourceSelector{
				{
					Name: to.Ptr("SDPRegions"),
					Selectors: []*armpolicy.Selector{
						{
							In: []*string{
								to.Ptr("eastus2euap"),
								to.Ptr("centraluseuap"),
							},
							Kind: to.Ptr(armpolicy.SelectorKindResourceLocation),
						},
					},
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentWithSelfserveExemptionSettings.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentWithSelfServeExemptionSettings() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", armpolicy.Assignment{
		Location: to.Ptr("eastus"),
		Properties: &armpolicy.AssignmentProperties{
			Description:       to.Ptr("Limit the resource location and resource SKU"),
			DefinitionVersion: to.Ptr("1.*.*"),
			DisplayName:       to.Ptr("Limit the resource location and resource SKU"),
			EnforcementMode:   to.Ptr(armpolicy.EnforcementModeDefault),
			Metadata: map[string]any{
				"assignedBy": "Foo Bar",
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
			SelfServeExemptionSettings: &armpolicy.SelfServeExemptionSettings{
				Enabled: to.Ptr(true),
				PolicyDefinitionReferenceIDs: []*string{
					to.Ptr("Limit_Skus"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentWithUserAssignedIdentity.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentWithAUserAssignedIdentity() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", armpolicy.Assignment{
		Identity: &armpolicy.Identity{
			Type: to.Ptr(armpolicy.ResourceIdentityTypeUserAssigned),
			UserAssignedIdentities: map[string]*armpolicy.UserAssignedIdentitiesValue{
				"/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/testResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": {},
			},
		},
		Location: to.Ptr("eastus"),
		Properties: &armpolicy.AssignmentProperties{
			Description:     to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
			DisplayName:     to.Ptr("Enforce resource naming rules"),
			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
			Metadata: map[string]any{
				"assignedBy": "Foo Bar",
			},
			Parameters: map[string]*armpolicy.ParameterValuesValue{
				"prefix": {
					Value: "DeptA",
				},
				"suffix": {
					Value: "-LC",
				},
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/createPolicyAssignmentWithoutEnforcement.json
func ExampleAssignmentsClient_Create_createOrUpdateAPolicyAssignmentWithoutEnforcingPolicyEffectDuringResourceCreationOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewAssignmentsClient().Create(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", armpolicy.Assignment{
		Properties: &armpolicy.AssignmentProperties{
			Description:     to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
			DisplayName:     to.Ptr("Enforce resource naming rules"),
			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDoNotEnforce),
			Metadata: map[string]any{
				"assignedBy": "Special Someone",
			},
			Parameters: map[string]*armpolicy.ParameterValuesValue{
				"prefix": {
					Value: "DeptA",
				},
				"suffix": {
					Value: "-LC",
				},
			},
			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}

// Generated from example definition: 2026-01-01-preview/deletePolicyAssignment.json
func ExampleAssignmentsClient_Delete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Delete(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientDeleteResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("EnforceNaming"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Enforce resource naming rules"),
	// 			InstanceID: to.Ptr("e4b0f5a6-7c8d-4e9f-8a1b-2c3d4e5f6a7b"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Parameters: map[string]*armpolicy.ParameterValuesValue{
	// 				"prefix": &armpolicy.ParameterValuesValue{
	// 					Value: "DeptA",
	// 				},
	// 				"suffix": &armpolicy.ParameterValuesValue{
	// 					Value: "-LC",
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/getPolicyAssignment.json
func ExampleAssignmentsClient_Get_retrieveAPolicyAssignment() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Get(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientGetResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("EnforceNaming"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Enforce resource naming rules"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("e4b0f5a6-7c8d-4e9f-8a1b-2c3d4e5f6a7b"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Parameters: map[string]*armpolicy.ParameterValuesValue{
	// 				"prefix": &armpolicy.ParameterValuesValue{
	// 					Value: "DeptA",
	// 				},
	// 				"suffix": &armpolicy.ParameterValuesValue{
	// 					Value: "-LC",
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/getPolicyAssignmentWithIdentity.json
func ExampleAssignmentsClient_Get_retrieveAPolicyAssignmentWithASystemAssignedIdentity() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Get(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientGetResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("EnforceNaming"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming"),
	// 		Identity: &armpolicy.Identity{
	// 			Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
	// 			PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
	// 			TenantID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
	// 		},
	// 		Location: to.Ptr("westus"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Enforce resource naming rules"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("e4b0f5a6-7c8d-4e9f-8a1b-2c3d4e5f6a7b"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Parameters: map[string]*armpolicy.ParameterValuesValue{
	// 				"prefix": &armpolicy.ParameterValuesValue{
	// 					Value: "DeptA",
	// 				},
	// 				"suffix": &armpolicy.ParameterValuesValue{
	// 					Value: "-LC",
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/getPolicyAssignmentWithOverrides.json
func ExampleAssignmentsClient_Get_retrieveAPolicyAssignmentWithOverrides() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Get(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientGetResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("CostManagement"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Limit the resource location and resource SKU"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Limit the resource location and resource SKU"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("d2f3a4b5-c6d7-8e9f-0a1b-2c3d4e5f6a7b"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Overrides: []*armpolicy.Override{
	// 				{
	// 					Kind: to.Ptr(armpolicy.OverrideKindPolicyEffect),
	// 					Selectors: []*armpolicy.Selector{
	// 						{
	// 							In: []*string{
	// 								to.Ptr("Limit_Skus"),
	// 								to.Ptr("Limit_Locations"),
	// 							},
	// 							Kind: to.Ptr(armpolicy.SelectorKindPolicyDefinitionReferenceID),
	// 						},
	// 					},
	// 					Value: to.Ptr("Audit"),
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/getPolicyAssignmentWithResourceSelectors.json
func ExampleAssignmentsClient_Get_retrieveAPolicyAssignmentWithResourceSelectors() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Get(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientGetResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("CostManagement"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Limit the resource location and resource SKU"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Limit the resource location and resource SKU"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("a3c4d5e6-f7a8-9b0c-1d2e-3f4a5b6c7d8e"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
	// 			ResourceSelectors: []*armpolicy.ResourceSelector{
	// 				{
	// 					Name: to.Ptr("SDPRegions"),
	// 					Selectors: []*armpolicy.Selector{
	// 						{
	// 							In: []*string{
	// 								to.Ptr("eastus2euap"),
	// 								to.Ptr("centraluseuap"),
	// 							},
	// 							Kind: to.Ptr(armpolicy.SelectorKindResourceLocation),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/getPolicyAssignmentWithUserAssignedIdentity.json
func ExampleAssignmentsClient_Get_retrieveAPolicyAssignmentWithAUserAssignedIdentity() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Get(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientGetResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("EnforceNaming"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming"),
	// 		Identity: &armpolicy.Identity{
	// 			Type: to.Ptr(armpolicy.ResourceIdentityTypeUserAssigned),
	// 			UserAssignedIdentities: map[string]*armpolicy.UserAssignedIdentitiesValue{
	// 				"/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/testResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": &armpolicy.UserAssignedIdentitiesValue{
	// 					ClientID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
	// 					PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
	// 				},
	// 			},
	// 		},
	// 		Location: to.Ptr("westus"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Enforce resource naming rules"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("e4b0f5a6-7c8d-4e9f-8a1b-2c3d4e5f6a7b"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Parameters: map[string]*armpolicy.ParameterValuesValue{
	// 				"prefix": &armpolicy.ParameterValuesValue{
	// 					Value: "DeptA",
	// 				},
	// 				"suffix": &armpolicy.ParameterValuesValue{
	// 					Value: "-LC",
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/listPolicyAssignments.json
func ExampleAssignmentsClient_NewListPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("ae640e6b-ba3e-4256-9d62-2993eecfa6f2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAssignmentsClient().NewListPager(&armpolicy.AssignmentsClientListOptions{
		Filter: to.Ptr("atScope()"),
		Expand: to.Ptr("LatestDefinitionVersion, EffectiveDefinitionVersion")})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armpolicy.AssignmentsClientListResponse{
		// 	AssignmentListResult: armpolicy.AssignmentListResult{
		// 		Value: []*armpolicy.Assignment{
		// 			{
		// 				ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				Name: to.Ptr("CostManagement"),
		// 				Location: to.Ptr("eastus"),
		// 				Identity: &armpolicy.Identity{
		// 					Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
		// 					PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
		// 					TenantID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
		// 				},
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					DisplayName: to.Ptr("Storage Cost Management"),
		// 					Description: to.Ptr("Minimize the risk of accidental cost overruns"),
		// 					Metadata: map[string]any{
		// 						"category": "Cost Management",
		// 					},
		// 					PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/storageSkus"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					LatestDefinitionVersion: to.Ptr("1.0.0"),
		// 					EffectiveDefinitionVersion: to.Ptr("1.0.0"),
		// 					Parameters: map[string]*armpolicy.ParameterValuesValue{
		// 						"allowedSkus": &armpolicy.ParameterValuesValue{
		// 							Value: "Standard_A1",
		// 						},
		// 					},
		// 					Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
		// 					NotScopes: []*string{
		// 					},
		// 					InstanceID: to.Ptr("a3c4d5e6-f7a8-9b0c-1d2e-3f4a5b6c7d8e"),
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/TagEnforcement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				Name: to.Ptr("TagEnforcement"),
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					DisplayName: to.Ptr("Enforces a tag key and value"),
		// 					Description: to.Ptr("Ensure a given tag key and value are present on all resources"),
		// 					PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					LatestDefinitionVersion: to.Ptr("1.0.0"),
		// 					EffectiveDefinitionVersion: to.Ptr("1.0.0"),
		// 					Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
		// 					NotScopes: []*string{
		// 					},
		// 					InstanceID: to.Ptr("b6d7e8f9-a0b1-2c3d-4e5f-6a7b8c9d0e1f"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-01-preview/listPolicyAssignmentsForManagementGroup.json
func ExampleAssignmentsClient_NewListForManagementGroupPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAssignmentsClient().NewListForManagementGroupPager("TestManagementGroup", &armpolicy.AssignmentsClientListForManagementGroupOptions{
		Filter: to.Ptr("atScope()"),
		Expand: to.Ptr("LatestDefinitionVersion, EffectiveDefinitionVersion")})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armpolicy.AssignmentsClientListForManagementGroupResponse{
		// 	AssignmentListResult: armpolicy.AssignmentListResult{
		// 		Value: []*armpolicy.Assignment{
		// 			{
		// 				ID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyAssignments/TestCostManagement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				Name: to.Ptr("TestCostManagement"),
		// 				Location: to.Ptr("eastus"),
		// 				Identity: &armpolicy.Identity{
		// 					Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
		// 					PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
		// 					TenantID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
		// 				},
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					DisplayName: to.Ptr("Storage Cost Management"),
		// 					Description: to.Ptr("Minimize the risk of accidental cost overruns"),
		// 					Metadata: map[string]any{
		// 						"category": "Cost Management",
		// 					},
		// 					PolicyDefinitionID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyDefinitions/storageSkus"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					LatestDefinitionVersion: to.Ptr("1.0.0"),
		// 					EffectiveDefinitionVersion: to.Ptr("1.0.0"),
		// 					Parameters: map[string]*armpolicy.ParameterValuesValue{
		// 						"allowedSkus": &armpolicy.ParameterValuesValue{
		// 							Value: "Standard_A1",
		// 						},
		// 					},
		// 					Scope: to.Ptr("/providers/Microsoft.Management/managementGroups/TestManagementGroup"),
		// 					NotScopes: []*string{
		// 					},
		// 					InstanceID: to.Ptr("c7e8f9a0-b1c2-3d4e-5f6a-7b8c9d0e1f2a"),
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyAssignments/TestTagEnforcement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				Name: to.Ptr("TestTagEnforcement"),
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					DisplayName: to.Ptr("Enforces a tag key and value"),
		// 					Description: to.Ptr("Ensure a given tag key and value are present on all resources"),
		// 					PolicyDefinitionID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					LatestDefinitionVersion: to.Ptr("1.0.0"),
		// 					EffectiveDefinitionVersion: to.Ptr("1.0.0"),
		// 					Scope: to.Ptr("/providers/Microsoft.Management/managementGroups/TestManagementGroup"),
		// 					NotScopes: []*string{
		// 					},
		// 					InstanceID: to.Ptr("d8f9a0b1-c2d3-4e5f-6a7b-8c9d0e1f2a3b"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-01-preview/listPolicyAssignmentsForResource.json
func ExampleAssignmentsClient_NewListForResourcePager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("ae640e6b-ba3e-4256-9d62-2993eecfa6f2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAssignmentsClient().NewListForResourcePager("TestResourceGroup", "Microsoft.Compute", "virtualMachines/MyTestVm", "domainNames", "MyTestComputer.cloudapp.net", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armpolicy.AssignmentsClientListForResourceResponse{
		// 	AssignmentListResult: armpolicy.AssignmentListResult{
		// 		Value: []*armpolicy.Assignment{
		// 			{
		// 				ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestCostManagement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				Name: to.Ptr("TestCostManagement"),
		// 				Location: to.Ptr("eastus"),
		// 				Identity: &armpolicy.Identity{
		// 					Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
		// 					PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
		// 					TenantID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
		// 				},
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					DisplayName: to.Ptr("VM Cost Management"),
		// 					Description: to.Ptr("Minimize the risk of accidental cost overruns"),
		// 					Metadata: map[string]any{
		// 						"category": "Cost Management",
		// 					},
		// 					PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/vmSkus"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					Parameters: map[string]*armpolicy.ParameterValuesValue{
		// 						"allowedSkus": &armpolicy.ParameterValuesValue{
		// 							Value: "Standard_A1",
		// 						},
		// 					},
		// 					Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup"),
		// 					NotScopes: []*string{
		// 					},
		// 					InstanceID: to.Ptr("e9a0b1c2-d3e4-5f6a-7b8c-9d0e1f2a3b4c"),
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestTagEnforcement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				Name: to.Ptr("TestTagEnforcement"),
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					DisplayName: to.Ptr("Enforces a tag key and value"),
		// 					Description: to.Ptr("Ensure a given tag key and value are present on all resources"),
		// 					PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup"),
		// 					NotScopes: []*string{
		// 					},
		// 					InstanceID: to.Ptr("f0b1c2d3-e4f5-6a7b-8c9d-0e1f2a3b4c5d"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-01-preview/listPolicyAssignmentsForResourceGroup.json
func ExampleAssignmentsClient_NewListForResourceGroupPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("ae640e6b-ba3e-4256-9d62-2993eecfa6f2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAssignmentsClient().NewListForResourceGroupPager("TestResourceGroup", &armpolicy.AssignmentsClientListForResourceGroupOptions{
		Expand: to.Ptr("LatestDefinitionVersion, EffectiveDefinitionVersion"),
		Filter: to.Ptr("atScope()")})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armpolicy.AssignmentsClientListForResourceGroupResponse{
		// 	AssignmentListResult: armpolicy.AssignmentListResult{
		// 		Value: []*armpolicy.Assignment{
		// 			{
		// 				Name: to.Ptr("TestCostManagement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestCostManagement"),
		// 				Identity: &armpolicy.Identity{
		// 					Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
		// 					PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
		// 					TenantID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
		// 				},
		// 				Location: to.Ptr("eastus"),
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					Description: to.Ptr("Minimize the risk of accidental cost overruns"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					DisplayName: to.Ptr("Storage Cost Management"),
		// 					EffectiveDefinitionVersion: to.Ptr("1.0.0"),
		// 					InstanceID: to.Ptr("a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d"),
		// 					LatestDefinitionVersion: to.Ptr("1.0.0"),
		// 					Metadata: map[string]any{
		// 						"category": "Cost Management",
		// 					},
		// 					NotScopes: []*string{
		// 					},
		// 					Parameters: map[string]*armpolicy.ParameterValuesValue{
		// 						"allowedSkus": &armpolicy.ParameterValuesValue{
		// 							Value: "Standard_A1",
		// 						},
		// 					},
		// 					PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/storageSkus"),
		// 					Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup"),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("TestTagEnforcement"),
		// 				Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
		// 				ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestTagEnforcement"),
		// 				Properties: &armpolicy.AssignmentProperties{
		// 					Description: to.Ptr("Ensure a given tag key and value are present on all resources"),
		// 					DefinitionVersion: to.Ptr("1.*.*"),
		// 					DisplayName: to.Ptr("Enforces a tag key and value"),
		// 					EffectiveDefinitionVersion: to.Ptr("1.0.0"),
		// 					InstanceID: to.Ptr("f0b1c2d3-e4f5-6a7b-8c9d-0e1f2a3b4c5d"),
		// 					LatestDefinitionVersion: to.Ptr("1.0.0"),
		// 					NotScopes: []*string{
		// 					},
		// 					PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue"),
		// 					Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-01-preview/updatePolicyAssignmentWithIdentity.json
func ExampleAssignmentsClient_Update_updateAPolicyAssignmentWithASystemAssignedIdentity() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Update(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", armpolicy.AssignmentUpdate{
		Identity: &armpolicy.Identity{
			Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
		},
		Location: to.Ptr("eastus"),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientUpdateResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("EnforceNaming"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming"),
	// 		Identity: &armpolicy.Identity{
	// 			Type: to.Ptr(armpolicy.ResourceIdentityTypeSystemAssigned),
	// 			PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
	// 			TenantID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
	// 		},
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Enforce resource naming rules"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("e4b0f5a6-7c8d-4e9f-8a1b-2c3d4e5f6a7b"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Parameters: map[string]*armpolicy.ParameterValuesValue{
	// 				"prefix": &armpolicy.ParameterValuesValue{
	// 					Value: "DeptA",
	// 				},
	// 				"suffix": &armpolicy.ParameterValuesValue{
	// 					Value: "-LC",
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/updatePolicyAssignmentWithOverrides.json
func ExampleAssignmentsClient_Update_updateAPolicyAssignmentWithOverrides() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Update(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", armpolicy.AssignmentUpdate{
		Properties: &armpolicy.AssignmentUpdateProperties{
			Overrides: []*armpolicy.Override{
				{
					Kind: to.Ptr(armpolicy.OverrideKindPolicyEffect),
					Selectors: []*armpolicy.Selector{
						{
							In: []*string{
								to.Ptr("Limit_Skus"),
								to.Ptr("Limit_Locations"),
							},
							Kind: to.Ptr(armpolicy.SelectorKindPolicyDefinitionReferenceID),
						},
					},
					Value: to.Ptr("Audit"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientUpdateResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("CostManagement"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Limit the resource location and resource SKU"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Limit the resource location and resource SKU"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("a3c4d5e6-f7a8-9b0c-1d2e-3f4a5b6c7d8e"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Overrides: []*armpolicy.Override{
	// 				{
	// 					Kind: to.Ptr(armpolicy.OverrideKindPolicyEffect),
	// 					Selectors: []*armpolicy.Selector{
	// 						{
	// 							In: []*string{
	// 								to.Ptr("Limit_Skus"),
	// 								to.Ptr("Limit_Locations"),
	// 							},
	// 							Kind: to.Ptr(armpolicy.SelectorKindPolicyDefinitionReferenceID),
	// 						},
	// 					},
	// 					Value: to.Ptr("Audit"),
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/updatePolicyAssignmentWithResourceSelectors.json
func ExampleAssignmentsClient_Update_updateAPolicyAssignmentWithResourceSelectors() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Update(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", armpolicy.AssignmentUpdate{
		Properties: &armpolicy.AssignmentUpdateProperties{
			ResourceSelectors: []*armpolicy.ResourceSelector{
				{
					Name: to.Ptr("SDPRegions"),
					Selectors: []*armpolicy.Selector{
						{
							In: []*string{
								to.Ptr("eastus2euap"),
								to.Ptr("centraluseuap"),
							},
							Kind: to.Ptr(armpolicy.SelectorKindResourceLocation),
						},
					},
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientUpdateResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("CostManagement"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Limit the resource location and resource SKU"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Limit the resource location and resource SKU"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("a3c4d5e6-f7a8-9b0c-1d2e-3f4a5b6c7d8e"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
	// 			ResourceSelectors: []*armpolicy.ResourceSelector{
	// 				{
	// 					Name: to.Ptr("SDPRegions"),
	// 					Selectors: []*armpolicy.Selector{
	// 						{
	// 							In: []*string{
	// 								to.Ptr("eastus2euap"),
	// 								to.Ptr("centraluseuap"),
	// 							},
	// 							Kind: to.Ptr(armpolicy.SelectorKindResourceLocation),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/updatePolicyAssignmentWithSelfserveExemptionSettings.json
func ExampleAssignmentsClient_Update_updateAPolicyAssignmentWithSelfServeExemptionSettings() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Update(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "CostManagement", armpolicy.AssignmentUpdate{
		Properties: &armpolicy.AssignmentUpdateProperties{
			SelfServeExemptionSettings: &armpolicy.SelfServeExemptionSettings{
				Enabled: to.Ptr(true),
				PolicyDefinitionReferenceIDs: []*string{
					to.Ptr("Limit_Skus"),
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientUpdateResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("CostManagement"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Limit the resource location and resource SKU"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Limit the resource location and resource SKU"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("a3c4d5e6-f7a8-9b0c-1d2e-3f4a5b6c7d8e"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			SelfServeExemptionSettings: &armpolicy.SelfServeExemptionSettings{
	// 				Enabled: to.Ptr(true),
	// 				PolicyDefinitionReferenceIDs: []*string{
	// 					to.Ptr("Limit_Skus"),
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01-preview/updatePolicyAssignmentWithUserAssignedIdentity.json
func ExampleAssignmentsClient_Update_updateAPolicyAssignmentWithAUserAssignedIdentity() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpolicy.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssignmentsClient().Update(ctx, "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2", "EnforceNaming", armpolicy.AssignmentUpdate{
		Identity: &armpolicy.Identity{
			Type: to.Ptr(armpolicy.ResourceIdentityTypeUserAssigned),
			UserAssignedIdentities: map[string]*armpolicy.UserAssignedIdentitiesValue{
				"/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/testResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": {},
			},
		},
		Location: to.Ptr("eastus"),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpolicy.AssignmentsClientUpdateResponse{
	// 	Assignment: armpolicy.Assignment{
	// 		Name: to.Ptr("EnforceNaming"),
	// 		Type: to.Ptr("Microsoft.Authorization/policyAssignments"),
	// 		ID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming"),
	// 		Identity: &armpolicy.Identity{
	// 			Type: to.Ptr(armpolicy.ResourceIdentityTypeUserAssigned),
	// 			UserAssignedIdentities: map[string]*armpolicy.UserAssignedIdentitiesValue{
	// 				"/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/testResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": &armpolicy.UserAssignedIdentitiesValue{
	// 					ClientID: to.Ptr("4bee2b8a-1bee-47c2-90e9-404241551135"),
	// 					PrincipalID: to.Ptr("e6d23f8d-af97-4fbc-bda6-00604e4e3d0a"),
	// 				},
	// 			},
	// 		},
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armpolicy.AssignmentProperties{
	// 			Description: to.Ptr("Force resource names to begin with given DeptA and end with -LC"),
	// 			DefinitionVersion: to.Ptr("1.*.*"),
	// 			DisplayName: to.Ptr("Enforce resource naming rules"),
	// 			EnforcementMode: to.Ptr(armpolicy.EnforcementModeDefault),
	// 			InstanceID: to.Ptr("e4b0f5a6-7c8d-4e9f-8a1b-2c3d4e5f6a7b"),
	// 			Metadata: map[string]any{
	// 				"assignedBy": "Special Someone",
	// 			},
	// 			NotScopes: []*string{
	// 			},
	// 			Parameters: map[string]*armpolicy.ParameterValuesValue{
	// 				"prefix": &armpolicy.ParameterValuesValue{
	// 					Value: "DeptA",
	// 				},
	// 				"suffix": &armpolicy.ParameterValuesValue{
	// 					Value: "-LC",
	// 				},
	// 			},
	// 			PolicyDefinitionID: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming"),
	// 			Scope: to.Ptr("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2"),
	// 		},
	// 	},
	// }
}
