forked from pulumi/pulumi-azure-native-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.go
411 lines (364 loc) · 17.4 KB
/
server.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dbforpostgresql
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure-native-sdk/v2/utilities"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Represents a server.
// Azure REST API version: 2022-12-01. Prior API version in Azure Native 1.x: 2017-12-01.
//
// Other available API versions: 2017-12-01, 2017-12-01-preview, 2020-02-14-preview, 2021-04-10-privatepreview, 2021-06-15-privatepreview, 2022-03-08-preview, 2023-03-01-preview, 2023-06-01-preview, 2023-12-01-preview.
type Server struct {
pulumi.CustomResourceState
// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
AdministratorLogin pulumi.StringPtrOutput `pulumi:"administratorLogin"`
// AuthConfig properties of a server.
AuthConfig AuthConfigResponsePtrOutput `pulumi:"authConfig"`
// availability zone information of the server.
AvailabilityZone pulumi.StringPtrOutput `pulumi:"availabilityZone"`
// Backup properties of a server.
Backup BackupResponsePtrOutput `pulumi:"backup"`
// Data encryption properties of a server.
DataEncryption DataEncryptionResponsePtrOutput `pulumi:"dataEncryption"`
// The fully qualified domain name of a server.
FullyQualifiedDomainName pulumi.StringOutput `pulumi:"fullyQualifiedDomainName"`
// High availability properties of a server.
HighAvailability HighAvailabilityResponsePtrOutput `pulumi:"highAvailability"`
// Describes the identity of the application.
Identity UserAssignedIdentityResponsePtrOutput `pulumi:"identity"`
// The geo-location where the resource lives
Location pulumi.StringOutput `pulumi:"location"`
// Maintenance window properties of a server.
MaintenanceWindow MaintenanceWindowResponsePtrOutput `pulumi:"maintenanceWindow"`
// The minor version of the server.
MinorVersion pulumi.StringOutput `pulumi:"minorVersion"`
// The name of the resource
Name pulumi.StringOutput `pulumi:"name"`
// Network properties of a server. This Network property is required to be passed only in case you want the server to be Private access server.
Network NetworkResponsePtrOutput `pulumi:"network"`
// Replicas allowed for a server.
ReplicaCapacity pulumi.IntOutput `pulumi:"replicaCapacity"`
// Replication role of the server
ReplicationRole pulumi.StringPtrOutput `pulumi:"replicationRole"`
// The SKU (pricing tier) of the server.
Sku SkuResponsePtrOutput `pulumi:"sku"`
// The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica server
SourceServerResourceId pulumi.StringPtrOutput `pulumi:"sourceServerResourceId"`
// A state of a server that is visible to user.
State pulumi.StringOutput `pulumi:"state"`
// Storage properties of a server.
Storage StorageResponsePtrOutput `pulumi:"storage"`
// Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData SystemDataResponseOutput `pulumi:"systemData"`
// Resource tags.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type pulumi.StringOutput `pulumi:"type"`
// PostgreSQL Server version.
Version pulumi.StringPtrOutput `pulumi:"version"`
}
// NewServer registers a new resource with the given unique name, arguments, and options.
func NewServer(ctx *pulumi.Context,
name string, args *ServerArgs, opts ...pulumi.ResourceOption) (*Server, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.AuthConfig != nil {
args.AuthConfig = args.AuthConfig.ToAuthConfigPtrOutput().ApplyT(func(v *AuthConfig) *AuthConfig { return v.Defaults() }).(AuthConfigPtrOutput)
}
if args.AvailabilityZone == nil {
args.AvailabilityZone = pulumi.StringPtr("")
}
if args.Backup != nil {
args.Backup = args.Backup.ToBackupPtrOutput().ApplyT(func(v *Backup) *Backup { return v.Defaults() }).(BackupPtrOutput)
}
if args.HighAvailability != nil {
args.HighAvailability = args.HighAvailability.ToHighAvailabilityPtrOutput().ApplyT(func(v *HighAvailability) *HighAvailability { return v.Defaults() }).(HighAvailabilityPtrOutput)
}
if args.MaintenanceWindow != nil {
args.MaintenanceWindow = args.MaintenanceWindow.ToMaintenanceWindowPtrOutput().ApplyT(func(v *MaintenanceWindow) *MaintenanceWindow { return v.Defaults() }).(MaintenanceWindowPtrOutput)
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("azure-native:dbforpostgresql/v20200214preview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20200214privatepreview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20210410privatepreview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20210601:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20210601preview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20210615privatepreview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20220120preview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20220308preview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20221201:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20230301preview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20230601preview:Server"),
},
{
Type: pulumi.String("azure-native:dbforpostgresql/v20231201preview:Server"),
},
})
opts = append(opts, aliases)
opts = utilities.PkgResourceDefaultOpts(opts)
var resource Server
err := ctx.RegisterResource("azure-native:dbforpostgresql:Server", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetServer gets an existing Server resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetServer(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ServerState, opts ...pulumi.ResourceOption) (*Server, error) {
var resource Server
err := ctx.ReadResource("azure-native:dbforpostgresql:Server", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Server resources.
type serverState struct {
}
type ServerState struct {
}
func (ServerState) ElementType() reflect.Type {
return reflect.TypeOf((*serverState)(nil)).Elem()
}
type serverArgs struct {
// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
AdministratorLogin *string `pulumi:"administratorLogin"`
// The administrator login password (required for server creation).
AdministratorLoginPassword *string `pulumi:"administratorLoginPassword"`
// AuthConfig properties of a server.
AuthConfig *AuthConfig `pulumi:"authConfig"`
// availability zone information of the server.
AvailabilityZone *string `pulumi:"availabilityZone"`
// Backup properties of a server.
Backup *Backup `pulumi:"backup"`
// The mode to create a new PostgreSQL server.
CreateMode *string `pulumi:"createMode"`
// Data encryption properties of a server.
DataEncryption *DataEncryption `pulumi:"dataEncryption"`
// High availability properties of a server.
HighAvailability *HighAvailability `pulumi:"highAvailability"`
// Describes the identity of the application.
Identity *UserAssignedIdentity `pulumi:"identity"`
// The geo-location where the resource lives
Location *string `pulumi:"location"`
// Maintenance window properties of a server.
MaintenanceWindow *MaintenanceWindow `pulumi:"maintenanceWindow"`
// Network properties of a server. This Network property is required to be passed only in case you want the server to be Private access server.
Network *Network `pulumi:"network"`
// Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'.
PointInTimeUTC *string `pulumi:"pointInTimeUTC"`
// Replication role of the server
ReplicationRole *string `pulumi:"replicationRole"`
// The name of the resource group. The name is case insensitive.
ResourceGroupName string `pulumi:"resourceGroupName"`
// The name of the server.
ServerName *string `pulumi:"serverName"`
// The SKU (pricing tier) of the server.
Sku *Sku `pulumi:"sku"`
// The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica server
SourceServerResourceId *string `pulumi:"sourceServerResourceId"`
// Storage properties of a server.
Storage *Storage `pulumi:"storage"`
// Resource tags.
Tags map[string]string `pulumi:"tags"`
// PostgreSQL Server version.
Version *string `pulumi:"version"`
}
// The set of arguments for constructing a Server resource.
type ServerArgs struct {
// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
AdministratorLogin pulumi.StringPtrInput
// The administrator login password (required for server creation).
AdministratorLoginPassword pulumi.StringPtrInput
// AuthConfig properties of a server.
AuthConfig AuthConfigPtrInput
// availability zone information of the server.
AvailabilityZone pulumi.StringPtrInput
// Backup properties of a server.
Backup BackupPtrInput
// The mode to create a new PostgreSQL server.
CreateMode pulumi.StringPtrInput
// Data encryption properties of a server.
DataEncryption DataEncryptionPtrInput
// High availability properties of a server.
HighAvailability HighAvailabilityPtrInput
// Describes the identity of the application.
Identity UserAssignedIdentityPtrInput
// The geo-location where the resource lives
Location pulumi.StringPtrInput
// Maintenance window properties of a server.
MaintenanceWindow MaintenanceWindowPtrInput
// Network properties of a server. This Network property is required to be passed only in case you want the server to be Private access server.
Network NetworkPtrInput
// Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'.
PointInTimeUTC pulumi.StringPtrInput
// Replication role of the server
ReplicationRole pulumi.StringPtrInput
// The name of the resource group. The name is case insensitive.
ResourceGroupName pulumi.StringInput
// The name of the server.
ServerName pulumi.StringPtrInput
// The SKU (pricing tier) of the server.
Sku SkuPtrInput
// The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica server
SourceServerResourceId pulumi.StringPtrInput
// Storage properties of a server.
Storage StoragePtrInput
// Resource tags.
Tags pulumi.StringMapInput
// PostgreSQL Server version.
Version pulumi.StringPtrInput
}
func (ServerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*serverArgs)(nil)).Elem()
}
type ServerInput interface {
pulumi.Input
ToServerOutput() ServerOutput
ToServerOutputWithContext(ctx context.Context) ServerOutput
}
func (*Server) ElementType() reflect.Type {
return reflect.TypeOf((**Server)(nil)).Elem()
}
func (i *Server) ToServerOutput() ServerOutput {
return i.ToServerOutputWithContext(context.Background())
}
func (i *Server) ToServerOutputWithContext(ctx context.Context) ServerOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServerOutput)
}
type ServerOutput struct{ *pulumi.OutputState }
func (ServerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Server)(nil)).Elem()
}
func (o ServerOutput) ToServerOutput() ServerOutput {
return o
}
func (o ServerOutput) ToServerOutputWithContext(ctx context.Context) ServerOutput {
return o
}
// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
func (o ServerOutput) AdministratorLogin() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Server) pulumi.StringPtrOutput { return v.AdministratorLogin }).(pulumi.StringPtrOutput)
}
// AuthConfig properties of a server.
func (o ServerOutput) AuthConfig() AuthConfigResponsePtrOutput {
return o.ApplyT(func(v *Server) AuthConfigResponsePtrOutput { return v.AuthConfig }).(AuthConfigResponsePtrOutput)
}
// availability zone information of the server.
func (o ServerOutput) AvailabilityZone() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Server) pulumi.StringPtrOutput { return v.AvailabilityZone }).(pulumi.StringPtrOutput)
}
// Backup properties of a server.
func (o ServerOutput) Backup() BackupResponsePtrOutput {
return o.ApplyT(func(v *Server) BackupResponsePtrOutput { return v.Backup }).(BackupResponsePtrOutput)
}
// Data encryption properties of a server.
func (o ServerOutput) DataEncryption() DataEncryptionResponsePtrOutput {
return o.ApplyT(func(v *Server) DataEncryptionResponsePtrOutput { return v.DataEncryption }).(DataEncryptionResponsePtrOutput)
}
// The fully qualified domain name of a server.
func (o ServerOutput) FullyQualifiedDomainName() pulumi.StringOutput {
return o.ApplyT(func(v *Server) pulumi.StringOutput { return v.FullyQualifiedDomainName }).(pulumi.StringOutput)
}
// High availability properties of a server.
func (o ServerOutput) HighAvailability() HighAvailabilityResponsePtrOutput {
return o.ApplyT(func(v *Server) HighAvailabilityResponsePtrOutput { return v.HighAvailability }).(HighAvailabilityResponsePtrOutput)
}
// Describes the identity of the application.
func (o ServerOutput) Identity() UserAssignedIdentityResponsePtrOutput {
return o.ApplyT(func(v *Server) UserAssignedIdentityResponsePtrOutput { return v.Identity }).(UserAssignedIdentityResponsePtrOutput)
}
// The geo-location where the resource lives
func (o ServerOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Server) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// Maintenance window properties of a server.
func (o ServerOutput) MaintenanceWindow() MaintenanceWindowResponsePtrOutput {
return o.ApplyT(func(v *Server) MaintenanceWindowResponsePtrOutput { return v.MaintenanceWindow }).(MaintenanceWindowResponsePtrOutput)
}
// The minor version of the server.
func (o ServerOutput) MinorVersion() pulumi.StringOutput {
return o.ApplyT(func(v *Server) pulumi.StringOutput { return v.MinorVersion }).(pulumi.StringOutput)
}
// The name of the resource
func (o ServerOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Server) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Network properties of a server. This Network property is required to be passed only in case you want the server to be Private access server.
func (o ServerOutput) Network() NetworkResponsePtrOutput {
return o.ApplyT(func(v *Server) NetworkResponsePtrOutput { return v.Network }).(NetworkResponsePtrOutput)
}
// Replicas allowed for a server.
func (o ServerOutput) ReplicaCapacity() pulumi.IntOutput {
return o.ApplyT(func(v *Server) pulumi.IntOutput { return v.ReplicaCapacity }).(pulumi.IntOutput)
}
// Replication role of the server
func (o ServerOutput) ReplicationRole() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Server) pulumi.StringPtrOutput { return v.ReplicationRole }).(pulumi.StringPtrOutput)
}
// The SKU (pricing tier) of the server.
func (o ServerOutput) Sku() SkuResponsePtrOutput {
return o.ApplyT(func(v *Server) SkuResponsePtrOutput { return v.Sku }).(SkuResponsePtrOutput)
}
// The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica server
func (o ServerOutput) SourceServerResourceId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Server) pulumi.StringPtrOutput { return v.SourceServerResourceId }).(pulumi.StringPtrOutput)
}
// A state of a server that is visible to user.
func (o ServerOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v *Server) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
}
// Storage properties of a server.
func (o ServerOutput) Storage() StorageResponsePtrOutput {
return o.ApplyT(func(v *Server) StorageResponsePtrOutput { return v.Storage }).(StorageResponsePtrOutput)
}
// Azure Resource Manager metadata containing createdBy and modifiedBy information.
func (o ServerOutput) SystemData() SystemDataResponseOutput {
return o.ApplyT(func(v *Server) SystemDataResponseOutput { return v.SystemData }).(SystemDataResponseOutput)
}
// Resource tags.
func (o ServerOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *Server) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
func (o ServerOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *Server) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
// PostgreSQL Server version.
func (o ServerOutput) Version() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Server) pulumi.StringPtrOutput { return v.Version }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterOutputType(ServerOutput{})
}