// 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 armmonitor_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/monitor/armmonitor"
	"log"
)

// Generated from example definition: 2023-05-01-preview/postTestNotificationsAtTenantActionGroupResourceLevel.json
func ExampleCombineClient_BeginCreateNotificationsAtTenantActionGroupResourceLevel() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmonitor.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewCombineClient().BeginCreateNotificationsAtTenantActionGroupResourceLevel(ctx, "11111111-1111-1111-1111-111111111111", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.TenantNotificationRequestBody{
		AlertType: to.Ptr("servicehealth"),
		AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{
			{
				Name:         to.Ptr("Sample azureAppPush"),
				EmailAddress: to.Ptr("johndoe@email.com"),
			},
		},
		EmailReceivers: []*armmonitor.EmailReceiver{
			{
				Name:                 to.Ptr("John Doe's email"),
				EmailAddress:         to.Ptr("johndoe@email.com"),
				UseCommonAlertSchema: to.Ptr(false),
			},
			{
				Name:                 to.Ptr("Jane Smith's email"),
				EmailAddress:         to.Ptr("janesmith@email.com"),
				UseCommonAlertSchema: to.Ptr(true),
			},
		},
		SmsReceivers: []*armmonitor.SmsReceiver{
			{
				Name:        to.Ptr("John Doe's mobile"),
				CountryCode: to.Ptr("1"),
				PhoneNumber: to.Ptr("1234567890"),
			},
			{
				Name:        to.Ptr("Jane Smith's mobile"),
				CountryCode: to.Ptr("1"),
				PhoneNumber: to.Ptr("0987654321"),
			},
		},
		VoiceReceivers: []*armmonitor.VoiceReceiver{
			{
				Name:        to.Ptr("Sample voice"),
				CountryCode: to.Ptr("1"),
				PhoneNumber: to.Ptr("1234567890"),
			},
		},
		WebhookReceivers: []*armmonitor.TenantActionGroupWebhookReceiver{
			{
				Name:                 to.Ptr("Sample webhook 1"),
				ServiceURI:           to.Ptr("http://www.example.com/webhook1"),
				UseCommonAlertSchema: to.Ptr(true),
			},
			{
				Name:                 to.Ptr("Sample webhook 2"),
				IdentifierURI:        to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"),
				ObjectID:             to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"),
				ServiceURI:           to.Ptr("http://www.example.com/webhook2"),
				TenantID:             to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"),
				UseAADAuth:           to.Ptr(true),
				UseCommonAlertSchema: to.Ptr(true),
			},
		},
	}, 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 = armmonitor.CombineClientCreateNotificationsAtTenantActionGroupResourceLevelResponse{
	// 	TenantActionGroupTestNotificationDetailsResponse: armmonitor.TenantActionGroupTestNotificationDetailsResponse{
	// 		ActionDetails: []*armmonitor.TenantActionGroupActionDetail{
	// 			{
	// 				Name: to.Ptr("AzureAppPush-name"),
	// 				MechanismType: to.Ptr("AzureAppPush"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Email-name"),
	// 				MechanismType: to.Ptr("Email"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Webhook-name"),
	// 				MechanismType: to.Ptr("Webhook"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("SecureWebhook-name"),
	// 				MechanismType: to.Ptr("SecureWebhook"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Sms-name"),
	// 				MechanismType: to.Ptr("Sms"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Voice-name"),
	// 				MechanismType: to.Ptr("Voice"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 		},
	// 		CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"),
	// 		Context: &armmonitor.Context{
	// 			ContextType: to.Ptr("Microsoft.Insights/ServiceHealth"),
	// 			NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"),
	// 		},
	// 		CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"),
	// 		State: to.Ptr("Completed"),
	// 	},
	// }
}

// Generated from example definition: 2023-05-01-preview/getTestNotificationsAtTenantActionGroupResourceLevel.json
func ExampleCombineClient_GetTestNotificationsAtTenantActionGroupResourceLevel() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmonitor.NewClientFactory("<subscriptionID>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCombineClient().GetTestNotificationsAtTenantActionGroupResourceLevel(ctx, "11111111-1111-1111-1111-111111111111", "testTenantActionGroup", "11000222191287", "72f988bf-86f1-41af-91ab-2d7cd011db47", 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 = armmonitor.CombineClientGetTestNotificationsAtTenantActionGroupResourceLevelResponse{
	// 	TenantActionGroupTestNotificationDetailsResponse: armmonitor.TenantActionGroupTestNotificationDetailsResponse{
	// 		ActionDetails: []*armmonitor.TenantActionGroupActionDetail{
	// 			{
	// 				Name: to.Ptr("AzureAppPush-name"),
	// 				MechanismType: to.Ptr("AzureAppPush"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Email-name"),
	// 				MechanismType: to.Ptr("Email"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Webhook-name"),
	// 				MechanismType: to.Ptr("Webhook"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("SecureWebhook-name"),
	// 				MechanismType: to.Ptr("SecureWebhook"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Sms-name"),
	// 				MechanismType: to.Ptr("Sms"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 			{
	// 				Name: to.Ptr("Voice-name"),
	// 				MechanismType: to.Ptr("Voice"),
	// 				SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"),
	// 				Status: to.Ptr("Completed"),
	// 				SubState: to.Ptr("Default"),
	// 			},
	// 		},
	// 		CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"),
	// 		Context: &armmonitor.Context{
	// 			ContextType: to.Ptr("Microsoft.Insights/ServiceHealth"),
	// 			NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"),
	// 		},
	// 		CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"),
	// 		State: to.Ptr("Completed"),
	// 	},
	// }
}
