-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
models.ts
321 lines (292 loc) · 7.6 KB
/
models.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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {
LeaseAccessConditions,
SequenceNumberAccessConditions,
AppendPositionAccessConditions,
AccessTier,
CpkInfo,
BlobDownloadResponseModel
} from "./generatedModels";
import { EncryptionAlgorithmAES25 } from "./utils/constants";
/**
* Blob tags.
*/
export type Tags = Record<string, string>;
/**
* A map of name-value pairs to associate with the resource.
*/
export interface Metadata {
/**
* A name-value pair.
*/
[propertyName: string]: string;
}
/**
* standard HTTP conditional headers and tags condition.
*/
export interface ModifiedAccessConditions
extends MatchConditions,
ModificationConditions,
TagConditions {}
/**
* standard HTTP conditional headers, tags condition and lease condition
*/
export interface BlobRequestConditions extends ModifiedAccessConditions, LeaseAccessConditions {}
/**
* Conditions to add to the creation of this page blob.
*/
export interface PageBlobRequestConditions
extends BlobRequestConditions,
SequenceNumberAccessConditions {}
/**
* Conditions to add to the creation of this append blob.
*/
export interface AppendBlobRequestConditions
extends BlobRequestConditions,
AppendPositionAccessConditions {}
/**
* Specifies HTTP options for conditional requests based on modification time.
*/
export interface ModificationConditions {
/**
* Specify this header value to operate only on a blob if it has been modified since the
* specified date/time.
*/
ifModifiedSince?: Date;
/**
* Specify this header value to operate only on a blob if it has not been modified since the
* specified date/time.
*/
ifUnmodifiedSince?: Date;
}
/**
* Specifies HTTP options for conditional requests based on ETag matching.
*/
export interface MatchConditions {
/**
* Specify an ETag value to operate only on blobs with a matching value.
*/
ifMatch?: string;
/**
* Specify an ETag value to operate only on blobs without a matching value.
*/
ifNoneMatch?: string;
}
/**
* Specifies HTTP options for conditional requests based on blob tags.
*/
export interface TagConditions {
/**
* Optional SQL statement to apply to the tags of the blob.
*/
tagConditions?: string;
}
/**
* Conditions to meet for the container.
*/
export interface ContainerRequestConditions extends LeaseAccessConditions, ModificationConditions {}
/**
* Represents the access tier on a blob.
* For detailed information about block blob level tiering see {@link https://docs.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers|Hot, cool and archive storage tiers.}
*/
export enum BlockBlobTier {
/**
* Optimized for storing data that is accessed frequently.
*/
Hot = "Hot",
/**
* Optimized for storing data that is infrequently accessed and stored for at least 30 days.
*/
Cool = "Cool",
/**
* Optimized for storing data that is rarely accessed and stored for at least 180 days
* with flexible latency requirements (on the order of hours).
*/
Archive = "Archive"
}
/**
* Specifies the page blob tier to set the blob to. This is only applicable to page blobs on premium storage accounts.
* Please see {@link https://docs.microsoft.com/azure/storage/storage-premium-storage#scalability-and-performance-targets|here}
* for detailed information on the corresponding IOPS and throughput per PageBlobTier.
*/
export enum PremiumPageBlobTier {
/**
* P4 Tier.
*/
P4 = "P4",
/**
* P6 Tier.
*/
P6 = "P6",
/**
* P10 Tier.
*/
P10 = "P10",
/**
* P15 Tier.
*/
P15 = "P15",
/**
* P20 Tier.
*/
P20 = "P20",
/**
* P30 Tier.
*/
P30 = "P30",
/**
* P40 Tier.
*/
P40 = "P40",
/**
* P50 Tier.
*/
P50 = "P50",
/**
* P60 Tier.
*/
P60 = "P60",
/**
* P70 Tier.
*/
P70 = "P70",
/**
* P80 Tier.
*/
P80 = "P80"
}
export function toAccessTier(
tier: BlockBlobTier | PremiumPageBlobTier | string | undefined
): AccessTier | undefined {
if (tier == undefined) {
return undefined;
}
return tier as AccessTier; // No more check if string is a valid AccessTier, and left this to underlay logic to decide(service).
}
export function ensureCpkIfSpecified(cpk: CpkInfo | undefined, isHttps: boolean) {
if (cpk && !isHttps) {
throw new RangeError("Customer-provided encryption key must be used over HTTPS.");
}
if (cpk && !cpk.encryptionAlgorithm) {
cpk.encryptionAlgorithm = EncryptionAlgorithmAES25;
}
}
/**
* Specifies the Replication Status of a blob. This is used when a storage account has
* Object Replication Policy(s) applied. See {@link ObjectReplicationPolicy} and {@link ObjectReplicationRule}.
*/
export type ObjectReplicationStatus = "complete" | "failed";
/**
* Contains the Object Replication Rule ID and {@link ObjectReplicationStatus} of a blob.
* There can be more than one {@link ObjectReplicationRule} under a {@link ObjectReplicationPolicy}.
*/
export interface ObjectReplicationRule {
/**
* The Object Replication Rule ID.
*
* @type {string}
* @memberof ObjectReplicationRule
*/
ruleId: string;
/**
* The Replication Status
*
* @type {ObjectReplicationStatus}
* @memberof ObjectReplicationRule
*/
replicationStatus: ObjectReplicationStatus;
}
/**
* Contains Object Replication Policy ID and the respective list of {@link ObjectReplicationRule}.
* This is used when retrieving the Object Replication Properties on the source blob. The policy id for the
* destination blob is set in ObjectReplicationDestinationPolicyId of the respective method responses
* (e.g. {@link BlobProperties.ObjectReplicationDestinationPolicyId}.
*
* @export
* @interface ObjectReplicationPolicy
*/
export interface ObjectReplicationPolicy {
/**
* The Object Replication Policy ID.
*
* @type {string}
* @memberof ObjectReplicationPolicy
*/
policyId: string;
/**
* The Rule ID(s) and respective Replication Status(s) that are under the Policy ID.
*
* @type {ObjectReplicationRule[]}
* @memberof ObjectReplicationPolicy
*/
rules: ObjectReplicationRule[];
}
/**
* Contains response data for the {@link BlobClient.download} operation.
*
* @export
* @interface BlobDownloadResponseParsed
*/
export interface BlobDownloadResponseParsed extends BlobDownloadResponseModel {
/**
* Parsed Object Replication Policy Id, Rule Id(s) and status of the source blob.
*
* @type {ObjectReplicationPolicy[]}
* @memberof BlobDownloadResponseParsed
*/
objectReplicationSourceProperties?: ObjectReplicationPolicy[];
/**
* Object Replication Policy Id of the destination blob.
*
* @type {string}
* @memberof BlobDownloadResponseParsed
*/
objectReplicationDestinationPolicyId?: string;
}
/**
* The type of a {@link BlobQueryArrowField}.
*/
export type BlobQueryArrowFieldType =
| "int64"
| "bool"
| "timestamp[ms]"
| "string"
| "double"
| "decimal";
/**
* Describe a field in {@link BlobQueryArrowConfiguration}.
*
* @export
* @interface BlobQueryArrowField
*/
export interface BlobQueryArrowField {
/**
* The type of the field.
*
* @type {BlobQueryArrowFieldType}
* @memberof BlobQueryArrowField
*/
type: BlobQueryArrowFieldType;
/**
* The name of the field.
*
* @type {string}
* @memberof BlobQueryArrowField
*/
name?: string;
/**
* The precision of the field. Required if type is "decimal".
*
* @type {number}
* @memberof BlobQueryArrowField
*/
precision?: number;
/**
* The scale of the field. Required if type is is "decimal".
*
* @type {number}
* @memberof BlobQueryArrowField
*/
scale?: number;
}