/
secretsModels.ts
332 lines (309 loc) · 8.65 KB
/
secretsModels.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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import * as coreClient from "@azure/core-client";
import { DeletionRecoveryLevel } from "./generated/models";
import { ExtendedCommonClientOptions } from "@azure/core-http-compat";
/**
* The latest supported KeyVault service API version
*/
export const LATEST_API_VERSION = "7.3";
/**
* The optional parameters accepted by the KeyVault's KeyClient
*/
export interface SecretClientOptions extends ExtendedCommonClientOptions {
/**
* The accepted versions of the KeyVault's service API.
*/
serviceVersion?: "7.0" | "7.1" | "7.2" | "7.3";
}
/**
* An interface representing a KeyVault Secret, with its name, value and {@link SecretProperties}.
*/
export interface KeyVaultSecret {
/**
* The properties of the secret.
*/
properties: SecretProperties;
/**
* The value of the secret.
*/
value?: string;
/**
* The name of the secret.
*/
name: string;
}
/**
* An interface representing the properties of a {@link KeyVaultSecret}.
*/
export interface SecretProperties {
/**
* The base URL to the vault.
*/
vaultUrl: string;
/**
* The version of the secret. May be undefined.
*/
version?: string;
/**
* The name of the secret.
*/
name: string;
/**
* The secret id.
*/
id?: string;
/**
* The content type of the secret.
*/
contentType?: string;
/**
* Determines whether the object is enabled.
*/
enabled?: boolean;
/**
* Not before date in UTC.
*/
readonly notBefore?: Date;
/**
* Expiry date in UTC.
*/
readonly expiresOn?: Date;
/**
* Application specific
* metadata in the form of key-value pairs.
*/
tags?: { [propertyName: string]: string };
/**
* If this is a secret backing a KV certificate, then
* this field specifies the corresponding key backing the KV certificate.
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
* @deprecated Please use {@link SecretProperties.certificateKeyId} instead. `keyId` will always be undefined.
*/
readonly keyId?: never;
/**
* If this is a secret backing a KV certificate, then
* this field specifies the identifier of the corresponding key backing the KV certificate.
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
readonly certificateKeyId?: string;
/**
* True if the secret's lifetime is managed by
* key vault. If this is a secret backing a certificate, then managed will be
* true.
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
readonly managed?: boolean;
/**
* Creation time in UTC.
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
readonly createdOn?: Date;
/**
* Last updated time in UTC.
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
readonly updatedOn?: Date;
/**
* Reflects the deletion
* recovery level currently in effect for keys in the current vault. If it
* contains 'Purgeable' the key can be permanently deleted by a privileged
* user; otherwise, only the system can purge the key, at the end of the
* retention interval. Possible values include: 'Purgeable',
* 'Recoverable+Purgeable', 'Recoverable',
* 'Recoverable+ProtectedSubscription'
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
readonly recoveryLevel?: DeletionRecoveryLevel;
/**
* The retention dates of the softDelete data.
* The value should be `>=7` and `<=90` when softDelete enabled.
* **NOTE: This property will not be serialized. It can only be populated by the server.**
*/
recoverableDays?: number;
}
/**
* An interface representing a deleted KeyVault Secret.
*/
export interface DeletedSecret {
/**
* The properties of the secret
*/
properties: SecretProperties & {
/**
* The url of the recovery object, used to
* identify and recover the deleted secret.
* @deprecated Please use {@link DeletedSecret.recoveryId}.
*/
recoveryId?: string;
/**
* The time when the secret is scheduled
* to be purged, in UTC
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
* @deprecated Please use {@link DeletedSecret.scheduledPurgeDate}.
*/
scheduledPurgeDate?: Date;
/**
* The time when the secret was deleted, in UTC
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
* @deprecated Please use {@link DeletedSecret.deletedOn}.
*/
deletedOn?: Date;
};
/**
* The secret value.
*/
value?: string;
/**
* The name of the secret.
*/
name: string;
/**
* The url of the recovery object, used to
* identify and recover the deleted secret.
*/
recoveryId?: string;
/**
* The time when the secret is scheduled
* to be purged, in UTC
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
scheduledPurgeDate?: Date;
/**
* The time when the secret was deleted, in UTC
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
deletedOn?: Date;
}
/**
* An interface representing the optional parameters that can be
* passed to {@link beginDeleteSecret} and {@link beginRecoverDeletedKey}.
*/
export interface SecretPollerOptions extends coreClient.OperationOptions {
/**
* Time between each polling in milliseconds.
*/
intervalInMs?: number;
/**
* A serialized poller, used to resume an existing operation
*/
resumeFrom?: string;
}
/**
* An interface representing the optional parameters that can be
* passed to {@link beginDeleteSecret}
*/
export interface BeginDeleteSecretOptions extends SecretPollerOptions {}
/**
* An interface representing the optional parameters that can be
* passed to {@link beginRecoverDeletedSecret}
*/
export interface BeginRecoverDeletedSecretOptions extends SecretPollerOptions {}
/**
* Options for {@link setSecret}.
*/
export interface SetSecretOptions extends coreClient.OperationOptions {
/**
* Application specific metadata in the form of key-value pairs.
*/
tags?: { [propertyName: string]: string };
/**
* Type of the secret value such as a password.
*/
contentType?: string;
/**
* Determines whether the object is enabled.
*/
enabled?: boolean;
/**
* Not before date in UTC.
*/
readonly notBefore?: Date;
/**
* Expiry date in UTC.
*/
readonly expiresOn?: Date;
}
/**
* Options for {@link updateSecretProperties}.
*/
export interface UpdateSecretPropertiesOptions extends coreClient.OperationOptions {
/**
* Type of the secret value such as a password.
*/
contentType?: string;
/**
* Determines whether the object is enabled.
*/
enabled?: boolean;
/**
* Not before date in UTC.
*/
readonly notBefore?: Date;
/**
* Expiry date in UTC.
*/
readonly expiresOn?: Date;
/**
* Application specific metadata in the form of key-value pairs.
*/
tags?: { [propertyName: string]: string };
}
/**
* Options for {@link getSecret}.
*/
export interface GetSecretOptions extends coreClient.OperationOptions {
/**
* The version of the secret to retrieve. If not
* specified the latest version of the secret will be retrieved.
*/
version?: string;
}
/**
* Options for {@link getDeletedSecret}.
*/
export interface GetDeletedSecretOptions extends coreClient.OperationOptions {}
/**
* Options for {@link purgeDeletedSecret}.
*/
export interface PurgeDeletedSecretOptions extends coreClient.OperationOptions {}
/**
* Options for {@link backupSecretOptions}.
*/
export interface BackupSecretOptions extends coreClient.OperationOptions {}
/**
* Options for {@link restoreSecretBackup}.
*/
export interface RestoreSecretBackupOptions extends coreClient.OperationOptions {}
/**
* @internal
* Options for {@link recoverDeletedSecret}.
*/
export interface RecoverDeletedSecretOptions extends coreClient.OperationOptions {}
/**
* @internal
* Options for {@link deleteSecret}.
*/
export interface DeleteSecretOptions extends coreClient.OperationOptions {}
/**
* Options for {@link listPropertiesOfSecretVersions}.
*/
export interface ListPropertiesOfSecretVersionsOptions extends coreClient.OperationOptions {}
/**
* Options for {@link listPropertiesOfSecrets}.
*/
export interface ListPropertiesOfSecretsOptions extends coreClient.OperationOptions {}
/**
* Options for {@link listDeletedSecrets}.
*/
export interface ListDeletedSecretsOptions extends coreClient.OperationOptions {}