/
authorizationServer.ts
384 lines (375 loc) · 18.1 KB
/
authorizationServer.ts
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
// *** 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! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
import * as utilities from "../utilities";
/**
* Manages an Authorization Server within an API Management Service.
*
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
*
* const exampleAuthorizationServer = new azure.apimanagement.AuthorizationServer("example", {
* apiManagementName: azurerm_api_management_example.name,
* authorizationEndpoint: "https://example.mydomain.com/client/authorize",
* clientId: "42424242-4242-4242-4242-424242424242",
* clientRegistrationEndpoint: "https://example.mydomain.com/client/register",
* displayName: "Test Server",
* grantTypes: ["authorizationCode"],
* name: "test-server",
* resourceGroupName: azurerm_api_management_example.resourceGroupName,
* });
* const exampleApi = azure.apimanagement.getApi({
* apiManagementName: "search-api-management",
* name: "search-api",
* resourceGroupName: "search-service",
* revision: "2",
* });
* ```
*
* > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/api_management_authorization_server.html.markdown.
*/
export class AuthorizationServer extends pulumi.CustomResource {
/**
* Get an existing AuthorizationServer resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AuthorizationServerState, opts?: pulumi.CustomResourceOptions): AuthorizationServer {
return new AuthorizationServer(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'azure:apimanagement/authorizationServer:AuthorizationServer';
/**
* Returns true if the given object is an instance of AuthorizationServer. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is AuthorizationServer {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === AuthorizationServer.__pulumiType;
}
/**
* The name of the API Management Service in which this Authorization Server should be created. Changing this forces a new resource to be created.
*/
public readonly apiManagementName!: pulumi.Output<string>;
/**
* The OAUTH Authorization Endpoint.
*/
public readonly authorizationEndpoint!: pulumi.Output<string>;
/**
* The HTTP Verbs supported by the Authorization Endpoint. Possible values are `DELETE`, `GET`, `HEAD`, `OPTIONS`, `PATCH`, `POST`, `PUT` and `TRACE`.
*/
public readonly authorizationMethods!: pulumi.Output<string[]>;
/**
* The mechanism by which Access Tokens are passed to the API. Possible values are `authorizationHeader` and `query`.
*/
public readonly bearerTokenSendingMethods!: pulumi.Output<string[] | undefined>;
/**
* The Authentication Methods supported by the Token endpoint of this Authorization Server.. Possible values are `Basic` and `Body`.
*/
public readonly clientAuthenticationMethods!: pulumi.Output<string[] | undefined>;
/**
* The Client/App ID registered with this Authorization Server.
*/
public readonly clientId!: pulumi.Output<string>;
/**
* The URI of page where Client/App Registration is performed for this Authorization Server.
*/
public readonly clientRegistrationEndpoint!: pulumi.Output<string>;
/**
* The Client/App Secret registered with this Authorization Server.
*/
public readonly clientSecret!: pulumi.Output<string | undefined>;
/**
* The Default Scope used when requesting an Access Token, specified as a string containing space-delimited values.
*/
public readonly defaultScope!: pulumi.Output<string | undefined>;
/**
* A description of the Authorization Server, which may contain HTML formatting tags.
*/
public readonly description!: pulumi.Output<string | undefined>;
/**
* The user-friendly name of this Authorization Server.
*/
public readonly displayName!: pulumi.Output<string>;
/**
* Form of Authorization Grants required when requesting an Access Token. Possible values are `authorizationCode`, `clientCredentials`, `implicit` and `resourceOwnerPassword`.
*/
public readonly grantTypes!: pulumi.Output<string[]>;
/**
* The name of this Authorization Server. Changing this forces a new resource to be created.
*/
public readonly name!: pulumi.Output<string>;
/**
* The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
*/
public readonly resourceGroupName!: pulumi.Output<string>;
/**
* The password associated with the Resource Owner.
*/
public readonly resourceOwnerPassword!: pulumi.Output<string | undefined>;
/**
* The username associated with the Resource Owner.
*/
public readonly resourceOwnerUsername!: pulumi.Output<string | undefined>;
/**
* Does this Authorization Server support State? If this is set to `true` the client may use the state parameter to raise protocol security.
*/
public readonly supportState!: pulumi.Output<boolean | undefined>;
public readonly tokenBodyParameters!: pulumi.Output<outputs.apimanagement.AuthorizationServerTokenBodyParameter[] | undefined>;
/**
* The OAUTH Token Endpoint.
*/
public readonly tokenEndpoint!: pulumi.Output<string | undefined>;
/**
* Create a AuthorizationServer resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: AuthorizationServerArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: AuthorizationServerArgs | AuthorizationServerState, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
if (opts && opts.id) {
const state = argsOrState as AuthorizationServerState | undefined;
inputs["apiManagementName"] = state ? state.apiManagementName : undefined;
inputs["authorizationEndpoint"] = state ? state.authorizationEndpoint : undefined;
inputs["authorizationMethods"] = state ? state.authorizationMethods : undefined;
inputs["bearerTokenSendingMethods"] = state ? state.bearerTokenSendingMethods : undefined;
inputs["clientAuthenticationMethods"] = state ? state.clientAuthenticationMethods : undefined;
inputs["clientId"] = state ? state.clientId : undefined;
inputs["clientRegistrationEndpoint"] = state ? state.clientRegistrationEndpoint : undefined;
inputs["clientSecret"] = state ? state.clientSecret : undefined;
inputs["defaultScope"] = state ? state.defaultScope : undefined;
inputs["description"] = state ? state.description : undefined;
inputs["displayName"] = state ? state.displayName : undefined;
inputs["grantTypes"] = state ? state.grantTypes : undefined;
inputs["name"] = state ? state.name : undefined;
inputs["resourceGroupName"] = state ? state.resourceGroupName : undefined;
inputs["resourceOwnerPassword"] = state ? state.resourceOwnerPassword : undefined;
inputs["resourceOwnerUsername"] = state ? state.resourceOwnerUsername : undefined;
inputs["supportState"] = state ? state.supportState : undefined;
inputs["tokenBodyParameters"] = state ? state.tokenBodyParameters : undefined;
inputs["tokenEndpoint"] = state ? state.tokenEndpoint : undefined;
} else {
const args = argsOrState as AuthorizationServerArgs | undefined;
if (!args || args.apiManagementName === undefined) {
throw new Error("Missing required property 'apiManagementName'");
}
if (!args || args.authorizationEndpoint === undefined) {
throw new Error("Missing required property 'authorizationEndpoint'");
}
if (!args || args.authorizationMethods === undefined) {
throw new Error("Missing required property 'authorizationMethods'");
}
if (!args || args.clientId === undefined) {
throw new Error("Missing required property 'clientId'");
}
if (!args || args.clientRegistrationEndpoint === undefined) {
throw new Error("Missing required property 'clientRegistrationEndpoint'");
}
if (!args || args.displayName === undefined) {
throw new Error("Missing required property 'displayName'");
}
if (!args || args.grantTypes === undefined) {
throw new Error("Missing required property 'grantTypes'");
}
if (!args || args.resourceGroupName === undefined) {
throw new Error("Missing required property 'resourceGroupName'");
}
inputs["apiManagementName"] = args ? args.apiManagementName : undefined;
inputs["authorizationEndpoint"] = args ? args.authorizationEndpoint : undefined;
inputs["authorizationMethods"] = args ? args.authorizationMethods : undefined;
inputs["bearerTokenSendingMethods"] = args ? args.bearerTokenSendingMethods : undefined;
inputs["clientAuthenticationMethods"] = args ? args.clientAuthenticationMethods : undefined;
inputs["clientId"] = args ? args.clientId : undefined;
inputs["clientRegistrationEndpoint"] = args ? args.clientRegistrationEndpoint : undefined;
inputs["clientSecret"] = args ? args.clientSecret : undefined;
inputs["defaultScope"] = args ? args.defaultScope : undefined;
inputs["description"] = args ? args.description : undefined;
inputs["displayName"] = args ? args.displayName : undefined;
inputs["grantTypes"] = args ? args.grantTypes : undefined;
inputs["name"] = args ? args.name : undefined;
inputs["resourceGroupName"] = args ? args.resourceGroupName : undefined;
inputs["resourceOwnerPassword"] = args ? args.resourceOwnerPassword : undefined;
inputs["resourceOwnerUsername"] = args ? args.resourceOwnerUsername : undefined;
inputs["supportState"] = args ? args.supportState : undefined;
inputs["tokenBodyParameters"] = args ? args.tokenBodyParameters : undefined;
inputs["tokenEndpoint"] = args ? args.tokenEndpoint : undefined;
}
if (!opts) {
opts = {}
}
if (!opts.version) {
opts.version = utilities.getVersion();
}
super(AuthorizationServer.__pulumiType, name, inputs, opts);
}
}
/**
* Input properties used for looking up and filtering AuthorizationServer resources.
*/
export interface AuthorizationServerState {
/**
* The name of the API Management Service in which this Authorization Server should be created. Changing this forces a new resource to be created.
*/
readonly apiManagementName?: pulumi.Input<string>;
/**
* The OAUTH Authorization Endpoint.
*/
readonly authorizationEndpoint?: pulumi.Input<string>;
/**
* The HTTP Verbs supported by the Authorization Endpoint. Possible values are `DELETE`, `GET`, `HEAD`, `OPTIONS`, `PATCH`, `POST`, `PUT` and `TRACE`.
*/
readonly authorizationMethods?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The mechanism by which Access Tokens are passed to the API. Possible values are `authorizationHeader` and `query`.
*/
readonly bearerTokenSendingMethods?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The Authentication Methods supported by the Token endpoint of this Authorization Server.. Possible values are `Basic` and `Body`.
*/
readonly clientAuthenticationMethods?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The Client/App ID registered with this Authorization Server.
*/
readonly clientId?: pulumi.Input<string>;
/**
* The URI of page where Client/App Registration is performed for this Authorization Server.
*/
readonly clientRegistrationEndpoint?: pulumi.Input<string>;
/**
* The Client/App Secret registered with this Authorization Server.
*/
readonly clientSecret?: pulumi.Input<string>;
/**
* The Default Scope used when requesting an Access Token, specified as a string containing space-delimited values.
*/
readonly defaultScope?: pulumi.Input<string>;
/**
* A description of the Authorization Server, which may contain HTML formatting tags.
*/
readonly description?: pulumi.Input<string>;
/**
* The user-friendly name of this Authorization Server.
*/
readonly displayName?: pulumi.Input<string>;
/**
* Form of Authorization Grants required when requesting an Access Token. Possible values are `authorizationCode`, `clientCredentials`, `implicit` and `resourceOwnerPassword`.
*/
readonly grantTypes?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The name of this Authorization Server. Changing this forces a new resource to be created.
*/
readonly name?: pulumi.Input<string>;
/**
* The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
*/
readonly resourceGroupName?: pulumi.Input<string>;
/**
* The password associated with the Resource Owner.
*/
readonly resourceOwnerPassword?: pulumi.Input<string>;
/**
* The username associated with the Resource Owner.
*/
readonly resourceOwnerUsername?: pulumi.Input<string>;
/**
* Does this Authorization Server support State? If this is set to `true` the client may use the state parameter to raise protocol security.
*/
readonly supportState?: pulumi.Input<boolean>;
readonly tokenBodyParameters?: pulumi.Input<pulumi.Input<inputs.apimanagement.AuthorizationServerTokenBodyParameter>[]>;
/**
* The OAUTH Token Endpoint.
*/
readonly tokenEndpoint?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a AuthorizationServer resource.
*/
export interface AuthorizationServerArgs {
/**
* The name of the API Management Service in which this Authorization Server should be created. Changing this forces a new resource to be created.
*/
readonly apiManagementName: pulumi.Input<string>;
/**
* The OAUTH Authorization Endpoint.
*/
readonly authorizationEndpoint: pulumi.Input<string>;
/**
* The HTTP Verbs supported by the Authorization Endpoint. Possible values are `DELETE`, `GET`, `HEAD`, `OPTIONS`, `PATCH`, `POST`, `PUT` and `TRACE`.
*/
readonly authorizationMethods: pulumi.Input<pulumi.Input<string>[]>;
/**
* The mechanism by which Access Tokens are passed to the API. Possible values are `authorizationHeader` and `query`.
*/
readonly bearerTokenSendingMethods?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The Authentication Methods supported by the Token endpoint of this Authorization Server.. Possible values are `Basic` and `Body`.
*/
readonly clientAuthenticationMethods?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The Client/App ID registered with this Authorization Server.
*/
readonly clientId: pulumi.Input<string>;
/**
* The URI of page where Client/App Registration is performed for this Authorization Server.
*/
readonly clientRegistrationEndpoint: pulumi.Input<string>;
/**
* The Client/App Secret registered with this Authorization Server.
*/
readonly clientSecret?: pulumi.Input<string>;
/**
* The Default Scope used when requesting an Access Token, specified as a string containing space-delimited values.
*/
readonly defaultScope?: pulumi.Input<string>;
/**
* A description of the Authorization Server, which may contain HTML formatting tags.
*/
readonly description?: pulumi.Input<string>;
/**
* The user-friendly name of this Authorization Server.
*/
readonly displayName: pulumi.Input<string>;
/**
* Form of Authorization Grants required when requesting an Access Token. Possible values are `authorizationCode`, `clientCredentials`, `implicit` and `resourceOwnerPassword`.
*/
readonly grantTypes: pulumi.Input<pulumi.Input<string>[]>;
/**
* The name of this Authorization Server. Changing this forces a new resource to be created.
*/
readonly name?: pulumi.Input<string>;
/**
* The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
*/
readonly resourceGroupName: pulumi.Input<string>;
/**
* The password associated with the Resource Owner.
*/
readonly resourceOwnerPassword?: pulumi.Input<string>;
/**
* The username associated with the Resource Owner.
*/
readonly resourceOwnerUsername?: pulumi.Input<string>;
/**
* Does this Authorization Server support State? If this is set to `true` the client may use the state parameter to raise protocol security.
*/
readonly supportState?: pulumi.Input<boolean>;
readonly tokenBodyParameters?: pulumi.Input<pulumi.Input<inputs.apimanagement.AuthorizationServerTokenBodyParameter>[]>;
/**
* The OAUTH Token Endpoint.
*/
readonly tokenEndpoint?: pulumi.Input<string>;
}