// 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 armdnsresolver_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/dnsresolver/armdnsresolver/v2"
	"log"
)

// Generated from example definition: 2025-10-01-preview/DnsResolverPolicyVirtualNetworkLink_Put.json
func ExamplePolicyVirtualNetworkLinksClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdnsresolver.NewClientFactory("abdd4249-9f34-4cc6-8e42-c2e32110603e", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewPolicyVirtualNetworkLinksClient().BeginCreateOrUpdate(ctx, "sampleResourceGroup", "sampleDnsResolverPolicy", "sampleVirtualNetworkLink", armdnsresolver.PolicyVirtualNetworkLink{
		Location: to.Ptr("westus2"),
		Properties: &armdnsresolver.PolicyVirtualNetworkLinkProperties{
			VirtualNetwork: &armdnsresolver.SubResource{
				ID: to.Ptr("/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork"),
			},
		},
		Tags: map[string]*string{
			"key1": to.Ptr("value1"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %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 = armdnsresolver.PolicyVirtualNetworkLinksClientCreateOrUpdateResponse{
	// 	PolicyVirtualNetworkLink: armdnsresolver.PolicyVirtualNetworkLink{
	// 		Name: to.Ptr("sampleVirtualNetworkLink"),
	// 		Type: to.Ptr("Microsoft.Network/dnsResolverPolicies/virtualNetworkLinks"),
	// 		Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		ID: to.Ptr("/subscriptions/abdd4249-9f34-4cc6-8e42-c2e32110603e/resourceGroups/sampleResourceGroup/providers/Microsoft.Network/dnsResolverPolicy/sampleDnsResolverPolicy/virtualNetworkLinks/sampleVirtualNetworkLink"),
	// 		Location: to.Ptr("westus2"),
	// 		Properties: &armdnsresolver.PolicyVirtualNetworkLinkProperties{
	// 			ProvisioningState: to.Ptr(armdnsresolver.ProvisioningStateSucceeded),
	// 			VirtualNetwork: &armdnsresolver.SubResource{
	// 				ID: to.Ptr("/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork"),
	// 			},
	// 		},
	// 		SystemData: &armdnsresolver.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T01:01:01.1075056Z"); return t}()),
	// 			CreatedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T02:03:01.1974346Z"); return t}()),
	// 			LastModifiedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
	// 		},
	// 		Tags: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-10-01-preview/DnsResolverPolicyVirtualNetworkLink_Delete.json
func ExamplePolicyVirtualNetworkLinksClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdnsresolver.NewClientFactory("abdd4249-9f34-4cc6-8e42-c2e32110603e", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewPolicyVirtualNetworkLinksClient().BeginDelete(ctx, "sampleResourceGroup", "sampleDnsResolverPolicy", "sampleVirtualNetworkLink", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %v", err)
	}
}

// Generated from example definition: 2025-10-01-preview/DnsResolverPolicyVirtualNetworkLink_Get.json
func ExamplePolicyVirtualNetworkLinksClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdnsresolver.NewClientFactory("abdd4249-9f34-4cc6-8e42-c2e32110603e", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewPolicyVirtualNetworkLinksClient().Get(ctx, "sampleResourceGroup", "sampleDnsResolverPolicy", "sampleVirtualNetworkLink", 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 = armdnsresolver.PolicyVirtualNetworkLinksClientGetResponse{
	// 	PolicyVirtualNetworkLink: armdnsresolver.PolicyVirtualNetworkLink{
	// 		Name: to.Ptr("sampleVirtualNetworkLink"),
	// 		Type: to.Ptr("Microsoft.Network/dnsResolverPolicies/virtualNetworkLinks"),
	// 		Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		ID: to.Ptr("/subscriptions/abdd4249-9f34-4cc6-8e42-c2e32110603e/resourceGroups/sampleResourceGroup/providers/Microsoft.Network/dnsResolverPolicies/sampleDnsResolverPolicy/virtualNetworkLinks/sampleVirtualNetworkLink"),
	// 		Location: to.Ptr("westus2"),
	// 		Properties: &armdnsresolver.PolicyVirtualNetworkLinkProperties{
	// 			ProvisioningState: to.Ptr(armdnsresolver.ProvisioningStateSucceeded),
	// 			VirtualNetwork: &armdnsresolver.SubResource{
	// 				ID: to.Ptr("/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork"),
	// 			},
	// 		},
	// 		SystemData: &armdnsresolver.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T01:01:01.1075056Z"); return t}()),
	// 			CreatedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T02:03:01.1974346Z"); return t}()),
	// 			LastModifiedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
	// 		},
	// 		Tags: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-10-01-preview/DnsResolverPolicyVirtualNetworkLink_List.json
func ExamplePolicyVirtualNetworkLinksClient_NewListPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdnsresolver.NewClientFactory("abdd4249-9f34-4cc6-8e42-c2e32110603e", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewPolicyVirtualNetworkLinksClient().NewListPager("sampleResourceGroup", "sampleDnsResolverPolicy", 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 = armdnsresolver.PolicyVirtualNetworkLinksClientListResponse{
		// 	PolicyVirtualNetworkLinkListResult: armdnsresolver.PolicyVirtualNetworkLinkListResult{
		// 		Value: []*armdnsresolver.PolicyVirtualNetworkLink{
		// 			{
		// 				Name: to.Ptr("sampleVirtualNetworkLink"),
		// 				Type: to.Ptr("Microsoft.Network/dnsResolverPolicies/virtualNetworkLinks"),
		// 				Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 				ID: to.Ptr("/subscriptions/abdd4249-9f34-4cc6-8e42-c2e32110603e/resourceGroups/sampleResourceGroup/providers/Microsoft.Network/dnsResolverPolicies/sampleDnsResolverPolicy/virtualNetworkLinks/sampleVirtualNetworkLink"),
		// 				Location: to.Ptr("westus2"),
		// 				Properties: &armdnsresolver.PolicyVirtualNetworkLinkProperties{
		// 					ProvisioningState: to.Ptr(armdnsresolver.ProvisioningStateSucceeded),
		// 					VirtualNetwork: &armdnsresolver.SubResource{
		// 						ID: to.Ptr("/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork"),
		// 					},
		// 				},
		// 				SystemData: &armdnsresolver.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T01:01:01.1075056Z"); return t}()),
		// 					CreatedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T02:03:01.1974346Z"); return t}()),
		// 					LastModifiedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
		// 				},
		// 				Tags: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2025-10-01-preview/DnsResolverPolicyVirtualNetworkLink_Patch.json
func ExamplePolicyVirtualNetworkLinksClient_BeginUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdnsresolver.NewClientFactory("abdd4249-9f34-4cc6-8e42-c2e32110603e", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewPolicyVirtualNetworkLinksClient().BeginUpdate(ctx, "sampleResourceGroup", "sampleDnsResolverPolicy", "sampleVirtualNetworkLink", armdnsresolver.PolicyVirtualNetworkLinkPatch{
		Tags: map[string]*string{
			"key1": to.Ptr("value1"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %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 = armdnsresolver.PolicyVirtualNetworkLinksClientUpdateResponse{
	// 	PolicyVirtualNetworkLink: armdnsresolver.PolicyVirtualNetworkLink{
	// 		Name: to.Ptr("sampleVirtualNetworkLink"),
	// 		Type: to.Ptr("Microsoft.Network/dnsResolverPolicies/virtualNetworkLinks"),
	// 		Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		ID: to.Ptr("/subscriptions/abdd4249-9f34-4cc6-8e42-c2e32110603e/resourceGroups/sampleResourceGroup/providers/Microsoft.Network/dnsResolverPolicies/sampleDnsResolverPolicy/virtualNetworkLinks/sampleVirtualNetworkLink"),
	// 		Location: to.Ptr("westus2"),
	// 		Properties: &armdnsresolver.PolicyVirtualNetworkLinkProperties{
	// 			ProvisioningState: to.Ptr(armdnsresolver.ProvisioningStateSucceeded),
	// 			VirtualNetwork: &armdnsresolver.SubResource{
	// 				ID: to.Ptr("/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork"),
	// 			},
	// 		},
	// 		SystemData: &armdnsresolver.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T01:01:01.1075056Z"); return t}()),
	// 			CreatedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T02:03:01.1974346Z"); return t}()),
	// 			LastModifiedByType: to.Ptr(armdnsresolver.CreatedByTypeApplication),
	// 		},
	// 		Tags: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
