// 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 armpostgresqlflexibleservers_test

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v6"
	"log"
)

// Generated from example definition: 2026-04-01-preview/ReplicasListByServer.json
func ExampleReplicasClient_NewListByServerPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewReplicasClient().NewListByServerPager("exampleresourcegroup", "exampleserver", 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 = armpostgresqlflexibleservers.ReplicasClientListByServerResponse{
		// 	ServerList: armpostgresqlflexibleservers.ServerList{
		// 		Value: []*armpostgresqlflexibleservers.Server{
		// 			{
		// 				Name: to.Ptr("exampleserver"),
		// 				Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"),
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver"),
		// 				Location: to.Ptr("eastus"),
		// 				Properties: &armpostgresqlflexibleservers.ServerProperties{
		// 					AdministratorLogin: to.Ptr("exampleadministratorlogin"),
		// 					AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
		// 						ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.MicrosoftEntraAuthDisabled),
		// 						PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordBasedAuthEnabled),
		// 					},
		// 					AvailabilityZone: to.Ptr("2"),
		// 					Backup: &armpostgresqlflexibleservers.Backup{
		// 						BackupRetentionDays: to.Ptr[int32](7),
		// 						EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T18:35:22.123456Z"); return t}()),
		// 						GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeographicallyRedundantBackupDisabled),
		// 					},
		// 					DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
		// 						Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeSystemManaged),
		// 					},
		// 					FullyQualifiedDomainName: to.Ptr("exampleserver.postgres.database.azure.com"),
		// 					HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
		// 						Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeDisabled),
		// 						State: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityStateNotEnabled),
		// 					},
		// 					MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindow{
		// 						CustomWindow: to.Ptr("Disabled"),
		// 						DayOfWeek: to.Ptr[int32](0),
		// 						StartHour: to.Ptr[int32](0),
		// 						StartMinute: to.Ptr[int32](0),
		// 					},
		// 					MinorVersion: to.Ptr("5"),
		// 					Network: &armpostgresqlflexibleservers.Network{
		// 						PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled),
		// 					},
		// 					Replica: &armpostgresqlflexibleservers.Replica{
		// 						Capacity: to.Ptr[int32](0),
		// 						ReplicationState: to.Ptr(armpostgresqlflexibleservers.ReplicationStateActive),
		// 						Role: to.Ptr(armpostgresqlflexibleservers.ReplicationRoleAsyncReplica),
		// 					},
		// 					ReplicaCapacity: to.Ptr[int32](0),
		// 					ReplicationRole: to.Ptr(armpostgresqlflexibleservers.ReplicationRoleAsyncReplica),
		// 					State: to.Ptr(armpostgresqlflexibleservers.ServerStateReady),
		// 					Storage: &armpostgresqlflexibleservers.Storage{
		// 						AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
		// 						Iops: to.Ptr[int32](2300),
		// 						StorageSizeGB: to.Ptr[int32](512),
		// 						Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP20),
		// 					},
		// 					Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSeventeen),
		// 				},
		// 				SKU: &armpostgresqlflexibleservers.SKU{
		// 					Name: to.Ptr("Standard_D4ds_v5"),
		// 					Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
