// 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 armstorage_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/storage/armstorage/v4"
	"log"
)

// Generated from example definition: 2026-04-01/AdvancedPlatformMetricsCRUD/AdvancedPlatformMetricsRules_CreateOrUpdate_AllContainers.json
func ExampleAdvancedPlatformMetricsClient_CreateOrUpdate_advancedPlatformMetricsRulesCreateOrUpdateAllContainersCreateAdvancedPlatformMetricsRuleWithAllContainersFilter() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAdvancedPlatformMetricsClient().CreateOrUpdate(ctx, "res6977", "sto2527", armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics, armstorage.AdvancedPlatformMetricsRule{
		Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
			Enabled: to.Ptr(true),
			RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
				FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeAllContainersFilter),
			},
		},
	}, 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 = armstorage.AdvancedPlatformMetricsClientCreateOrUpdateResponse{
	// 	AdvancedPlatformMetricsRule: armstorage.AdvancedPlatformMetricsRule{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/advancedPlatformMetrics/ContainerLevelCapacityMetrics"),
	// 		Name: to.Ptr("DefaultAdvancedPlatformMetricsRule"),
	// 		Type: to.Ptr("Microsoft.Storage/storageAccounts/advancedPlatformMetrics"),
	// 		Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
	// 			RuleType: to.Ptr(armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics),
	// 			Enabled: to.Ptr(true),
	// 			LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T11:00:00.0000000Z"); return t}()),
	// 			MetricsEmitted: []*armstorage.MetricsEmitted{
	// 				to.Ptr(armstorage.MetricsEmittedContainerUsedSize),
	// 				to.Ptr(armstorage.MetricsEmittedContainerBlobCount),
	// 			},
	// 			RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
	// 				FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeAllContainersFilter),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-04-01/AdvancedPlatformMetricsCRUD/AdvancedPlatformMetricsRules_CreateOrUpdate_ContainerList.json
func ExampleAdvancedPlatformMetricsClient_CreateOrUpdate_advancedPlatformMetricsRulesCreateOrUpdateContainerListCreateAdvancedPlatformMetricsRuleWithContainerListFilter() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAdvancedPlatformMetricsClient().CreateOrUpdate(ctx, "res6977", "sto2527", armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics, armstorage.AdvancedPlatformMetricsRule{
		Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
			Enabled: to.Ptr(true),
			RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
				FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeContainerListFilter),
				FilterValues: []*string{
					to.Ptr("container1"),
					to.Ptr("container2"),
					to.Ptr("container3"),
				},
			},
		},
	}, 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 = armstorage.AdvancedPlatformMetricsClientCreateOrUpdateResponse{
	// 	AdvancedPlatformMetricsRule: armstorage.AdvancedPlatformMetricsRule{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/advancedPlatformMetrics/ContainerLevelCapacityMetrics"),
	// 		Name: to.Ptr("DefaultAdvancedPlatformMetricsRule"),
	// 		Type: to.Ptr("Microsoft.Storage/storageAccounts/advancedPlatformMetrics"),
	// 		Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
	// 			RuleType: to.Ptr(armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics),
	// 			Enabled: to.Ptr(true),
	// 			LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T11:00:00.0000000Z"); return t}()),
	// 			MetricsEmitted: []*armstorage.MetricsEmitted{
	// 				to.Ptr(armstorage.MetricsEmittedContainerUsedSize),
	// 				to.Ptr(armstorage.MetricsEmittedContainerBlobCount),
	// 			},
	// 			RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
	// 				FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeContainerListFilter),
	// 				FilterValues: []*string{
	// 					to.Ptr("container1"),
	// 					to.Ptr("container2"),
	// 					to.Ptr("container3"),
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-04-01/AdvancedPlatformMetricsCRUD/AdvancedPlatformMetricsRules_CreateOrUpdate_ContainerPrefix.json
func ExampleAdvancedPlatformMetricsClient_CreateOrUpdate_advancedPlatformMetricsRulesCreateOrUpdateContainerPrefixCreateAdvancedPlatformMetricsRuleWithContainerPrefixFilter() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAdvancedPlatformMetricsClient().CreateOrUpdate(ctx, "res6977", "sto2527", armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics, armstorage.AdvancedPlatformMetricsRule{
		Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
			Enabled: to.Ptr(true),
			RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
				FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeContainerPrefixFilter),
				FilterValues: []*string{
					to.Ptr("logs"),
					to.Ptr("data"),
				},
			},
		},
	}, 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 = armstorage.AdvancedPlatformMetricsClientCreateOrUpdateResponse{
	// 	AdvancedPlatformMetricsRule: armstorage.AdvancedPlatformMetricsRule{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/advancedPlatformMetrics/ContainerLevelCapacityMetrics"),
	// 		Name: to.Ptr("DefaultAdvancedPlatformMetricsRule"),
	// 		Type: to.Ptr("Microsoft.Storage/storageAccounts/advancedPlatformMetrics"),
	// 		Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
	// 			RuleType: to.Ptr(armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics),
	// 			Enabled: to.Ptr(true),
	// 			LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T11:00:00.0000000Z"); return t}()),
	// 			MetricsEmitted: []*armstorage.MetricsEmitted{
	// 				to.Ptr(armstorage.MetricsEmittedContainerUsedSize),
	// 				to.Ptr(armstorage.MetricsEmittedContainerBlobCount),
	// 			},
	// 			RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
	// 				FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeContainerPrefixFilter),
	// 				FilterValues: []*string{
	// 					to.Ptr("logs"),
	// 					to.Ptr("data"),
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-04-01/AdvancedPlatformMetricsCRUD/AdvancedPlatformMetricsRules_Delete.json
func ExampleAdvancedPlatformMetricsClient_Delete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAdvancedPlatformMetricsClient().Delete(ctx, "res6977", "sto2527", armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics, 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 = armstorage.AdvancedPlatformMetricsClientDeleteResponse{
	// }
}

// Generated from example definition: 2026-04-01/AdvancedPlatformMetricsCRUD/AdvancedPlatformMetricsRules_Get.json
func ExampleAdvancedPlatformMetricsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAdvancedPlatformMetricsClient().Get(ctx, "res6977", "sto2527", armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics, 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 = armstorage.AdvancedPlatformMetricsClientGetResponse{
	// 	AdvancedPlatformMetricsRule: armstorage.AdvancedPlatformMetricsRule{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/advancedPlatformMetrics/ContainerLevelCapacityMetrics"),
	// 		Name: to.Ptr("DefaultAdvancedPlatformMetricsRule"),
	// 		Type: to.Ptr("Microsoft.Storage/storageAccounts/advancedPlatformMetrics"),
	// 		Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
	// 			RuleType: to.Ptr(armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics),
	// 			Enabled: to.Ptr(true),
	// 			LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T11:00:00.0000000Z"); return t}()),
	// 			MetricsEmitted: []*armstorage.MetricsEmitted{
	// 				to.Ptr(armstorage.MetricsEmittedContainerUsedSize),
	// 				to.Ptr(armstorage.MetricsEmittedContainerBlobCount),
	// 			},
	// 			RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
	// 				FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeAllContainersFilter),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-04-01/AdvancedPlatformMetricsCRUD/AdvancedPlatformMetricsRules_List.json
func ExampleAdvancedPlatformMetricsClient_NewListPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAdvancedPlatformMetricsClient().NewListPager("res6977", "sto2527", 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 = armstorage.AdvancedPlatformMetricsClientListResponse{
		// 	AdvancedPlatformMetricsRuleListResult: armstorage.AdvancedPlatformMetricsRuleListResult{
		// 		Value: []*armstorage.AdvancedPlatformMetricsRule{
		// 			{
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/advancedPlatformMetrics/ContainerLevelCapacityMetrics"),
		// 				Name: to.Ptr("DefaultAdvancedPlatformMetricsRule"),
		// 				Type: to.Ptr("Microsoft.Storage/storageAccounts/advancedPlatformMetrics"),
		// 				Properties: &armstorage.AdvancedPlatformMetricsRuleProperties{
		// 					RuleType: to.Ptr(armstorage.AdvancedPlatformMetricsRuleTypeContainerLevelCapacityMetrics),
		// 					Enabled: to.Ptr(true),
		// 					LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T11:00:00.0000000Z"); return t}()),
		// 					MetricsEmitted: []*armstorage.MetricsEmitted{
		// 						to.Ptr(armstorage.MetricsEmittedContainerUsedSize),
		// 						to.Ptr(armstorage.MetricsEmittedContainerBlobCount),
		// 					},
		// 					RuleConfig: &armstorage.AdvancedPlatformMetricsRuleConfig{
		// 						FilterType: to.Ptr(armstorage.AdvancedPlatformMetricsFilterTypeAllContainersFilter),
		// 					},
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
