// 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 armcosmos_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/cosmos/armcosmos/v4"
	"log"
)

// Generated from example definition: 2026-03-15/fleet/CosmosDBFleetspaceAccountCreate.json
func ExampleFleetspaceAccountClient_BeginCreate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcosmos.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewFleetspaceAccountClient().BeginCreate(ctx, "rg1", "fleet1", "fleetspace1", "db1", armcosmos.FleetspaceAccountResource{
		Properties: &armcosmos.FleetspaceAccountProperties{
			GlobalDatabaseAccountProperties: &armcosmos.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties{
				ArmLocation: to.Ptr("West US"),
				ResourceID:  to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DocumentDB/resourceGroup/rg1/databaseAccounts/db1"),
			},
		},
	}, 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 = armcosmos.FleetspaceAccountClientCreateResponse{
	// 	FleetspaceAccountResource: armcosmos.FleetspaceAccountResource{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1/fleetspaces/fleetspace1/fleetspaceAccounts/db1"),
	// 		Name: to.Ptr("db1"),
	// 		Type: to.Ptr("Microsoft.DocumentDB/fleets/fleetspaces/fleetspaceAccounts"),
	// 		Properties: &armcosmos.FleetspaceAccountProperties{
	// 			ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
	// 			GlobalDatabaseAccountProperties: &armcosmos.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties{
	// 				ArmLocation: to.Ptr("West US"),
	// 				ResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DocumentDB/resourceGroup/rg1/databaseAccounts/db1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-15/fleet/CosmosDBFleetspaceAccountDelete.json
func ExampleFleetspaceAccountClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcosmos.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewFleetspaceAccountClient().BeginDelete(ctx, "rg1", "fleet1", "fleetspace1", "db1", 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-03-15/fleet/CosmosDBFleetspaceAccountGet.json
func ExampleFleetspaceAccountClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcosmos.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewFleetspaceAccountClient().Get(ctx, "rg1", "fleet1", "fleetspace1", "db1", 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 = armcosmos.FleetspaceAccountClientGetResponse{
	// 	FleetspaceAccountResource: armcosmos.FleetspaceAccountResource{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1/fleetspaces/fleetspace1/fleetspaceAccounts/db1"),
	// 		Name: to.Ptr("db1"),
	// 		Type: to.Ptr("Microsoft.DocumentDB/fleets/fleetspaces/fleetspaceAccounts"),
	// 		Properties: &armcosmos.FleetspaceAccountProperties{
	// 			ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
	// 			GlobalDatabaseAccountProperties: &armcosmos.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties{
	// 				ArmLocation: to.Ptr("West US"),
	// 				ResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/db1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-15/fleet/CosmosDBFleetspaceAccountList.json
func ExampleFleetspaceAccountClient_NewListPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcosmos.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewFleetspaceAccountClient().NewListPager("rg1", "fleet1", "fleetspace1", 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 = armcosmos.FleetspaceAccountClientListResponse{
		// 	FleetspaceAccountListResult: armcosmos.FleetspaceAccountListResult{
		// 		Value: []*armcosmos.FleetspaceAccountResource{
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1/fleetspaces/fleetspace1/fleetspaceAccounts/db1"),
		// 				Name: to.Ptr("db1"),
		// 				Type: to.Ptr("Microsoft.DocumentDB/fleets/fleetspaces/fleetspaceAccounts"),
		// 				Properties: &armcosmos.FleetspaceAccountProperties{
		// 					ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
		// 					GlobalDatabaseAccountProperties: &armcosmos.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties{
		// 						ArmLocation: to.Ptr("West US"),
		// 						ResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DocumentDB/resourceGroup/rg1/databaseAccounts/db1"),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1/fleetspaces/fleetspace1/fleetspaceAccounts/db2"),
		// 				Name: to.Ptr("db2"),
		// 				Type: to.Ptr("Microsoft.DocumentDB/fleets/fleetspaces/fleetspaceAccounts"),
		// 				Properties: &armcosmos.FleetspaceAccountProperties{
		// 					ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
		// 					GlobalDatabaseAccountProperties: &armcosmos.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties{
		// 						ArmLocation: to.Ptr("North Central US"),
		// 						ResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DocumentDB/resourceGroup/rg1/databaseAccounts/db2"),
		// 					},
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
