// 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 armdynatrace_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/dynatrace/armdynatrace/v2"
	"log"
)

// Generated from example definition: 2024-04-24/TagRules_CreateOrUpdate_MaximumSet_Gen.json
func ExampleTagRulesClient_BeginCreateOrUpdate_tagRulesCreateOrUpdateMaximumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewTagRulesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.TagRule{
		Properties: &armdynatrace.MonitoringTagRulesProperties{
			LogRules: &armdynatrace.LogRules{
				FilteringTags: []*armdynatrace.FilteringTag{
					{
						Name:   to.Ptr("Environment"),
						Action: to.Ptr(armdynatrace.TagActionInclude),
						Value:  to.Ptr("Prod"),
					},
					{
						Name:   to.Ptr("Environment"),
						Action: to.Ptr(armdynatrace.TagActionExclude),
						Value:  to.Ptr("Dev"),
					},
				},
				SendAADLogs:          to.Ptr(armdynatrace.SendAADLogsStatusEnabled),
				SendActivityLogs:     to.Ptr(armdynatrace.SendActivityLogsStatusEnabled),
				SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled),
			},
			MetricRules: &armdynatrace.MetricRules{
				FilteringTags: []*armdynatrace.FilteringTag{
					{
						Name:   to.Ptr("Environment"),
						Action: to.Ptr(armdynatrace.TagActionInclude),
						Value:  to.Ptr("Prod"),
					},
				},
				SendingMetrics: to.Ptr(armdynatrace.SendingMetricsStatusEnabled),
			},
			ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted),
		},
	}, 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 = armdynatrace.TagRulesClientCreateOrUpdateResponse{
	// 	TagRule: armdynatrace.TagRule{
	// 		Name: to.Ptr("default"),
	// 		Type: to.Ptr("Dynatrace.Observability/monitors/tagRules"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Dynatrace.Observability/monitors/myMonitor/tagRules/default"),
	// 		Properties: &armdynatrace.MonitoringTagRulesProperties{
	// 			LogRules: &armdynatrace.LogRules{
	// 				FilteringTags: []*armdynatrace.FilteringTag{
	// 					{
	// 						Name: to.Ptr("Environment"),
	// 						Action: to.Ptr(armdynatrace.TagActionInclude),
	// 						Value: to.Ptr("Prod"),
	// 					},
	// 					{
	// 						Name: to.Ptr("Environment"),
	// 						Action: to.Ptr(armdynatrace.TagActionExclude),
	// 						Value: to.Ptr("Dev"),
	// 					},
	// 				},
	// 				SendAADLogs: to.Ptr(armdynatrace.SendAADLogsStatusEnabled),
	// 				SendActivityLogs: to.Ptr(armdynatrace.SendActivityLogsStatusEnabled),
	// 				SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled),
	// 			},
	// 			MetricRules: &armdynatrace.MetricRules{
	// 				FilteringTags: []*armdynatrace.FilteringTag{
	// 					{
	// 						Name: to.Ptr("Environment"),
	// 						Action: to.Ptr(armdynatrace.TagActionInclude),
	// 						Value: to.Ptr("Prod"),
	// 					},
	// 				},
	// 				SendingMetrics: to.Ptr(armdynatrace.SendingMetricsStatusEnabled),
	// 			},
	// 			ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted),
	// 		},
	// 		SystemData: &armdynatrace.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-16T04:25:21.040Z"); return t}()),
	// 			CreatedBy: to.Ptr("alice@microsoft.com"),
	// 			CreatedByType: to.Ptr(armdynatrace.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-16T04:25:21.040Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("alice@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armdynatrace.CreatedByTypeUser),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2024-04-24/TagRules_CreateOrUpdate_MinimumSet_Gen.json
func ExampleTagRulesClient_BeginCreateOrUpdate_tagRulesCreateOrUpdateMinimumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewTagRulesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.TagRule{
		Properties: &armdynatrace.MonitoringTagRulesProperties{},
	}, 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 = armdynatrace.TagRulesClientCreateOrUpdateResponse{
	// 	TagRule: armdynatrace.TagRule{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Dynatrace.Observability/monitors/myMonitor/tagRules/default"),
	// 		Properties: &armdynatrace.MonitoringTagRulesProperties{
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2024-04-24/TagRules_Delete_MaximumSet_Gen.json
func ExampleTagRulesClient_BeginDelete_tagRulesDeleteMaximumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewTagRulesClient().BeginDelete(ctx, "myResourceGroup", "myMonitor", "default", 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: 2024-04-24/TagRules_Delete_MinimumSet_Gen.json
func ExampleTagRulesClient_BeginDelete_tagRulesDeleteMinimumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewTagRulesClient().BeginDelete(ctx, "myResourceGroup", "myMonitor", "default", 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: 2024-04-24/TagRules_Get_MaximumSet_Gen.json
func ExampleTagRulesClient_Get_tagRulesGetMaximumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTagRulesClient().Get(ctx, "myResourceGroup", "myMonitor", "default", 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 = armdynatrace.TagRulesClientGetResponse{
	// 	TagRule: armdynatrace.TagRule{
	// 		Name: to.Ptr("default"),
	// 		Type: to.Ptr("Dynatrace.Observability/monitors/tagRules"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Dynatrace.Observability/monitors/myMonitor/tagRules/default"),
	// 		Properties: &armdynatrace.MonitoringTagRulesProperties{
	// 			LogRules: &armdynatrace.LogRules{
	// 				FilteringTags: []*armdynatrace.FilteringTag{
	// 					{
	// 						Name: to.Ptr("Environment"),
	// 						Action: to.Ptr(armdynatrace.TagActionInclude),
	// 						Value: to.Ptr("Prod"),
	// 					},
	// 					{
	// 						Name: to.Ptr("Environment"),
	// 						Action: to.Ptr(armdynatrace.TagActionExclude),
	// 						Value: to.Ptr("Dev"),
	// 					},
	// 				},
	// 				SendAADLogs: to.Ptr(armdynatrace.SendAADLogsStatusEnabled),
	// 				SendActivityLogs: to.Ptr(armdynatrace.SendActivityLogsStatusEnabled),
	// 				SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled),
	// 			},
	// 			MetricRules: &armdynatrace.MetricRules{
	// 				FilteringTags: []*armdynatrace.FilteringTag{
	// 					{
	// 						Name: to.Ptr("Environment"),
	// 						Action: to.Ptr(armdynatrace.TagActionInclude),
	// 						Value: to.Ptr("Prod"),
	// 					},
	// 				},
	// 				SendingMetrics: to.Ptr(armdynatrace.SendingMetricsStatusEnabled),
	// 			},
	// 			ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted),
	// 		},
	// 		SystemData: &armdynatrace.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-16T04:25:21.040Z"); return t}()),
	// 			CreatedBy: to.Ptr("alice@microsoft.com"),
	// 			CreatedByType: to.Ptr(armdynatrace.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-16T04:25:21.040Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("alice@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armdynatrace.CreatedByTypeUser),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2024-04-24/TagRules_Get_MinimumSet_Gen.json
func ExampleTagRulesClient_Get_tagRulesGetMinimumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTagRulesClient().Get(ctx, "myResourceGroup", "myMonitor", "default", 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 = armdynatrace.TagRulesClientGetResponse{
	// 	TagRule: armdynatrace.TagRule{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Dynatrace.Observability/monitors/myMonitor/tagRules/default"),
	// 		Properties: &armdynatrace.MonitoringTagRulesProperties{
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2024-04-24/TagRules_List_MaximumSet_Gen.json
func ExampleTagRulesClient_NewListPager_tagRulesListMaximumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTagRulesClient().NewListPager("myResourceGroup", "myMonitor", 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 = armdynatrace.TagRulesClientListResponse{
		// 	TagRuleListResult: armdynatrace.TagRuleListResult{
		// 		NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Dynatrace.Observability/monitors?api-version=2024-04-24&$skiptoken=abc123"),
		// 		Value: []*armdynatrace.TagRule{
		// 			{
		// 				Name: to.Ptr("default"),
		// 				Type: to.Ptr("Dynatrace.Observability/monitors/tagRules"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Dynatrace.Observability/monitors/myMonitor/tagRules/default"),
		// 				Properties: &armdynatrace.MonitoringTagRulesProperties{
		// 					LogRules: &armdynatrace.LogRules{
		// 						FilteringTags: []*armdynatrace.FilteringTag{
		// 							{
		// 								Name: to.Ptr("Environment"),
		// 								Action: to.Ptr(armdynatrace.TagActionInclude),
		// 								Value: to.Ptr("Prod"),
		// 							},
		// 							{
		// 								Name: to.Ptr("Environment"),
		// 								Action: to.Ptr(armdynatrace.TagActionExclude),
		// 								Value: to.Ptr("Dev"),
		// 							},
		// 						},
		// 						SendAADLogs: to.Ptr(armdynatrace.SendAADLogsStatusEnabled),
		// 						SendActivityLogs: to.Ptr(armdynatrace.SendActivityLogsStatusEnabled),
		// 						SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled),
		// 					},
		// 					MetricRules: &armdynatrace.MetricRules{
		// 						FilteringTags: []*armdynatrace.FilteringTag{
		// 							{
		// 								Name: to.Ptr("Environment"),
		// 								Action: to.Ptr(armdynatrace.TagActionInclude),
		// 								Value: to.Ptr("Prod"),
		// 							},
		// 						},
		// 						SendingMetrics: to.Ptr(armdynatrace.SendingMetricsStatusEnabled),
		// 					},
		// 					ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted),
		// 				},
		// 				SystemData: &armdynatrace.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-16T04:25:21.040Z"); return t}()),
		// 					CreatedBy: to.Ptr("alice@microsoft.com"),
		// 					CreatedByType: to.Ptr(armdynatrace.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-16T04:25:21.040Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("alice@microsoft.com"),
		// 					LastModifiedByType: to.Ptr(armdynatrace.CreatedByTypeUser),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2024-04-24/TagRules_List_MinimumSet_Gen.json
func ExampleTagRulesClient_NewListPager_tagRulesListMinimumSetGen() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdynatrace.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTagRulesClient().NewListPager("myResourceGroup", "myMonitor", 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 = armdynatrace.TagRulesClientListResponse{
		// 	TagRuleListResult: armdynatrace.TagRuleListResult{
		// 		NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Dynatrace.Observability/monitors?api-version=2024-04-24&$skiptoken=abc123"),
		// 		Value: []*armdynatrace.TagRule{
		// 			{
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Dynatrace.Observability/monitors/myMonitor/tagRules/default"),
		// 				Properties: &armdynatrace.MonitoringTagRulesProperties{
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
