// 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 armrecoveryservicesbackup_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/recoveryservices/armrecoveryservicesbackup/v5"
	"log"
)

// Generated from example definition: 2026-01-31-preview/AzureIaasVm/BackupPolicies_List.json
func ExampleBackupPoliciesClient_NewListPager_listProtectionPoliciesWithBackupManagementTypeFilterAsAzureIaasVM() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armrecoveryservicesbackup.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewBackupPoliciesClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupPoliciesClientListOptions{
		Filter: to.Ptr("backupManagementType eq 'AzureIaasVM'")})
	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 = armrecoveryservicesbackup.BackupPoliciesClientListResponse{
		// 	ProtectionPolicyResourceList: armrecoveryservicesbackup.ProtectionPolicyResourceList{
		// 		Value: []*armrecoveryservicesbackup.ProtectionPolicyResource{
		// 			{
		// 				Name: to.Ptr("DefaultPolicy"),
		// 				Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"),
		// 				ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/DefaultPolicy"),
		// 				Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{
		// 					BackupManagementType: to.Ptr("AzureIaasVM"),
		// 					ProtectedItemsCount: to.Ptr[int32](0),
		// 					RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{
		// 						DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{
		// 							RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{
		// 								Count: to.Ptr[int32](30),
		// 								DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays),
		// 							},
		// 							RetentionTimes: []*time.Time{
		// 								to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00Z"); return t}()),
		// 							},
		// 						},
		// 						RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"),
		// 					},
		// 					SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{
		// 						SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"),
		// 						ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily),
		// 						ScheduleRunTimes: []*time.Time{
		// 							to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00Z"); return t}()),
		// 						},
		// 						ScheduleWeeklyFrequency: to.Ptr[int32](0),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("testPolicy1"),
		// 				Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"),
		// 				ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"),
		// 				Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{
		// 					BackupManagementType: to.Ptr("AzureIaasVM"),
		// 					ProtectedItemsCount: to.Ptr[int32](0),
		// 					RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{
		// 						DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{
		// 							RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{
		// 								Count: to.Ptr[int32](1),
		// 								DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays),
		// 							},
		// 							RetentionTimes: []*time.Time{
		// 								to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00Z"); return t}()),
		// 							},
		// 						},
		// 						RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"),
		// 					},
		// 					SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{
		// 						SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"),
		// 						ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily),
		// 						ScheduleRunTimes: []*time.Time{
		// 							to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00Z"); return t}()),
		// 						},
		// 						ScheduleWeeklyFrequency: to.Ptr[int32](0),
		// 					},
		// 					TimeZone: to.Ptr("Pacific Standard Time"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-31-preview/AzureIaasVm/V2Policy/v2-List-Policies.json
func ExampleBackupPoliciesClient_NewListPager_listProtectionPoliciesWithBackupManagementTypeFilterAsAzureIaasVMWithBothV1AndV2Policies() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armrecoveryservicesbackup.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewBackupPoliciesClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupPoliciesClientListOptions{
		Filter: to.Ptr("backupManagementType eq 'AzureIaasVM'")})
	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 = armrecoveryservicesbackup.BackupPoliciesClientListResponse{
		// 	ProtectionPolicyResourceList: armrecoveryservicesbackup.ProtectionPolicyResourceList{
		// 		Value: []*armrecoveryservicesbackup.ProtectionPolicyResource{
		// 			{
		// 				Name: to.Ptr("DefaultPolicy"),
		// 				Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"),
		// 				ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/DefaultPolicy"),
		// 				Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{
		// 					BackupManagementType: to.Ptr("AzureIaasVM"),
		// 					ProtectedItemsCount: to.Ptr[int32](0),
		// 					RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{
		// 						DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{
		// 							RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{
		// 								Count: to.Ptr[int32](30),
		// 								DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays),
		// 							},
		// 							RetentionTimes: []*time.Time{
		// 								to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00Z"); return t}()),
		// 							},
		// 						},
		// 						RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"),
		// 					},
		// 					SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{
		// 						SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"),
		// 						ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily),
		// 						ScheduleRunTimes: []*time.Time{
		// 							to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00Z"); return t}()),
		// 						},
		// 						ScheduleWeeklyFrequency: to.Ptr[int32](0),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("testPolicy1"),
		// 				Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"),
		// 				ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1"),
		// 				Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{
		// 					BackupManagementType: to.Ptr("AzureIaasVM"),
		// 					ProtectedItemsCount: to.Ptr[int32](0),
		// 					RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{
		// 						DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{
		// 							RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{
		// 								Count: to.Ptr[int32](1),
		// 								DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays),
		// 							},
		// 							RetentionTimes: []*time.Time{
		// 								to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00Z"); return t}()),
		// 							},
		// 						},
		// 						RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"),
		// 					},
		// 					SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{
		// 						SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"),
		// 						ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily),
		// 						ScheduleRunTimes: []*time.Time{
		// 							to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00Z"); return t}()),
		// 						},
		// 						ScheduleWeeklyFrequency: to.Ptr[int32](0),
		// 					},
		// 					TimeZone: to.Ptr("Pacific Standard Time"),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("v2-daily-policy"),
		// 				Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"),
		// 				ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/v2-daily-policy"),
		// 				Properties: &armrecoveryservicesbackup.AzureIaaSVMProtectionPolicy{
		// 					BackupManagementType: to.Ptr("AzureIaasVM"),
		// 					ProtectedItemsCount: to.Ptr[int32](0),
		// 					RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{
		// 						DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{
		// 							RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{
		// 								Count: to.Ptr[int32](1),
		// 								DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays),
		// 							},
		// 							RetentionTimes: []*time.Time{
		// 								to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T02:00:00Z"); return t}()),
		// 							},
		// 						},
		// 						RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"),
		// 					},
		// 					SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicyV2{
		// 						DailySchedule: &armrecoveryservicesbackup.DailySchedule{
		// 							ScheduleRunTimes: []*time.Time{
		// 								to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-24T10:00:00Z"); return t}()),
		// 							},
		// 						},
		// 						SchedulePolicyType: to.Ptr("SimpleSchedulePolicyV2"),
		// 						ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily),
		// 					},
		// 					TimeZone: to.Ptr("Pacific Standard Time"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-31-preview/AzureWorkload/BackupPolicies_List.json
func ExampleBackupPoliciesClient_NewListPager_listProtectionPoliciesWithBackupManagementTypeFilterAsAzureWorkload() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armrecoveryservicesbackup.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewBackupPoliciesClient().NewListPager("NetSDKTestRsVault", "SwaggerTestRg", &armrecoveryservicesbackup.BackupPoliciesClientListOptions{
		Filter: to.Ptr("backupManagementType eq 'AzureWorkload'")})
	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 = armrecoveryservicesbackup.BackupPoliciesClientListResponse{
		// 	ProtectionPolicyResourceList: armrecoveryservicesbackup.ProtectionPolicyResourceList{
		// 		Value: []*armrecoveryservicesbackup.ProtectionPolicyResource{
		// 			{
		// 				Name: to.Ptr("HourlyLogBackup"),
		// 				Type: to.Ptr("Microsoft.RecoveryServices/vaults/backupPolicies"),
		// 				ID: to.Ptr("/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/HourlyLogBackup"),
		// 				Properties: &armrecoveryservicesbackup.AzureVMWorkloadProtectionPolicy{
		// 					BackupManagementType: to.Ptr("AzureWorkload"),
		// 					ProtectedItemsCount: to.Ptr[int32](0),
		// 					Settings: &armrecoveryservicesbackup.Settings{
		// 						Issqlcompression: to.Ptr(false),
		// 						TimeZone: to.Ptr("UTC"),
		// 					},
		// 					SubProtectionPolicy: []*armrecoveryservicesbackup.SubProtectionPolicy{
		// 						{
		// 							PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeFull),
		// 							RetentionPolicy: &armrecoveryservicesbackup.LongTermRetentionPolicy{
		// 								DailySchedule: &armrecoveryservicesbackup.DailyRetentionSchedule{
		// 									RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{
		// 										Count: to.Ptr[int32](30),
		// 										DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays),
		// 									},
		// 									RetentionTimes: []*time.Time{
		// 										to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00Z"); return t}()),
		// 									},
		// 								},
		// 								RetentionPolicyType: to.Ptr("LongTermRetentionPolicy"),
		// 							},
		// 							SchedulePolicy: &armrecoveryservicesbackup.SimpleSchedulePolicy{
		// 								SchedulePolicyType: to.Ptr("SimpleSchedulePolicy"),
		// 								ScheduleRunFrequency: to.Ptr(armrecoveryservicesbackup.ScheduleRunTypeDaily),
		// 								ScheduleRunTimes: []*time.Time{
		// 									to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-05T19:00:00Z"); return t}()),
		// 								},
		// 								ScheduleWeeklyFrequency: to.Ptr[int32](0),
		// 							},
		// 						},
		// 						{
		// 							PolicyType: to.Ptr(armrecoveryservicesbackup.PolicyTypeLog),
		// 							RetentionPolicy: &armrecoveryservicesbackup.SimpleRetentionPolicy{
		// 								RetentionDuration: &armrecoveryservicesbackup.RetentionDuration{
		// 									Count: to.Ptr[int32](30),
		// 									DurationType: to.Ptr(armrecoveryservicesbackup.RetentionDurationTypeDays),
		// 								},
		// 								RetentionPolicyType: to.Ptr("SimpleRetentionPolicy"),
		// 							},
		// 							SchedulePolicy: &armrecoveryservicesbackup.LogSchedulePolicy{
		// 								ScheduleFrequencyInMins: to.Ptr[int32](60),
		// 								SchedulePolicyType: to.Ptr("LogSchedulePolicy"),
		// 							},
		// 						},
		// 					},
		// 					WorkLoadType: to.Ptr(armrecoveryservicesbackup.WorkloadTypeSQLDataBase),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
