// 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 armhorizondb_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/horizondb/armhorizondb"
	"log"
)

// Generated from example definition: 2026-01-20-preview/Clusters_CreateOrUpdate.json
func ExampleClustersClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhorizondb.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewClustersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "examplecluster", armhorizondb.Cluster{
		Location: to.Ptr("westus2"),
		Tags: map[string]*string{
			"env": to.Ptr("dev"),
		},
		Properties: &armhorizondb.ClusterProperties{
			CreateMode:                 to.Ptr(armhorizondb.CreateModeClusterCreate),
			SourceClusterResourceID:    to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/examplesourceresourcegroup/providers/Microsoft.HorizonDb/clusters/examplesourcecluster"),
			Version:                    to.Ptr("17"),
			AdministratorLogin:         to.Ptr("exampleadministratorlogin"),
			AdministratorLoginPassword: to.Ptr("examplepassword"),
			VCores:                     to.Ptr[int32](4),
			ReplicaCount:               to.Ptr[int32](2),
			ZonePlacementPolicy:        to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
		},
	}, 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 = armhorizondb.ClustersClientCreateOrUpdateResponse{
	// 	Cluster: armhorizondb.Cluster{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.HorizonDb/clusters/examplecluster"),
	// 		Name: to.Ptr("examplecluster"),
	// 		Type: to.Ptr("Microsoft.HorizonDb/clusters"),
	// 		Location: to.Ptr("westus2"),
	// 		Tags: map[string]*string{
	// 			"env": to.Ptr("dev"),
	// 		},
	// 		Properties: &armhorizondb.ClusterProperties{
	// 			AdministratorLogin: to.Ptr("exampleadministratorlogin"),
	// 			Version: to.Ptr("17"),
	// 			CreateMode: to.Ptr(armhorizondb.CreateModeClusterCreate),
	// 			SourceClusterResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/examplesourceresourcegroup/providers/Microsoft.HorizonDb/clusters/examplesourcecluster"),
	// 			VCores: to.Ptr[int32](4),
	// 			ReplicaCount: to.Ptr[int32](2),
	// 			ZonePlacementPolicy: to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
	// 			State: to.Ptr(armhorizondb.StateReady),
	// 			FullyQualifiedDomainName: to.Ptr("examplecluster.westus2.horizondb.azure.com"),
	// 			ReadonlyEndpoint: to.Ptr("examplecluster-ro.horizondb.azure.com"),
	// 			ProvisioningState: to.Ptr(armhorizondb.ProvisioningStateSucceeded),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-20-preview/Clusters_Delete.json
func ExampleClustersClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhorizondb.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "exampleresourcegroup", "examplecluster", 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: 2026-01-20-preview/Clusters_Get.json
func ExampleClustersClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhorizondb.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClustersClient().Get(ctx, "exampleresourcegroup", "examplecluster", 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 = armhorizondb.ClustersClientGetResponse{
	// 	Cluster: armhorizondb.Cluster{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.HorizonDb/clusters/examplecluster"),
	// 		Name: to.Ptr("examplecluster"),
	// 		Type: to.Ptr("Microsoft.HorizonDb/clusters"),
	// 		Location: to.Ptr("westus2"),
	// 		Tags: map[string]*string{
	// 			"env": to.Ptr("dev"),
	// 		},
	// 		Properties: &armhorizondb.ClusterProperties{
	// 			AdministratorLogin: to.Ptr("exampleadministratorlogin"),
	// 			Version: to.Ptr("17"),
	// 			VCores: to.Ptr[int32](4),
	// 			ReplicaCount: to.Ptr[int32](2),
	// 			ZonePlacementPolicy: to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
	// 			State: to.Ptr(armhorizondb.StateReady),
	// 			FullyQualifiedDomainName: to.Ptr("examplecluster.westus2.horizondb.azure.com"),
	// 			ReadonlyEndpoint: to.Ptr("examplecluster-ro.horizondb.azure.com"),
	// 			ProvisioningState: to.Ptr(armhorizondb.ProvisioningStateSucceeded),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-20-preview/Clusters_ListByResourceGroup.json
func ExampleClustersClient_NewListByResourceGroupPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhorizondb.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("exampleresourcegroup", 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 = armhorizondb.ClustersClientListByResourceGroupResponse{
		// 	ClusterListResult: armhorizondb.ClusterListResult{
		// 		Value: []*armhorizondb.Cluster{
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.HorizonDb/clusters/examplecluster"),
		// 				Name: to.Ptr("examplecluster"),
		// 				Type: to.Ptr("Microsoft.HorizonDb/clusters"),
		// 				Location: to.Ptr("westus2"),
		// 				Tags: map[string]*string{
		// 					"env": to.Ptr("dev"),
		// 				},
		// 				Properties: &armhorizondb.ClusterProperties{
		// 					AdministratorLogin: to.Ptr("exampleadministratorlogin"),
		// 					Version: to.Ptr("17"),
		// 					VCores: to.Ptr[int32](4),
		// 					ReplicaCount: to.Ptr[int32](2),
		// 					ZonePlacementPolicy: to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
		// 					State: to.Ptr(armhorizondb.StateReady),
		// 					FullyQualifiedDomainName: to.Ptr("examplecluster.westus2.horizondb.azure.com"),
		// 					ReadonlyEndpoint: to.Ptr("examplecluster-ro.westus2.horizondb.azure.com"),
		// 					ProvisioningState: to.Ptr(armhorizondb.ProvisioningStateSucceeded),
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.HorizonDb/clusters/examplecluster2"),
		// 				Name: to.Ptr("examplecluster2"),
		// 				Type: to.Ptr("Microsoft.HorizonDb/clusters"),
		// 				Location: to.Ptr("westus2"),
		// 				Tags: map[string]*string{
		// 					"environment": to.Ptr("development"),
		// 				},
		// 				Properties: &armhorizondb.ClusterProperties{
		// 					AdministratorLogin: to.Ptr("admin"),
		// 					Version: to.Ptr("17"),
		// 					VCores: to.Ptr[int32](2),
		// 					ReplicaCount: to.Ptr[int32](1),
		// 					ZonePlacementPolicy: to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
		// 					State: to.Ptr(armhorizondb.StateReady),
		// 					FullyQualifiedDomainName: to.Ptr("examplecluster2.westus2.horizondb.azure.com"),
		// 					ReadonlyEndpoint: to.Ptr("examplecluster2-ro.westus2.horizondb.azure.com"),
		// 					ProvisioningState: to.Ptr(armhorizondb.ProvisioningStateSucceeded),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-20-preview/Clusters_ListBySubscription.json
func ExampleClustersClient_NewListBySubscriptionPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhorizondb.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClustersClient().NewListBySubscriptionPager(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 = armhorizondb.ClustersClientListBySubscriptionResponse{
		// 	ClusterListResult: armhorizondb.ClusterListResult{
		// 		Value: []*armhorizondb.Cluster{
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.HorizonDb/clusters/examplecluster"),
		// 				Name: to.Ptr("examplecluster"),
		// 				Type: to.Ptr("Microsoft.HorizonDb/clusters"),
		// 				Location: to.Ptr("westus2"),
		// 				Tags: map[string]*string{
		// 					"env": to.Ptr("dev"),
		// 				},
		// 				Properties: &armhorizondb.ClusterProperties{
		// 					AdministratorLogin: to.Ptr("exampleadministratorlogin"),
		// 					Version: to.Ptr("17"),
		// 					VCores: to.Ptr[int32](4),
		// 					ReplicaCount: to.Ptr[int32](2),
		// 					ZonePlacementPolicy: to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
		// 					State: to.Ptr(armhorizondb.StateReady),
		// 					FullyQualifiedDomainName: to.Ptr("examplecluster.westus2.horizondb.azure.com"),
		// 					ReadonlyEndpoint: to.Ptr("examplecluster-ro.westus2.horizondb.azure.com"),
		// 					ProvisioningState: to.Ptr(armhorizondb.ProvisioningStateSucceeded),
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.HorizonDb/clusters/examplecluster2"),
		// 				Name: to.Ptr("examplecluster2"),
		// 				Type: to.Ptr("Microsoft.HorizonDb/clusters"),
		// 				Location: to.Ptr("westus2"),
		// 				Tags: map[string]*string{
		// 					"environment": to.Ptr("development"),
		// 				},
		// 				Properties: &armhorizondb.ClusterProperties{
		// 					AdministratorLogin: to.Ptr("admin"),
		// 					Version: to.Ptr("17"),
		// 					VCores: to.Ptr[int32](2),
		// 					ReplicaCount: to.Ptr[int32](1),
		// 					ZonePlacementPolicy: to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
		// 					State: to.Ptr(armhorizondb.StateReady),
		// 					FullyQualifiedDomainName: to.Ptr("examplecluster2.westus2.horizondb.azure.com"),
		// 					ReadonlyEndpoint: to.Ptr("examplecluster2-ro.westus2.horizondb.azure.com"),
		// 					ProvisioningState: to.Ptr(armhorizondb.ProvisioningStateSucceeded),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-20-preview/Clusters_Update.json
func ExampleClustersClient_BeginUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhorizondb.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "exampleresourcegroup", "examplecluster", armhorizondb.ClusterForPatchUpdate{
		Tags: map[string]*string{
			"team": to.Ptr("updated-data-platform"),
		},
		Properties: &armhorizondb.ClusterPropertiesForPatchUpdate{
			VCores:                     to.Ptr[int32](8),
			AdministratorLoginPassword: to.Ptr("examplenewpassword"),
		},
	}, 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 = armhorizondb.ClustersClientUpdateResponse{
	// 	Cluster: armhorizondb.Cluster{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.HorizonDb/clusters/examplecluster"),
	// 		Name: to.Ptr("examplecluster"),
	// 		Type: to.Ptr("Microsoft.HorizonDb/clusters"),
	// 		Location: to.Ptr("westus2"),
	// 		Tags: map[string]*string{
	// 			"env": to.Ptr("dev"),
	// 			"team": to.Ptr("updated-data-platform"),
	// 		},
	// 		Properties: &armhorizondb.ClusterProperties{
	// 			AdministratorLogin: to.Ptr("exampleadministratorlogin"),
	// 			Version: to.Ptr("17"),
	// 			CreateMode: to.Ptr(armhorizondb.CreateModeClusterUpdate),
	// 			VCores: to.Ptr[int32](8),
	// 			ReplicaCount: to.Ptr[int32](2),
	// 			ZonePlacementPolicy: to.Ptr(armhorizondb.ZonePlacementPolicyStrict),
	// 			State: to.Ptr(armhorizondb.StateReady),
	// 			FullyQualifiedDomainName: to.Ptr("examplecluster.westus2.horizondb.azure.com"),
	// 			ReadonlyEndpoint: to.Ptr("examplecluster-ro.westus2.horizondb.azure.com"),
	// 			ProvisioningState: to.Ptr(armhorizondb.ProvisioningStateSucceeded),
	// 		},
	// 	},
	// }
}
