This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
/
user.go
269 lines (245 loc) · 9.55 KB
/
user.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
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20200601preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// User details.
type User struct {
pulumi.CustomResourceState
// Email address.
Email pulumi.StringPtrOutput `pulumi:"email"`
// First name.
FirstName pulumi.StringPtrOutput `pulumi:"firstName"`
// Collection of groups user is part of.
Groups GroupContractPropertiesResponseArrayOutput `pulumi:"groups"`
// Collection of user identities.
Identities UserIdentityContractResponseArrayOutput `pulumi:"identities"`
// Last name.
LastName pulumi.StringPtrOutput `pulumi:"lastName"`
// Resource name.
Name pulumi.StringOutput `pulumi:"name"`
// Optional note about a user set by the administrator.
Note pulumi.StringPtrOutput `pulumi:"note"`
// Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
RegistrationDate pulumi.StringPtrOutput `pulumi:"registrationDate"`
// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active.
State pulumi.StringPtrOutput `pulumi:"state"`
// Resource type for API Management resource.
Type pulumi.StringOutput `pulumi:"type"`
}
// NewUser registers a new resource with the given unique name, arguments, and options.
func NewUser(ctx *pulumi.Context,
name string, args *UserArgs, opts ...pulumi.ResourceOption) (*User, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Email == nil {
return nil, errors.New("invalid value for required argument 'Email'")
}
if args.FirstName == nil {
return nil, errors.New("invalid value for required argument 'FirstName'")
}
if args.LastName == nil {
return nil, errors.New("invalid value for required argument 'LastName'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.ServiceName == nil {
return nil, errors.New("invalid value for required argument 'ServiceName'")
}
if args.UserId == nil {
return nil, errors.New("invalid value for required argument 'UserId'")
}
if args.State == nil {
args.State = pulumi.StringPtr("active")
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("azure-nextgen:apimanagement/latest:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20160707:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20161010:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20170301:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20180101:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20180601preview:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20190101:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20191201:User"),
},
{
Type: pulumi.String("azure-nextgen:apimanagement/v20191201preview:User"),
},
})
opts = append(opts, aliases)
var resource User
err := ctx.RegisterResource("azure-nextgen:apimanagement/v20200601preview:User", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUser gets an existing User 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 GetUser(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) {
var resource User
err := ctx.ReadResource("azure-nextgen:apimanagement/v20200601preview:User", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering User resources.
type userState struct {
// Email address.
Email *string `pulumi:"email"`
// First name.
FirstName *string `pulumi:"firstName"`
// Collection of groups user is part of.
Groups []GroupContractPropertiesResponse `pulumi:"groups"`
// Collection of user identities.
Identities []UserIdentityContractResponse `pulumi:"identities"`
// Last name.
LastName *string `pulumi:"lastName"`
// Resource name.
Name *string `pulumi:"name"`
// Optional note about a user set by the administrator.
Note *string `pulumi:"note"`
// Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
RegistrationDate *string `pulumi:"registrationDate"`
// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active.
State *string `pulumi:"state"`
// Resource type for API Management resource.
Type *string `pulumi:"type"`
}
type UserState struct {
// Email address.
Email pulumi.StringPtrInput
// First name.
FirstName pulumi.StringPtrInput
// Collection of groups user is part of.
Groups GroupContractPropertiesResponseArrayInput
// Collection of user identities.
Identities UserIdentityContractResponseArrayInput
// Last name.
LastName pulumi.StringPtrInput
// Resource name.
Name pulumi.StringPtrInput
// Optional note about a user set by the administrator.
Note pulumi.StringPtrInput
// Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
RegistrationDate pulumi.StringPtrInput
// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active.
State pulumi.StringPtrInput
// Resource type for API Management resource.
Type pulumi.StringPtrInput
}
func (UserState) ElementType() reflect.Type {
return reflect.TypeOf((*userState)(nil)).Elem()
}
type userArgs struct {
// Determines the type of application which send the create user request. Default is legacy portal.
AppType *string `pulumi:"appType"`
// Determines the type of confirmation e-mail that will be sent to the newly created user.
Confirmation *string `pulumi:"confirmation"`
// Email address. Must not be empty and must be unique within the service instance.
Email string `pulumi:"email"`
// First name.
FirstName string `pulumi:"firstName"`
// Collection of user identities.
Identities []UserIdentityContract `pulumi:"identities"`
// Last name.
LastName string `pulumi:"lastName"`
// Optional note about a user set by the administrator.
Note *string `pulumi:"note"`
// Send an Email notification to the User.
Notify *bool `pulumi:"notify"`
// User Password. If no value is provided, a default password is generated.
Password *string `pulumi:"password"`
// The name of the resource group.
ResourceGroupName string `pulumi:"resourceGroupName"`
// The name of the API Management service.
ServiceName string `pulumi:"serviceName"`
// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active.
State *string `pulumi:"state"`
// User identifier. Must be unique in the current API Management service instance.
UserId string `pulumi:"userId"`
}
// The set of arguments for constructing a User resource.
type UserArgs struct {
// Determines the type of application which send the create user request. Default is legacy portal.
AppType pulumi.StringPtrInput
// Determines the type of confirmation e-mail that will be sent to the newly created user.
Confirmation pulumi.StringPtrInput
// Email address. Must not be empty and must be unique within the service instance.
Email pulumi.StringInput
// First name.
FirstName pulumi.StringInput
// Collection of user identities.
Identities UserIdentityContractArrayInput
// Last name.
LastName pulumi.StringInput
// Optional note about a user set by the administrator.
Note pulumi.StringPtrInput
// Send an Email notification to the User.
Notify pulumi.BoolPtrInput
// User Password. If no value is provided, a default password is generated.
Password pulumi.StringPtrInput
// The name of the resource group.
ResourceGroupName pulumi.StringInput
// The name of the API Management service.
ServiceName pulumi.StringInput
// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active.
State pulumi.StringPtrInput
// User identifier. Must be unique in the current API Management service instance.
UserId pulumi.StringInput
}
func (UserArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userArgs)(nil)).Elem()
}
type UserInput interface {
pulumi.Input
ToUserOutput() UserOutput
ToUserOutputWithContext(ctx context.Context) UserOutput
}
func (*User) ElementType() reflect.Type {
return reflect.TypeOf((*User)(nil))
}
func (i *User) ToUserOutput() UserOutput {
return i.ToUserOutputWithContext(context.Background())
}
func (i *User) ToUserOutputWithContext(ctx context.Context) UserOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserOutput)
}
type UserOutput struct {
*pulumi.OutputState
}
func (UserOutput) ElementType() reflect.Type {
return reflect.TypeOf((*User)(nil))
}
func (o UserOutput) ToUserOutput() UserOutput {
return o
}
func (o UserOutput) ToUserOutputWithContext(ctx context.Context) UserOutput {
return o
}
func init() {
pulumi.RegisterOutputType(UserOutput{})
}