-
Notifications
You must be signed in to change notification settings - Fork 13
/
CosmosDBDatabaseAccountList.go
157 lines (154 loc) · 7.52 KB
/
CosmosDBDatabaseAccountList.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package armcosmos_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-01-preview/examples/CosmosDBDatabaseAccountList.json
func ExampleDatabaseAccountsClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcosmos.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewDatabaseAccountsClient().NewListPager(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.DatabaseAccountsListResult = armcosmos.DatabaseAccountsListResult{
// Value: []*armcosmos.DatabaseAccountGetResults{
// {
// Name: to.Ptr("ddb1"),
// Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"),
// Identity: &armcosmos.ManagedServiceIdentity{
// Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned),
// PrincipalID: to.Ptr("52f4fef3-3c3f-4ff3-b52e-b5c9eeb68656"),
// TenantID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"),
// UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{
// "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{
// ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"),
// PrincipalID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"),
// },
// },
// },
// Location: to.Ptr("West US"),
// Tags: map[string]*string{
// },
// Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB),
// Properties: &armcosmos.DatabaseAccountGetProperties{
// AnalyticalStorageConfiguration: &armcosmos.AnalyticalStorageConfiguration{
// SchemaType: to.Ptr(armcosmos.AnalyticalStorageSchemaTypeWellDefined),
// },
// APIProperties: &armcosmos.APIProperties{
// },
// BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{
// Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic),
// PeriodicModeProperties: &armcosmos.PeriodicModeProperties{
// BackupIntervalInMinutes: to.Ptr[int32](240),
// BackupRetentionIntervalInHours: to.Ptr[int32](720),
// BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyGeo),
// },
// },
// ConsistencyPolicy: &armcosmos.ConsistencyPolicy{
// DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelSession),
// MaxIntervalInSeconds: to.Ptr[int32](5),
// MaxStalenessPrefix: to.Ptr[int64](100),
// },
// Cors: []*armcosmos.CorsPolicy{
// },
// CreateMode: to.Ptr(armcosmos.CreateModeDefault),
// DatabaseAccountOfferType: to.Ptr("Standard"),
// DefaultIdentity: to.Ptr("FirstPartyIdentity"),
// DisableKeyBasedMetadataWriteAccess: to.Ptr(false),
// DocumentEndpoint: to.Ptr("https://ddb1.documents.azure.com:443/"),
// EnableAnalyticalStorage: to.Ptr(true),
// EnableBurstCapacity: to.Ptr(true),
// EnableFreeTier: to.Ptr(false),
// EnableMaterializedViews: to.Ptr(false),
// EnablePartitionMerge: to.Ptr(true),
// FailoverPolicies: []*armcosmos.FailoverPolicy{
// {
// FailoverPriority: to.Ptr[int32](0),
// ID: to.Ptr("ddb1-eastus"),
// LocationName: to.Ptr("East US"),
// }},
// InstanceID: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"),
// IPRules: []*armcosmos.IPAddressOrRange{
// },
// KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{
// PrimaryMasterKey: &armcosmos.AccountKeyMetadata{
// GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()),
// },
// PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{
// GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()),
// },
// SecondaryMasterKey: &armcosmos.AccountKeyMetadata{
// GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()),
// },
// SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{
// GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()),
// },
// },
// Locations: []*armcosmos.Location{
// {
// DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"),
// FailoverPriority: to.Ptr[int32](0),
// ID: to.Ptr("ddb1-eastus"),
// LocationName: to.Ptr("East US"),
// ProvisioningState: to.Ptr("Succeeded"),
// }},
// MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS),
// NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassNone),
// NetworkACLBypassResourceIDs: []*string{
// },
// PrivateEndpointConnections: []*armcosmos.PrivateEndpointConnection{
// {
// ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.DocumentDB/databaseAccounts/account1/privateEndpointConnections/pe1"),
// Properties: &armcosmos.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armcosmos.PrivateEndpointProperty{
// ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/privateEndpoints/pe1"),
// },
// PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{
// ActionsRequired: to.Ptr("None"),
// Status: to.Ptr("Approved"),
// },
// },
// }},
// ProvisioningState: to.Ptr("Succeeded"),
// ReadLocations: []*armcosmos.Location{
// {
// DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"),
// FailoverPriority: to.Ptr[int32](0),
// ID: to.Ptr("ddb1-eastus"),
// LocationName: to.Ptr("East US"),
// ProvisioningState: to.Ptr("Succeeded"),
// }},
// WriteLocations: []*armcosmos.Location{
// {
// DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"),
// FailoverPriority: to.Ptr[int32](0),
// ID: to.Ptr("ddb1-eastus"),
// LocationName: to.Ptr("East US"),
// ProvisioningState: to.Ptr("Succeeded"),
// }},
// },
// SystemData: &armcosmos.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09Z"); return t}()),
// },
// }},
// }
}
}