// 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/CosmosDBFleetCreate.json
func ExampleFleetClient_Create() {
	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.NewFleetClient().Create(ctx, "rg1", "fleet1", armcosmos.FleetResource{
		Location: to.Ptr("West US"),
		Tags: map[string]*string{
			"Dept":        to.Ptr("Finance"),
			"Environment": to.Ptr("Production"),
		},
	}, 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.FleetClientCreateResponse{
	// 	FleetResource: armcosmos.FleetResource{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1"),
	// 		Name: to.Ptr("fleet1"),
	// 		Type: to.Ptr("Microsoft.DocumentDB/fleets"),
	// 		Location: to.Ptr("West US"),
	// 		Tags: map[string]*string{
	// 			"Dept": to.Ptr("Finance"),
	// 			"Environment": to.Ptr("Production"),
	// 		},
	// 		Properties: &armcosmos.FleetResourceProperties{
	// 			ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-15/fleet/CosmosDBFleetDelete.json
func ExampleFleetClient_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.NewFleetClient().BeginDelete(ctx, "rg1", "fleet1", 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/CosmosDBFleetGet.json
func ExampleFleetClient_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.NewFleetClient().Get(ctx, "rg1", "fleet1", 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.FleetClientGetResponse{
	// 	FleetResource: armcosmos.FleetResource{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1"),
	// 		Name: to.Ptr("fleet1"),
	// 		Type: to.Ptr("Microsoft.DocumentDB/fleets"),
	// 		Location: to.Ptr("West US"),
	// 		Tags: map[string]*string{
	// 			"Dept": to.Ptr("Finance"),
	// 			"Environment": to.Ptr("Production"),
	// 		},
	// 		Properties: &armcosmos.FleetResourceProperties{
	// 			ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-15/fleet/CosmosDBFleetList.json
func ExampleFleetClient_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.NewFleetClient().NewListPager(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.FleetClientListResponse{
		// 	FleetListResult: armcosmos.FleetListResult{
		// 		Value: []*armcosmos.FleetResource{
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1"),
		// 				Name: to.Ptr("fleet1"),
		// 				Type: to.Ptr("Microsoft.DocumentDB/fleets"),
		// 				Location: to.Ptr("West US"),
		// 				Tags: map[string]*string{
		// 					"Dept": to.Ptr("Finance"),
		// 					"Environment": to.Ptr("Production"),
		// 				},
		// 				Properties: &armcosmos.FleetResourceProperties{
		// 					ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg2/providers/Microsoft.DocumentDB/fleets/fleet2"),
		// 				Name: to.Ptr("fleet2"),
		// 				Type: to.Ptr("Microsoft.DocumentDB/fleets"),
		// 				Location: to.Ptr("East US"),
		// 				Tags: map[string]*string{
		// 					"Dept": to.Ptr("IT"),
		// 					"Environment": to.Ptr("Development"),
		// 				},
		// 				Properties: &armcosmos.FleetResourceProperties{
		// 					ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-03-15/fleet/CosmosDBFleetList_ListByResourceGroup.json
func ExampleFleetClient_NewListByResourceGroupPager() {
	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.NewFleetClient().NewListByResourceGroupPager("rg1", 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.FleetClientListByResourceGroupResponse{
		// 	FleetListResult: armcosmos.FleetListResult{
		// 		Value: []*armcosmos.FleetResource{
		// 			{
		// 				Name: to.Ptr("fleet1"),
		// 				Type: to.Ptr("Microsoft.DocumentDB/fleets"),
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1"),
		// 				Location: to.Ptr("West US"),
		// 				Properties: &armcosmos.FleetResourceProperties{
		// 					ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
		// 				},
		// 				Tags: map[string]*string{
		// 					"Dept": to.Ptr("Finance"),
		// 					"Environment": to.Ptr("Production"),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("fleet2"),
		// 				Type: to.Ptr("Microsoft.DocumentDB/fleets"),
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg2/providers/Microsoft.DocumentDB/fleets/fleet2"),
		// 				Location: to.Ptr("East US"),
		// 				Properties: &armcosmos.FleetResourceProperties{
		// 					ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
		// 				},
		// 				Tags: map[string]*string{
		// 					"Dept": to.Ptr("IT"),
		// 					"Environment": to.Ptr("Development"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-03-15/fleet/CosmosDBFleetUpdate.json
func ExampleFleetClient_Update() {
	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.NewFleetClient().Update(ctx, "rg1", "fleet1", armcosmos.FleetResourceUpdate{
		Properties: &armcosmos.FleetResourceProperties{},
	}, 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.FleetClientUpdateResponse{
	// 	FleetResource: armcosmos.FleetResource{
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/rg1/providers/Microsoft.DocumentDB/fleets/fleet1"),
	// 		Name: to.Ptr("fleet1"),
	// 		Type: to.Ptr("Microsoft.DocumentDB/fleets"),
	// 		Location: to.Ptr("West US"),
	// 		Tags: map[string]*string{
	// 			"Dept": to.Ptr("Finance"),
	// 			"Environment": to.Ptr("Production"),
	// 		},
	// 		Properties: &armcosmos.FleetResourceProperties{
	// 			ProvisioningState: to.Ptr(armcosmos.StatusSucceeded),
	// 		},
	// 	},
	// }
}
