// 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 armcontainerservice_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/containerservice/armcontainerservice/v9"
	"log"
)

// Generated from example definition: 2026-05-02-preview/AlertConfigurations_CreateOrUpdate.json
func ExampleAlertConfigurationsClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAlertConfigurationsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "alertconfig1", armcontainerservice.AlertConfiguration{
		Properties: &armcontainerservice.AlertConfigurationProperties{
			Mode: to.Ptr(armcontainerservice.AlertConfigurationModeManaged),
			Notification: &armcontainerservice.AlertNotification{
				ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/actiongroup1"),
			},
		},
	}, 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 = armcontainerservice.AlertConfigurationsClientCreateOrUpdateResponse{
	// 	AlertConfiguration: armcontainerservice.AlertConfiguration{
	// 		Name: to.Ptr("alertconfig1"),
	// 		Type: to.Ptr("Microsoft.ContainerService/managedClusters/alertConfigurations"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/alertConfigurations/alertconfig1"),
	// 		Properties: &armcontainerservice.AlertConfigurationProperties{
	// 			Mode: to.Ptr(armcontainerservice.AlertConfigurationModeManaged),
	// 			Notification: &armcontainerservice.AlertNotification{
	// 				ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/actiongroup1"),
	// 			},
	// 			ProvisioningState: to.Ptr(armcontainerservice.AlertConfigurationProvisioningStateSucceeded),
	// 		},
	// 		SystemData: &armcontainerservice.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T00:00:00.0000000Z"); return t}()),
	// 			CreatedBy: to.Ptr("user@example.com"),
	// 			CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T00:00:00.0000000Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("user@example.com"),
	// 			LastModifiedByType: to.Ptr(armcontainerservice.CreatedByTypeUser),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-05-02-preview/AlertConfigurations_Delete.json
func ExampleAlertConfigurationsClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAlertConfigurationsClient().BeginDelete(ctx, "rg1", "clustername1", "alertconfig1", 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-05-02-preview/AlertConfigurations_Get.json
func ExampleAlertConfigurationsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAlertConfigurationsClient().Get(ctx, "rg1", "clustername1", "alertconfig1", 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 = armcontainerservice.AlertConfigurationsClientGetResponse{
	// 	AlertConfiguration: armcontainerservice.AlertConfiguration{
	// 		Name: to.Ptr("alertconfig1"),
	// 		Type: to.Ptr("Microsoft.ContainerService/managedClusters/alertConfigurations"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/alertConfigurations/alertconfig1"),
	// 		Properties: &armcontainerservice.AlertConfigurationProperties{
	// 			Mode: to.Ptr(armcontainerservice.AlertConfigurationModeManaged),
	// 			Notification: &armcontainerservice.AlertNotification{
	// 				ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/actiongroup1"),
	// 			},
	// 			ProvisioningState: to.Ptr(armcontainerservice.AlertConfigurationProvisioningStateSucceeded),
	// 		},
	// 		SystemData: &armcontainerservice.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T00:00:00.0000000Z"); return t}()),
	// 			CreatedBy: to.Ptr("user@example.com"),
	// 			CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T00:00:00.0000000Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("user@example.com"),
	// 			LastModifiedByType: to.Ptr(armcontainerservice.CreatedByTypeUser),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-05-02-preview/AlertConfigurations_ListByManagedCluster.json
func ExampleAlertConfigurationsClient_NewListByManagedClusterPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcontainerservice.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAlertConfigurationsClient().NewListByManagedClusterPager("rg1", "clustername1", 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 = armcontainerservice.AlertConfigurationsClientListByManagedClusterResponse{
		// 	AlertConfigurationListResult: armcontainerservice.AlertConfigurationListResult{
		// 		Value: []*armcontainerservice.AlertConfiguration{
		// 			{
		// 				Name: to.Ptr("alertconfig1"),
		// 				Type: to.Ptr("Microsoft.ContainerService/managedClusters/alertConfigurations"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/alertConfigurations/alertconfig1"),
		// 				Properties: &armcontainerservice.AlertConfigurationProperties{
		// 					Mode: to.Ptr(armcontainerservice.AlertConfigurationModeManaged),
		// 					Notification: &armcontainerservice.AlertNotification{
		// 						ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/actiongroup1"),
		// 					},
		// 					ProvisioningState: to.Ptr(armcontainerservice.AlertConfigurationProvisioningStateSucceeded),
		// 				},
		// 				SystemData: &armcontainerservice.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T00:00:00.0000000Z"); return t}()),
		// 					CreatedBy: to.Ptr("user@example.com"),
		// 					CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-01T00:00:00.0000000Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("user@example.com"),
		// 					LastModifiedByType: to.Ptr(armcontainerservice.CreatedByTypeUser),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
