/
sqlDedicatedGateway.go
318 lines (269 loc) · 13 KB
/
sqlDedicatedGateway.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package cosmosdb
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a SQL Dedicated Gateway within a Cosmos DB Account.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/cosmosdb"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("example-resource-group"),
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleAccount, err := cosmosdb.NewAccount(ctx, "example", &cosmosdb.AccountArgs{
// Name: pulumi.String("example-ca"),
// Location: example.Location,
// ResourceGroupName: example.Name,
// OfferType: pulumi.String("Standard"),
// Kind: pulumi.String("GlobalDocumentDB"),
// ConsistencyPolicy: &cosmosdb.AccountConsistencyPolicyArgs{
// ConsistencyLevel: pulumi.String("BoundedStaleness"),
// },
// GeoLocations: cosmosdb.AccountGeoLocationArray{
// &cosmosdb.AccountGeoLocationArgs{
// Location: example.Location,
// FailoverPriority: pulumi.Int(0),
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = cosmosdb.NewSqlDedicatedGateway(ctx, "example", &cosmosdb.SqlDedicatedGatewayArgs{
// CosmosdbAccountId: exampleAccount.ID(),
// InstanceCount: pulumi.Int(1),
// InstanceSize: pulumi.String("Cosmos.D4s"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// CosmosDB SQL Dedicated Gateways can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:cosmosdb/sqlDedicatedGateway:SqlDedicatedGateway example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.DocumentDB/databaseAccounts/account1/services/SqlDedicatedGateway
// ```
type SqlDedicatedGateway struct {
pulumi.CustomResourceState
// The resource ID of the CosmosDB Account. Changing this forces a new resource to be created.
CosmosdbAccountId pulumi.StringOutput `pulumi:"cosmosdbAccountId"`
// The instance count for the CosmosDB SQL Dedicated Gateway. Possible value is between `1` and `5`.
InstanceCount pulumi.IntOutput `pulumi:"instanceCount"`
// The instance size for the CosmosDB SQL Dedicated Gateway. Changing this forces a new resource to be created. Possible values are `Cosmos.D4s`, `Cosmos.D8s` and `Cosmos.D16s`.
InstanceSize pulumi.StringOutput `pulumi:"instanceSize"`
}
// NewSqlDedicatedGateway registers a new resource with the given unique name, arguments, and options.
func NewSqlDedicatedGateway(ctx *pulumi.Context,
name string, args *SqlDedicatedGatewayArgs, opts ...pulumi.ResourceOption) (*SqlDedicatedGateway, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CosmosdbAccountId == nil {
return nil, errors.New("invalid value for required argument 'CosmosdbAccountId'")
}
if args.InstanceCount == nil {
return nil, errors.New("invalid value for required argument 'InstanceCount'")
}
if args.InstanceSize == nil {
return nil, errors.New("invalid value for required argument 'InstanceSize'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource SqlDedicatedGateway
err := ctx.RegisterResource("azure:cosmosdb/sqlDedicatedGateway:SqlDedicatedGateway", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSqlDedicatedGateway gets an existing SqlDedicatedGateway 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 GetSqlDedicatedGateway(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SqlDedicatedGatewayState, opts ...pulumi.ResourceOption) (*SqlDedicatedGateway, error) {
var resource SqlDedicatedGateway
err := ctx.ReadResource("azure:cosmosdb/sqlDedicatedGateway:SqlDedicatedGateway", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SqlDedicatedGateway resources.
type sqlDedicatedGatewayState struct {
// The resource ID of the CosmosDB Account. Changing this forces a new resource to be created.
CosmosdbAccountId *string `pulumi:"cosmosdbAccountId"`
// The instance count for the CosmosDB SQL Dedicated Gateway. Possible value is between `1` and `5`.
InstanceCount *int `pulumi:"instanceCount"`
// The instance size for the CosmosDB SQL Dedicated Gateway. Changing this forces a new resource to be created. Possible values are `Cosmos.D4s`, `Cosmos.D8s` and `Cosmos.D16s`.
InstanceSize *string `pulumi:"instanceSize"`
}
type SqlDedicatedGatewayState struct {
// The resource ID of the CosmosDB Account. Changing this forces a new resource to be created.
CosmosdbAccountId pulumi.StringPtrInput
// The instance count for the CosmosDB SQL Dedicated Gateway. Possible value is between `1` and `5`.
InstanceCount pulumi.IntPtrInput
// The instance size for the CosmosDB SQL Dedicated Gateway. Changing this forces a new resource to be created. Possible values are `Cosmos.D4s`, `Cosmos.D8s` and `Cosmos.D16s`.
InstanceSize pulumi.StringPtrInput
}
func (SqlDedicatedGatewayState) ElementType() reflect.Type {
return reflect.TypeOf((*sqlDedicatedGatewayState)(nil)).Elem()
}
type sqlDedicatedGatewayArgs struct {
// The resource ID of the CosmosDB Account. Changing this forces a new resource to be created.
CosmosdbAccountId string `pulumi:"cosmosdbAccountId"`
// The instance count for the CosmosDB SQL Dedicated Gateway. Possible value is between `1` and `5`.
InstanceCount int `pulumi:"instanceCount"`
// The instance size for the CosmosDB SQL Dedicated Gateway. Changing this forces a new resource to be created. Possible values are `Cosmos.D4s`, `Cosmos.D8s` and `Cosmos.D16s`.
InstanceSize string `pulumi:"instanceSize"`
}
// The set of arguments for constructing a SqlDedicatedGateway resource.
type SqlDedicatedGatewayArgs struct {
// The resource ID of the CosmosDB Account. Changing this forces a new resource to be created.
CosmosdbAccountId pulumi.StringInput
// The instance count for the CosmosDB SQL Dedicated Gateway. Possible value is between `1` and `5`.
InstanceCount pulumi.IntInput
// The instance size for the CosmosDB SQL Dedicated Gateway. Changing this forces a new resource to be created. Possible values are `Cosmos.D4s`, `Cosmos.D8s` and `Cosmos.D16s`.
InstanceSize pulumi.StringInput
}
func (SqlDedicatedGatewayArgs) ElementType() reflect.Type {
return reflect.TypeOf((*sqlDedicatedGatewayArgs)(nil)).Elem()
}
type SqlDedicatedGatewayInput interface {
pulumi.Input
ToSqlDedicatedGatewayOutput() SqlDedicatedGatewayOutput
ToSqlDedicatedGatewayOutputWithContext(ctx context.Context) SqlDedicatedGatewayOutput
}
func (*SqlDedicatedGateway) ElementType() reflect.Type {
return reflect.TypeOf((**SqlDedicatedGateway)(nil)).Elem()
}
func (i *SqlDedicatedGateway) ToSqlDedicatedGatewayOutput() SqlDedicatedGatewayOutput {
return i.ToSqlDedicatedGatewayOutputWithContext(context.Background())
}
func (i *SqlDedicatedGateway) ToSqlDedicatedGatewayOutputWithContext(ctx context.Context) SqlDedicatedGatewayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SqlDedicatedGatewayOutput)
}
// SqlDedicatedGatewayArrayInput is an input type that accepts SqlDedicatedGatewayArray and SqlDedicatedGatewayArrayOutput values.
// You can construct a concrete instance of `SqlDedicatedGatewayArrayInput` via:
//
// SqlDedicatedGatewayArray{ SqlDedicatedGatewayArgs{...} }
type SqlDedicatedGatewayArrayInput interface {
pulumi.Input
ToSqlDedicatedGatewayArrayOutput() SqlDedicatedGatewayArrayOutput
ToSqlDedicatedGatewayArrayOutputWithContext(context.Context) SqlDedicatedGatewayArrayOutput
}
type SqlDedicatedGatewayArray []SqlDedicatedGatewayInput
func (SqlDedicatedGatewayArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SqlDedicatedGateway)(nil)).Elem()
}
func (i SqlDedicatedGatewayArray) ToSqlDedicatedGatewayArrayOutput() SqlDedicatedGatewayArrayOutput {
return i.ToSqlDedicatedGatewayArrayOutputWithContext(context.Background())
}
func (i SqlDedicatedGatewayArray) ToSqlDedicatedGatewayArrayOutputWithContext(ctx context.Context) SqlDedicatedGatewayArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SqlDedicatedGatewayArrayOutput)
}
// SqlDedicatedGatewayMapInput is an input type that accepts SqlDedicatedGatewayMap and SqlDedicatedGatewayMapOutput values.
// You can construct a concrete instance of `SqlDedicatedGatewayMapInput` via:
//
// SqlDedicatedGatewayMap{ "key": SqlDedicatedGatewayArgs{...} }
type SqlDedicatedGatewayMapInput interface {
pulumi.Input
ToSqlDedicatedGatewayMapOutput() SqlDedicatedGatewayMapOutput
ToSqlDedicatedGatewayMapOutputWithContext(context.Context) SqlDedicatedGatewayMapOutput
}
type SqlDedicatedGatewayMap map[string]SqlDedicatedGatewayInput
func (SqlDedicatedGatewayMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SqlDedicatedGateway)(nil)).Elem()
}
func (i SqlDedicatedGatewayMap) ToSqlDedicatedGatewayMapOutput() SqlDedicatedGatewayMapOutput {
return i.ToSqlDedicatedGatewayMapOutputWithContext(context.Background())
}
func (i SqlDedicatedGatewayMap) ToSqlDedicatedGatewayMapOutputWithContext(ctx context.Context) SqlDedicatedGatewayMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SqlDedicatedGatewayMapOutput)
}
type SqlDedicatedGatewayOutput struct{ *pulumi.OutputState }
func (SqlDedicatedGatewayOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SqlDedicatedGateway)(nil)).Elem()
}
func (o SqlDedicatedGatewayOutput) ToSqlDedicatedGatewayOutput() SqlDedicatedGatewayOutput {
return o
}
func (o SqlDedicatedGatewayOutput) ToSqlDedicatedGatewayOutputWithContext(ctx context.Context) SqlDedicatedGatewayOutput {
return o
}
// The resource ID of the CosmosDB Account. Changing this forces a new resource to be created.
func (o SqlDedicatedGatewayOutput) CosmosdbAccountId() pulumi.StringOutput {
return o.ApplyT(func(v *SqlDedicatedGateway) pulumi.StringOutput { return v.CosmosdbAccountId }).(pulumi.StringOutput)
}
// The instance count for the CosmosDB SQL Dedicated Gateway. Possible value is between `1` and `5`.
func (o SqlDedicatedGatewayOutput) InstanceCount() pulumi.IntOutput {
return o.ApplyT(func(v *SqlDedicatedGateway) pulumi.IntOutput { return v.InstanceCount }).(pulumi.IntOutput)
}
// The instance size for the CosmosDB SQL Dedicated Gateway. Changing this forces a new resource to be created. Possible values are `Cosmos.D4s`, `Cosmos.D8s` and `Cosmos.D16s`.
func (o SqlDedicatedGatewayOutput) InstanceSize() pulumi.StringOutput {
return o.ApplyT(func(v *SqlDedicatedGateway) pulumi.StringOutput { return v.InstanceSize }).(pulumi.StringOutput)
}
type SqlDedicatedGatewayArrayOutput struct{ *pulumi.OutputState }
func (SqlDedicatedGatewayArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SqlDedicatedGateway)(nil)).Elem()
}
func (o SqlDedicatedGatewayArrayOutput) ToSqlDedicatedGatewayArrayOutput() SqlDedicatedGatewayArrayOutput {
return o
}
func (o SqlDedicatedGatewayArrayOutput) ToSqlDedicatedGatewayArrayOutputWithContext(ctx context.Context) SqlDedicatedGatewayArrayOutput {
return o
}
func (o SqlDedicatedGatewayArrayOutput) Index(i pulumi.IntInput) SqlDedicatedGatewayOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SqlDedicatedGateway {
return vs[0].([]*SqlDedicatedGateway)[vs[1].(int)]
}).(SqlDedicatedGatewayOutput)
}
type SqlDedicatedGatewayMapOutput struct{ *pulumi.OutputState }
func (SqlDedicatedGatewayMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SqlDedicatedGateway)(nil)).Elem()
}
func (o SqlDedicatedGatewayMapOutput) ToSqlDedicatedGatewayMapOutput() SqlDedicatedGatewayMapOutput {
return o
}
func (o SqlDedicatedGatewayMapOutput) ToSqlDedicatedGatewayMapOutputWithContext(ctx context.Context) SqlDedicatedGatewayMapOutput {
return o
}
func (o SqlDedicatedGatewayMapOutput) MapIndex(k pulumi.StringInput) SqlDedicatedGatewayOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SqlDedicatedGateway {
return vs[0].(map[string]*SqlDedicatedGateway)[vs[1].(string)]
}).(SqlDedicatedGatewayOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SqlDedicatedGatewayInput)(nil)).Elem(), &SqlDedicatedGateway{})
pulumi.RegisterInputType(reflect.TypeOf((*SqlDedicatedGatewayArrayInput)(nil)).Elem(), SqlDedicatedGatewayArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SqlDedicatedGatewayMapInput)(nil)).Elem(), SqlDedicatedGatewayMap{})
pulumi.RegisterOutputType(SqlDedicatedGatewayOutput{})
pulumi.RegisterOutputType(SqlDedicatedGatewayArrayOutput{})
pulumi.RegisterOutputType(SqlDedicatedGatewayMapOutput{})
}