/
organizationConnection.go
337 lines (286 loc) · 13.9 KB
/
organizationConnection.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
// 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 auth0
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// With this resource, you can manage enabled connections on an organization.
//
// !> This resource appends a connection to an organization. In contrast, the `OrganizationConnections` resource
// manages all the connections enabled for an organization. To avoid potential issues, it is recommended not to use this
// resource in conjunction with the `OrganizationConnections` resource when managing enabled connections for the
// same organization id.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// myConnection, err := auth0.NewConnection(ctx, "myConnection", &auth0.ConnectionArgs{
// Strategy: pulumi.String("auth0"),
// })
// if err != nil {
// return err
// }
// myOrganization, err := auth0.NewOrganization(ctx, "myOrganization", &auth0.OrganizationArgs{
// DisplayName: pulumi.String("My Organization"),
// })
// if err != nil {
// return err
// }
// _, err = auth0.NewOrganizationConnection(ctx, "myOrgConn", &auth0.OrganizationConnectionArgs{
// OrganizationId: myOrganization.ID(),
// ConnectionId: myConnection.ID(),
// AssignMembershipOnLogin: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// # This resource can be imported by specifying the
//
// organization ID and connection ID separated by "::" (note the double colon)
//
// <organizationID>::<connectionID>
//
// #
//
// Example:
//
// ```sh
// $ pulumi import auth0:index/organizationConnection:OrganizationConnection my_org_conn "org_XXXXX::con_XXXXX"
// ```
type OrganizationConnection struct {
pulumi.CustomResourceState
// When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
AssignMembershipOnLogin pulumi.BoolPtrOutput `pulumi:"assignMembershipOnLogin"`
// The ID of the connection to enable for the organization.
ConnectionId pulumi.StringOutput `pulumi:"connectionId"`
// The name of the enabled connection.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the organization to enable the connection for.
OrganizationId pulumi.StringOutput `pulumi:"organizationId"`
// The strategy of the enabled connection.
Strategy pulumi.StringOutput `pulumi:"strategy"`
}
// NewOrganizationConnection registers a new resource with the given unique name, arguments, and options.
func NewOrganizationConnection(ctx *pulumi.Context,
name string, args *OrganizationConnectionArgs, opts ...pulumi.ResourceOption) (*OrganizationConnection, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ConnectionId == nil {
return nil, errors.New("invalid value for required argument 'ConnectionId'")
}
if args.OrganizationId == nil {
return nil, errors.New("invalid value for required argument 'OrganizationId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource OrganizationConnection
err := ctx.RegisterResource("auth0:index/organizationConnection:OrganizationConnection", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetOrganizationConnection gets an existing OrganizationConnection 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 GetOrganizationConnection(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *OrganizationConnectionState, opts ...pulumi.ResourceOption) (*OrganizationConnection, error) {
var resource OrganizationConnection
err := ctx.ReadResource("auth0:index/organizationConnection:OrganizationConnection", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering OrganizationConnection resources.
type organizationConnectionState struct {
// When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
AssignMembershipOnLogin *bool `pulumi:"assignMembershipOnLogin"`
// The ID of the connection to enable for the organization.
ConnectionId *string `pulumi:"connectionId"`
// The name of the enabled connection.
Name *string `pulumi:"name"`
// The ID of the organization to enable the connection for.
OrganizationId *string `pulumi:"organizationId"`
// The strategy of the enabled connection.
Strategy *string `pulumi:"strategy"`
}
type OrganizationConnectionState struct {
// When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
AssignMembershipOnLogin pulumi.BoolPtrInput
// The ID of the connection to enable for the organization.
ConnectionId pulumi.StringPtrInput
// The name of the enabled connection.
Name pulumi.StringPtrInput
// The ID of the organization to enable the connection for.
OrganizationId pulumi.StringPtrInput
// The strategy of the enabled connection.
Strategy pulumi.StringPtrInput
}
func (OrganizationConnectionState) ElementType() reflect.Type {
return reflect.TypeOf((*organizationConnectionState)(nil)).Elem()
}
type organizationConnectionArgs struct {
// When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
AssignMembershipOnLogin *bool `pulumi:"assignMembershipOnLogin"`
// The ID of the connection to enable for the organization.
ConnectionId string `pulumi:"connectionId"`
// The ID of the organization to enable the connection for.
OrganizationId string `pulumi:"organizationId"`
}
// The set of arguments for constructing a OrganizationConnection resource.
type OrganizationConnectionArgs struct {
// When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
AssignMembershipOnLogin pulumi.BoolPtrInput
// The ID of the connection to enable for the organization.
ConnectionId pulumi.StringInput
// The ID of the organization to enable the connection for.
OrganizationId pulumi.StringInput
}
func (OrganizationConnectionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*organizationConnectionArgs)(nil)).Elem()
}
type OrganizationConnectionInput interface {
pulumi.Input
ToOrganizationConnectionOutput() OrganizationConnectionOutput
ToOrganizationConnectionOutputWithContext(ctx context.Context) OrganizationConnectionOutput
}
func (*OrganizationConnection) ElementType() reflect.Type {
return reflect.TypeOf((**OrganizationConnection)(nil)).Elem()
}
func (i *OrganizationConnection) ToOrganizationConnectionOutput() OrganizationConnectionOutput {
return i.ToOrganizationConnectionOutputWithContext(context.Background())
}
func (i *OrganizationConnection) ToOrganizationConnectionOutputWithContext(ctx context.Context) OrganizationConnectionOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrganizationConnectionOutput)
}
// OrganizationConnectionArrayInput is an input type that accepts OrganizationConnectionArray and OrganizationConnectionArrayOutput values.
// You can construct a concrete instance of `OrganizationConnectionArrayInput` via:
//
// OrganizationConnectionArray{ OrganizationConnectionArgs{...} }
type OrganizationConnectionArrayInput interface {
pulumi.Input
ToOrganizationConnectionArrayOutput() OrganizationConnectionArrayOutput
ToOrganizationConnectionArrayOutputWithContext(context.Context) OrganizationConnectionArrayOutput
}
type OrganizationConnectionArray []OrganizationConnectionInput
func (OrganizationConnectionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*OrganizationConnection)(nil)).Elem()
}
func (i OrganizationConnectionArray) ToOrganizationConnectionArrayOutput() OrganizationConnectionArrayOutput {
return i.ToOrganizationConnectionArrayOutputWithContext(context.Background())
}
func (i OrganizationConnectionArray) ToOrganizationConnectionArrayOutputWithContext(ctx context.Context) OrganizationConnectionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrganizationConnectionArrayOutput)
}
// OrganizationConnectionMapInput is an input type that accepts OrganizationConnectionMap and OrganizationConnectionMapOutput values.
// You can construct a concrete instance of `OrganizationConnectionMapInput` via:
//
// OrganizationConnectionMap{ "key": OrganizationConnectionArgs{...} }
type OrganizationConnectionMapInput interface {
pulumi.Input
ToOrganizationConnectionMapOutput() OrganizationConnectionMapOutput
ToOrganizationConnectionMapOutputWithContext(context.Context) OrganizationConnectionMapOutput
}
type OrganizationConnectionMap map[string]OrganizationConnectionInput
func (OrganizationConnectionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*OrganizationConnection)(nil)).Elem()
}
func (i OrganizationConnectionMap) ToOrganizationConnectionMapOutput() OrganizationConnectionMapOutput {
return i.ToOrganizationConnectionMapOutputWithContext(context.Background())
}
func (i OrganizationConnectionMap) ToOrganizationConnectionMapOutputWithContext(ctx context.Context) OrganizationConnectionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrganizationConnectionMapOutput)
}
type OrganizationConnectionOutput struct{ *pulumi.OutputState }
func (OrganizationConnectionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**OrganizationConnection)(nil)).Elem()
}
func (o OrganizationConnectionOutput) ToOrganizationConnectionOutput() OrganizationConnectionOutput {
return o
}
func (o OrganizationConnectionOutput) ToOrganizationConnectionOutputWithContext(ctx context.Context) OrganizationConnectionOutput {
return o
}
// When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
func (o OrganizationConnectionOutput) AssignMembershipOnLogin() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *OrganizationConnection) pulumi.BoolPtrOutput { return v.AssignMembershipOnLogin }).(pulumi.BoolPtrOutput)
}
// The ID of the connection to enable for the organization.
func (o OrganizationConnectionOutput) ConnectionId() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationConnection) pulumi.StringOutput { return v.ConnectionId }).(pulumi.StringOutput)
}
// The name of the enabled connection.
func (o OrganizationConnectionOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationConnection) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ID of the organization to enable the connection for.
func (o OrganizationConnectionOutput) OrganizationId() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationConnection) pulumi.StringOutput { return v.OrganizationId }).(pulumi.StringOutput)
}
// The strategy of the enabled connection.
func (o OrganizationConnectionOutput) Strategy() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationConnection) pulumi.StringOutput { return v.Strategy }).(pulumi.StringOutput)
}
type OrganizationConnectionArrayOutput struct{ *pulumi.OutputState }
func (OrganizationConnectionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*OrganizationConnection)(nil)).Elem()
}
func (o OrganizationConnectionArrayOutput) ToOrganizationConnectionArrayOutput() OrganizationConnectionArrayOutput {
return o
}
func (o OrganizationConnectionArrayOutput) ToOrganizationConnectionArrayOutputWithContext(ctx context.Context) OrganizationConnectionArrayOutput {
return o
}
func (o OrganizationConnectionArrayOutput) Index(i pulumi.IntInput) OrganizationConnectionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *OrganizationConnection {
return vs[0].([]*OrganizationConnection)[vs[1].(int)]
}).(OrganizationConnectionOutput)
}
type OrganizationConnectionMapOutput struct{ *pulumi.OutputState }
func (OrganizationConnectionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*OrganizationConnection)(nil)).Elem()
}
func (o OrganizationConnectionMapOutput) ToOrganizationConnectionMapOutput() OrganizationConnectionMapOutput {
return o
}
func (o OrganizationConnectionMapOutput) ToOrganizationConnectionMapOutputWithContext(ctx context.Context) OrganizationConnectionMapOutput {
return o
}
func (o OrganizationConnectionMapOutput) MapIndex(k pulumi.StringInput) OrganizationConnectionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *OrganizationConnection {
return vs[0].(map[string]*OrganizationConnection)[vs[1].(string)]
}).(OrganizationConnectionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*OrganizationConnectionInput)(nil)).Elem(), &OrganizationConnection{})
pulumi.RegisterInputType(reflect.TypeOf((*OrganizationConnectionArrayInput)(nil)).Elem(), OrganizationConnectionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*OrganizationConnectionMapInput)(nil)).Elem(), OrganizationConnectionMap{})
pulumi.RegisterOutputType(OrganizationConnectionOutput{})
pulumi.RegisterOutputType(OrganizationConnectionArrayOutput{})
pulumi.RegisterOutputType(OrganizationConnectionMapOutput{})
}