// 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 armnetwork_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/network/armnetwork/v10"
	"log"
)

// Generated from example definition: 2025-07-01/IpamPools_Create.json
func ExampleIpamPoolsClient_BeginCreate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armnetwork.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewIpamPoolsClient().BeginCreate(ctx, "rg1", "TestNetworkManager", "TestPool", armnetwork.IpamPool{
		Location: to.Ptr("eastus"),
		Properties: &armnetwork.IpamPoolProperties{
			Description: to.Ptr("Test description."),
			AddressPrefixes: []*string{
				to.Ptr("10.0.0.0/24"),
			},
			ParentPoolName: to.Ptr(""),
		},
	}, 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 = armnetwork.IpamPoolsClientCreateResponse{
	// 	IpamPool: armnetwork.IpamPool{
	// 		Name: to.Ptr("TestPool"),
	// 		Type: to.Ptr("Microsoft.Network/networkManagers/ipamPools"),
	// 		Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""),
	// 		ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool"),
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armnetwork.IpamPoolProperties{
	// 			Description: to.Ptr("Test description."),
	// 			AddressPrefixes: []*string{
	// 				to.Ptr("10.0.0.0/24"),
	// 			},
	// 			IPAddressType: []*armnetwork.IPType{
	// 				to.Ptr(armnetwork.IPTypeIPv4),
	// 			},
	// 			ParentPoolName: to.Ptr(""),
	// 			ProvisioningState: to.Ptr(armnetwork.ProvisioningStateUpdating),
	// 		},
	// 		SystemData: &armnetwork.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
	// 			CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
	// 			CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
	// 			LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-07-01/IpamPools_Delete.json
func ExampleIpamPoolsClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armnetwork.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewIpamPoolsClient().BeginDelete(ctx, "rg1", "TestNetworkManager", "TestPool", 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-07-01/IpamPools_Get.json
func ExampleIpamPoolsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armnetwork.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewIpamPoolsClient().Get(ctx, "rg1", "TestNetworkManager", "TestPool", 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 = armnetwork.IpamPoolsClientGetResponse{
	// 	IpamPool: armnetwork.IpamPool{
	// 		Name: to.Ptr("TestPool"),
	// 		Type: to.Ptr("Microsoft.Network/networkManagers/ipamPools"),
	// 		Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""),
	// 		ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool"),
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armnetwork.IpamPoolProperties{
	// 			Description: to.Ptr("Test description."),
	// 			AddressPrefixes: []*string{
	// 				to.Ptr("10.0.0.0/24"),
	// 			},
	// 			IPAddressType: []*armnetwork.IPType{
	// 				to.Ptr(armnetwork.IPTypeIPv4),
	// 			},
	// 			ParentPoolName: to.Ptr(""),
	// 			ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
	// 		},
	// 		SystemData: &armnetwork.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
	// 			CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
	// 			CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
	// 			LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-07-01/IpamPools_GetPoolUsage.json
func ExampleIpamPoolsClient_GetPoolUsage() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armnetwork.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewIpamPoolsClient().GetPoolUsage(ctx, "rg1", "TestNetworkManager", "TestPool", 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 = armnetwork.IpamPoolsClientGetPoolUsageResponse{
	// 	PoolUsage: armnetwork.PoolUsage{
	// 		AddressPrefixes: []*string{
	// 			to.Ptr("10.0.0.0/8"),
	// 			to.Ptr("192.0.0.0/8"),
	// 		},
	// 		AllocatedAddressPrefixes: []*string{
	// 			to.Ptr("10.0.2.0/26"),
	// 			to.Ptr("10.0.3.0/26"),
	// 		},
	// 		AvailableAddressPrefixes: []*string{
	// 			to.Ptr("10.0.1.0/24"),
	// 			to.Ptr("10.0.2.64/26"),
	// 			to.Ptr("10.0.2.128/25"),
	// 			to.Ptr("10.0.3.64/26"),
	// 			to.Ptr("10.0.3.128/25"),
	// 			to.Ptr("10.0.4.0/22"),
	// 			to.Ptr("10.0.8.0/21"),
	// 			to.Ptr("10.0.16.0/20"),
	// 			to.Ptr("10.0.32.0/19"),
	// 			to.Ptr("10.0.64.0/18"),
	// 			to.Ptr("10.0.128.0/17"),
	// 			to.Ptr("10.1.0.0/16"),
	// 			to.Ptr("10.2.0.0/15"),
	// 			to.Ptr("10.4.0.0/14"),
	// 			to.Ptr("10.8.0.0/13"),
	// 			to.Ptr("10.16.0.0/12"),
	// 			to.Ptr("10.32.0.0/11"),
	// 			to.Ptr("10.64.0.0/10"),
	// 			to.Ptr("10.128.0.0/9"),
	// 			to.Ptr("192.0.0.0/8"),
	// 		},
	// 		ChildPools: []*armnetwork.ResourceBasics{
	// 			{
	// 				AddressPrefixes: []*string{
	// 					to.Ptr("10.0.2.0/26"),
	// 				},
	// 				ResourceID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool1"),
	// 			},
	// 			{
	// 				AddressPrefixes: []*string{
	// 					to.Ptr("10.0.3.0/26"),
	// 				},
	// 				ResourceID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool2"),
	// 			},
	// 		},
	// 		NumberOfAllocatedIPAddresses: to.Ptr("128"),
	// 		NumberOfAvailableIPAddresses: to.Ptr("33554048"),
	// 		NumberOfReservedIPAddresses: to.Ptr("256"),
	// 		ReservedAddressPrefixes: []*string{
	// 			to.Ptr("10.0.0.0/24"),
	// 		},
	// 		TotalNumberOfIPAddresses: to.Ptr("33554432"),
	// 	},
	// }
}

// Generated from example definition: 2025-07-01/IpamPools_List.json
func ExampleIpamPoolsClient_NewListPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armnetwork.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewIpamPoolsClient().NewListPager("rg1", "TestNetworkManager", 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 = armnetwork.IpamPoolsClientListResponse{
		// 	IpamPoolList: armnetwork.IpamPoolList{
		// 		NextLink: to.Ptr("https://management.azure.com/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools?api-version=2025-07-01&$skipToken=10"),
		// 		Value: []*armnetwork.IpamPool{
		// 			{
		// 				Name: to.Ptr("TestPool"),
		// 				Type: to.Ptr("Microsoft.Network/networkManagers/ipamPools"),
		// 				Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""),
		// 				ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool"),
		// 				Location: to.Ptr("eastus"),
		// 				Properties: &armnetwork.IpamPoolProperties{
		// 					Description: to.Ptr("Test description."),
		// 					AddressPrefixes: []*string{
		// 						to.Ptr("10.0.0.0/24"),
		// 					},
		// 					IPAddressType: []*armnetwork.IPType{
		// 						to.Ptr(armnetwork.IPTypeIPv4),
		// 					},
		// 					ParentPoolName: to.Ptr(""),
		// 					ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
		// 				},
		// 				SystemData: &armnetwork.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
		// 					CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
		// 					CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
		// 					LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2025-07-01/IpamPools_ListAssociatedResources.json
func ExampleIpamPoolsClient_NewListAssociatedResourcesPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armnetwork.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewIpamPoolsClient().NewListAssociatedResourcesPager("rg1", "TestNetworkManager", "TestPool", 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 = armnetwork.IpamPoolsClientListAssociatedResourcesResponse{
		// 	PoolAssociationList: armnetwork.PoolAssociationList{
		// 		NextLink: to.Ptr("https://management.azure.com/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool/listAssociatedResources?api-version=2025-07-01"),
		// 		Value: []*armnetwork.PoolAssociation{
		// 			{
		// 				Description: to.Ptr(""),
		// 				AddressPrefixes: []*string{
		// 					to.Ptr("10.0.0.0/24"),
		// 				},
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T20:00:00.0000000Z"); return t}()),
		// 				NumberOfReservedIPAddresses: to.Ptr("0"),
		// 				PoolID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool"),
		// 				ReservedPrefixes: []*string{
		// 				},
		// 				ResourceID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/testVnet"),
		// 				TotalNumberOfIPAddresses: to.Ptr("256"),
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2025-07-01/IpamPools_Update.json
func ExampleIpamPoolsClient_Update() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armnetwork.NewClientFactory("11111111-1111-1111-1111-111111111111", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewIpamPoolsClient().Update(ctx, "rg1", "TestNetworkManager", "TestPool", armnetwork.IpamPoolUpdate{}, 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 = armnetwork.IpamPoolsClientUpdateResponse{
	// 	IpamPool: armnetwork.IpamPool{
	// 		Name: to.Ptr("TestPool"),
	// 		Type: to.Ptr("Microsoft.Network/networkManagers/ipamPools"),
	// 		Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""),
	// 		ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1/providers/Microsoft.Network/networkManagers/TestNetworkManager/ipamPools/TestPool"),
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armnetwork.IpamPoolProperties{
	// 			Description: to.Ptr("Test description."),
	// 			AddressPrefixes: []*string{
	// 				to.Ptr("10.0.0.0/24"),
	// 			},
	// 			IPAddressType: []*armnetwork.IPType{
	// 				to.Ptr(armnetwork.IPTypeIPv4),
	// 			},
	// 			ParentPoolName: to.Ptr("test-ipam-pool"),
	// 			ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
	// 		},
	// 		SystemData: &armnetwork.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
	// 			CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
	// 			CreatedByType: to.Ptr(armnetwork.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-11T18:52:27Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef5"),
	// 			LastModifiedByType: to.Ptr(armnetwork.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}
