-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
secretsModels.ts
310 lines (290 loc) · 7.82 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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as coreHttp from "@azure/core-http";
import { DeletionRecoveryLevel } from "./core/models";
/**
* @internal
* @ignore
* An interface representing the SecretClient. For internal use.
*/
export interface SecretClientInterface {
/**
* Recovers the deleted secret in the specified vault.
*/
recoverDeletedSecret(
secretName: string,
options?: RecoverDeletedSecretOptions
): Promise<SecretProperties>;
/**
* The getSecret method is applicable to any secret stored in Azure Key Vault. This operation requires
* the secrets/get permission.
*/
getSecret(secretName: string, options?: GetSecretOptions): Promise<KeyVaultSecret>;
/**
* Deletes a secret stored in Azure Key Vault.
*/
deleteSecret(secretName: string, options?: coreHttp.OperationOptions): Promise<DeletedSecret>;
/**
* The getDeletedSecret method returns the specified deleted secret along with its properties.
* This operation requires the secrets/get permission.
*/
getDeletedSecret(secretName: string, options?: DeleteSecretOptions): Promise<DeletedSecret>;
}
/**
* 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.**
*/
readonly keyId?: URL;
/**
* 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;
}
/**
* 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.
*/
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;
};
/**
* The secret value.
*/
value?: string;
/**
* The name of the secret.
*/
name: string;
}
/**
* An interface representing the optional parameters that can be
* passed to {@link beginDeleteSecret} and {@link beginRecoverDeletedKey}.
*/
export interface SecretPollerOptions extends coreHttp.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 coreHttp.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 coreHttp.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 coreHttp.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 coreHttp.OperationOptions {}
/**
* Options for {@link purgeDeletedSecret}.
*/
export interface PurgeDeletedSecretOptions extends coreHttp.OperationOptions {}
/**
* Options for {@link backupSecretOptions}.
*/
export interface BackupSecretOptions extends coreHttp.OperationOptions {}
/**
* Options for {@link restoreSecretBackup}.
*/
export interface RestoreSecretBackupOptions extends coreHttp.OperationOptions {}
/**
* @internal
* @ignore
* Options for {@link recoverDeletedSecret}.
*/
export interface RecoverDeletedSecretOptions extends coreHttp.OperationOptions {}
/**
* @internal
* @ignore
* Options for {@link deleteSecret}.
*/
export interface DeleteSecretOptions extends coreHttp.OperationOptions {}
/**
* Options for {@link listPropertiesOfSecretVersions}.
*/
export interface ListPropertiesOfSecretVersionsOptions extends coreHttp.OperationOptions {}
/**
* Options for {@link listPropertiesOfSecrets}.
*/
export interface ListPropertiesOfSecretsOptions extends coreHttp.OperationOptions {}
/**
* Options for {@link listDeletedSecrets}.
*/
export interface ListDeletedSecretsOptions extends coreHttp.OperationOptions {}