// 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 armmaintenance_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/maintenance/armmaintenance"
	"log"
)

// Generated from example definition: 2023-10-01-preview/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json
func ExampleConfigurationAssignmentsForSubscriptionsClient_CreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmaintenance.NewClientFactory("5b4b650e-28b9-4790-b3ab-ddbd88d727c4", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewConfigurationAssignmentsForSubscriptionsClient().CreateOrUpdate(ctx, "workervmConfiguration", armmaintenance.ConfigurationAssignment{
		Properties: &armmaintenance.ConfigurationAssignmentProperties{
			Filter: &armmaintenance.ConfigurationAssignmentFilterProperties{
				Locations: []*string{
					to.Ptr("Japan East"),
					to.Ptr("UK South"),
				},
				ResourceGroups: []*string{
					to.Ptr("RG1"),
					to.Ptr("RG2"),
				},
				ResourceTypes: []*string{
					to.Ptr("Microsoft.HybridCompute/machines"),
					to.Ptr("Microsoft.Compute/virtualMachines"),
				},
				TagSettings: &armmaintenance.TagSettingsProperties{
					FilterOperator: to.Ptr(armmaintenance.TagOperatorsAny),
					Tags: map[string][]*string{
						"tag1": {
							to.Ptr("tag1Value1"),
							to.Ptr("tag1Value2"),
							to.Ptr("tag1Value3"),
						},
						"tag2": {
							to.Ptr("tag2Value1"),
							to.Ptr("tag2Value2"),
							to.Ptr("tag2Value3"),
						},
					},
				},
			},
			MaintenanceConfigurationID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1"),
		},
	}, 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 = armmaintenance.ConfigurationAssignmentsForSubscriptionsClientCreateOrUpdateResponse{
	// 	ConfigurationAssignment: armmaintenance.ConfigurationAssignment{
	// 		Name: to.Ptr("workervmConfiguration"),
	// 		Type: to.Ptr("Microsoft.Maintenance/configurationAssignments"),
	// 		ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.Maintenance/configurationAssignments/workervmConfiguration"),
	// 		Properties: &armmaintenance.ConfigurationAssignmentProperties{
	// 			Filter: &armmaintenance.ConfigurationAssignmentFilterProperties{
	// 				Locations: []*string{
	// 					to.Ptr("Japan East"),
	// 					to.Ptr("UK South"),
	// 				},
	// 				ResourceGroups: []*string{
	// 					to.Ptr("RG1"),
	// 					to.Ptr("RG2"),
	// 				},
	// 				ResourceTypes: []*string{
	// 					to.Ptr("Microsoft.HybridCompute/machines"),
	// 					to.Ptr("Microsoft.Compute/virtualMachines"),
	// 				},
	// 				TagSettings: &armmaintenance.TagSettingsProperties{
	// 					FilterOperator: to.Ptr(armmaintenance.TagOperatorsAny),
	// 					Tags: map[string][]*string{
	// 						"tag1": []*string{
	// 							to.Ptr("tag1Value1"),
	// 							to.Ptr("tag1Value2"),
	// 							to.Ptr("tag1Value3"),
	// 						},
	// 						"tag2": []*string{
	// 							to.Ptr("tag2Value1"),
	// 							to.Ptr("tag2Value2"),
	// 							to.Ptr("tag2Value3"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			MaintenanceConfigurationID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1"),
	// 			ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2023-10-01-preview/ConfigurationAssignmentsForSubscriptions_Delete.json
func ExampleConfigurationAssignmentsForSubscriptionsClient_Delete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmaintenance.NewClientFactory("5b4b650e-28b9-4790-b3ab-ddbd88d727c4", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewConfigurationAssignmentsForSubscriptionsClient().Delete(ctx, "workervmConfiguration", 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 = armmaintenance.ConfigurationAssignmentsForSubscriptionsClientDeleteResponse{
	// 	ConfigurationAssignment: armmaintenance.ConfigurationAssignment{
	// 		Name: to.Ptr("workervmConfiguration"),
	// 		Type: to.Ptr("Microsoft.Maintenance/configurationAssignments"),
	// 		ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.Maintenance/configurationAssignments/workervmConfiguration"),
	// 	},
	// }
}

// Generated from example definition: 2023-10-01-preview/ConfigurationAssignmentsForSubscriptions_Get.json
func ExampleConfigurationAssignmentsForSubscriptionsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmaintenance.NewClientFactory("5b4b650e-28b9-4790-b3ab-ddbd88d727c4", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewConfigurationAssignmentsForSubscriptionsClient().Get(ctx, "workervmConfiguration", 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 = armmaintenance.ConfigurationAssignmentsForSubscriptionsClientGetResponse{
	// 	ConfigurationAssignment: armmaintenance.ConfigurationAssignment{
	// 		Name: to.Ptr("workervmConfiguration"),
	// 		Type: to.Ptr("Microsoft.Maintenance/configurationAssignments"),
	// 		ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.Maintenance/configurationAssignments/workervmConfiguration"),
	// 		Properties: &armmaintenance.ConfigurationAssignmentProperties{
	// 			Filter: &armmaintenance.ConfigurationAssignmentFilterProperties{
	// 				Locations: []*string{
	// 					to.Ptr("Japan East"),
	// 					to.Ptr("UK South"),
	// 				},
	// 				ResourceTypes: []*string{
	// 					to.Ptr("Microsoft.HybridCompute/machines"),
	// 					to.Ptr("Microsoft.Compute/virtualMachines"),
	// 				},
	// 				TagSettings: &armmaintenance.TagSettingsProperties{
	// 					FilterOperator: to.Ptr(armmaintenance.TagOperatorsAll),
	// 					Tags: map[string][]*string{
	// 						"tag1": []*string{
	// 							to.Ptr("tag1Value1"),
	// 							to.Ptr("tag1Value2"),
	// 							to.Ptr("tag1Value3"),
	// 						},
	// 						"tag2": []*string{
	// 							to.Ptr("tag2Value1"),
	// 							to.Ptr("tag2Value2"),
	// 							to.Ptr("tag2Value3"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			MaintenanceConfigurationID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1"),
	// 			ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2023-10-01-preview/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json
func ExampleConfigurationAssignmentsForSubscriptionsClient_Update() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armmaintenance.NewClientFactory("5b4b650e-28b9-4790-b3ab-ddbd88d727c4", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewConfigurationAssignmentsForSubscriptionsClient().Update(ctx, "workervmConfiguration", armmaintenance.ConfigurationAssignment{
		Properties: &armmaintenance.ConfigurationAssignmentProperties{
			Filter: &armmaintenance.ConfigurationAssignmentFilterProperties{
				Locations: []*string{
					to.Ptr("Japan East"),
					to.Ptr("UK South"),
				},
				ResourceGroups: []*string{
					to.Ptr("RG1"),
					to.Ptr("RG2"),
				},
				ResourceTypes: []*string{
					to.Ptr("Microsoft.HybridCompute/machines"),
					to.Ptr("Microsoft.Compute/virtualMachines"),
				},
				TagSettings: &armmaintenance.TagSettingsProperties{
					FilterOperator: to.Ptr(armmaintenance.TagOperatorsAny),
					Tags: map[string][]*string{
						"tag1": {
							to.Ptr("tag1Value1"),
							to.Ptr("tag1Value2"),
							to.Ptr("tag1Value3"),
						},
						"tag2": {
							to.Ptr("tag2Value1"),
							to.Ptr("tag2Value2"),
							to.Ptr("tag2Value3"),
						},
					},
				},
			},
			MaintenanceConfigurationID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1"),
		},
	}, 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 = armmaintenance.ConfigurationAssignmentsForSubscriptionsClientUpdateResponse{
	// 	ConfigurationAssignment: armmaintenance.ConfigurationAssignment{
	// 		Name: to.Ptr("workervmConfiguration"),
	// 		Type: to.Ptr("Microsoft.Maintenance/configurationAssignments"),
	// 		ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.Maintenance/configurationAssignments/workervmConfiguration"),
	// 		Properties: &armmaintenance.ConfigurationAssignmentProperties{
	// 			Filter: &armmaintenance.ConfigurationAssignmentFilterProperties{
	// 				Locations: []*string{
	// 					to.Ptr("Japan East"),
	// 					to.Ptr("UK South"),
	// 				},
	// 				ResourceGroups: []*string{
	// 					to.Ptr("RG1"),
	// 					to.Ptr("RG2"),
	// 				},
	// 				ResourceTypes: []*string{
	// 					to.Ptr("Microsoft.HybridCompute/machines"),
	// 					to.Ptr("Microsoft.Compute/virtualMachines"),
	// 				},
	// 				TagSettings: &armmaintenance.TagSettingsProperties{
	// 					FilterOperator: to.Ptr(armmaintenance.TagOperatorsAny),
	// 					Tags: map[string][]*string{
	// 						"tag1": []*string{
	// 							to.Ptr("tag1Value1"),
	// 							to.Ptr("tag1Value2"),
	// 							to.Ptr("tag1Value3"),
	// 						},
	// 						"tag2": []*string{
	// 							to.Ptr("tag2Value1"),
	// 							to.Ptr("tag2Value2"),
	// 							to.Ptr("tag2Value3"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			MaintenanceConfigurationID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourcegroups/examplerg/providers/Microsoft.Maintenance/maintenanceConfigurations/configuration1"),
	// 			ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4"),
	// 		},
	// 	},
	// }
}
