-
Notifications
You must be signed in to change notification settings - Fork 51
/
server.go
213 lines (193 loc) · 8.87 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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package postgresql
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manage a PostgreSQL Server.
type Server struct {
s *pulumi.ResourceState
}
// NewServer registers a new resource with the given unique name, arguments, and options.
func NewServer(ctx *pulumi.Context,
name string, args *ServerArgs, opts ...pulumi.ResourceOpt) (*Server, error) {
if args == nil || args.AdministratorLogin == nil {
return nil, errors.New("missing required argument 'AdministratorLogin'")
}
if args == nil || args.AdministratorLoginPassword == nil {
return nil, errors.New("missing required argument 'AdministratorLoginPassword'")
}
if args == nil || args.Location == nil {
return nil, errors.New("missing required argument 'Location'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil || args.Sku == nil {
return nil, errors.New("missing required argument 'Sku'")
}
if args == nil || args.SslEnforcement == nil {
return nil, errors.New("missing required argument 'SslEnforcement'")
}
if args == nil || args.StorageProfile == nil {
return nil, errors.New("missing required argument 'StorageProfile'")
}
if args == nil || args.Version == nil {
return nil, errors.New("missing required argument 'Version'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["administratorLogin"] = nil
inputs["administratorLoginPassword"] = nil
inputs["location"] = nil
inputs["name"] = nil
inputs["resourceGroupName"] = nil
inputs["sku"] = nil
inputs["sslEnforcement"] = nil
inputs["storageProfile"] = nil
inputs["tags"] = nil
inputs["version"] = nil
} else {
inputs["administratorLogin"] = args.AdministratorLogin
inputs["administratorLoginPassword"] = args.AdministratorLoginPassword
inputs["location"] = args.Location
inputs["name"] = args.Name
inputs["resourceGroupName"] = args.ResourceGroupName
inputs["sku"] = args.Sku
inputs["sslEnforcement"] = args.SslEnforcement
inputs["storageProfile"] = args.StorageProfile
inputs["tags"] = args.Tags
inputs["version"] = args.Version
}
inputs["fqdn"] = nil
s, err := ctx.RegisterResource("azure:postgresql/server:Server", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &Server{s: s}, 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.ID, state *ServerState, opts ...pulumi.ResourceOpt) (*Server, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["administratorLogin"] = state.AdministratorLogin
inputs["administratorLoginPassword"] = state.AdministratorLoginPassword
inputs["fqdn"] = state.Fqdn
inputs["location"] = state.Location
inputs["name"] = state.Name
inputs["resourceGroupName"] = state.ResourceGroupName
inputs["sku"] = state.Sku
inputs["sslEnforcement"] = state.SslEnforcement
inputs["storageProfile"] = state.StorageProfile
inputs["tags"] = state.Tags
inputs["version"] = state.Version
}
s, err := ctx.ReadResource("azure:postgresql/server:Server", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &Server{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *Server) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *Server) ID() *pulumi.IDOutput {
return r.s.ID()
}
// The Administrator Login for the PostgreSQL Server. Changing this forces a new resource to be created.
func (r *Server) AdministratorLogin() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["administratorLogin"])
}
// The Password associated with the `administrator_login` for the PostgreSQL Server.
func (r *Server) AdministratorLoginPassword() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["administratorLoginPassword"])
}
// The FQDN of the PostgreSQL Server.
func (r *Server) Fqdn() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["fqdn"])
}
// Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
func (r *Server) Location() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["location"])
}
// Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. B_Gen4_1, GP_Gen5_8). For more information see the [product documentation](https://docs.microsoft.com/en-us/rest/api/postgresql/servers/create#sku).
func (r *Server) Name() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["name"])
}
// The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created.
func (r *Server) ResourceGroupName() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["resourceGroupName"])
}
// A `sku` block as defined below.
func (r *Server) Sku() *pulumi.Output {
return r.s.State["sku"]
}
// Specifies if SSL should be enforced on connections. Possible values are `Enabled` and `Disabled`.
func (r *Server) SslEnforcement() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["sslEnforcement"])
}
// A `storage_profile` block as defined below.
func (r *Server) StorageProfile() *pulumi.Output {
return r.s.State["storageProfile"]
}
// A mapping of tags to assign to the resource.
func (r *Server) Tags() *pulumi.MapOutput {
return (*pulumi.MapOutput)(r.s.State["tags"])
}
// Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, `10`, `10.0`, and `10.2`. Changing this forces a new resource to be created.
func (r *Server) Version() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["version"])
}
// Input properties used for looking up and filtering Server resources.
type ServerState struct {
// The Administrator Login for the PostgreSQL Server. Changing this forces a new resource to be created.
AdministratorLogin interface{}
// The Password associated with the `administrator_login` for the PostgreSQL Server.
AdministratorLoginPassword interface{}
// The FQDN of the PostgreSQL Server.
Fqdn interface{}
// Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location interface{}
// Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. B_Gen4_1, GP_Gen5_8). For more information see the [product documentation](https://docs.microsoft.com/en-us/rest/api/postgresql/servers/create#sku).
Name interface{}
// The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created.
ResourceGroupName interface{}
// A `sku` block as defined below.
Sku interface{}
// Specifies if SSL should be enforced on connections. Possible values are `Enabled` and `Disabled`.
SslEnforcement interface{}
// A `storage_profile` block as defined below.
StorageProfile interface{}
// A mapping of tags to assign to the resource.
Tags interface{}
// Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, `10`, `10.0`, and `10.2`. Changing this forces a new resource to be created.
Version interface{}
}
// The set of arguments for constructing a Server resource.
type ServerArgs struct {
// The Administrator Login for the PostgreSQL Server. Changing this forces a new resource to be created.
AdministratorLogin interface{}
// The Password associated with the `administrator_login` for the PostgreSQL Server.
AdministratorLoginPassword interface{}
// Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location interface{}
// Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. B_Gen4_1, GP_Gen5_8). For more information see the [product documentation](https://docs.microsoft.com/en-us/rest/api/postgresql/servers/create#sku).
Name interface{}
// The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created.
ResourceGroupName interface{}
// A `sku` block as defined below.
Sku interface{}
// Specifies if SSL should be enforced on connections. Possible values are `Enabled` and `Disabled`.
SslEnforcement interface{}
// A `storage_profile` block as defined below.
StorageProfile interface{}
// A mapping of tags to assign to the resource.
Tags interface{}
// Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, `10`, `10.0`, and `10.2`. Changing this forces a new resource to be created.
Version interface{}
}