forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure.d.ts
1882 lines (1573 loc) · 74.5 KB
/
azure.d.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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Azure SDK for Node v0.9.16
// Project: https://github.com/WindowsAzure/azure-sdk-for-node
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>,
// Anti Veeranna <https://github.com/antiveeranna>,
// Maxime LUCE <https://github.com/SomaticIT>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/**
* TODO
*/
declare module "azure" {
import events = require("events");
import stream = require("stream");
import url = require("url");
//#region Services
export class TableService extends BatchServiceClient {
static incorrectTableNameErr: string;
static incorrectCallbackErr: string;
static incorrectTableQuery: string;
static incorrectPartitionErr: string;
//#region Constructors
/**
* Creates a new TableService object.
* Uses the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables.
*
* @constructor
* @extends {ServiceClient}
*/
constructor();
/**
* Creates a new TableService object.
* Uses a connectionString to connect
*
* @constructor
* @extends {ServiceClient}
* @param {string} connectionString The connection string.
*/
constructor(connectionString: string);
/**
* Creates a new TableService object.
* Uses a storage account and an access key.
*
* @constructor
* @extends {ServiceClient}
* @param {string} storageAccount The storage account or the connection string.
* @param {string} storageAccessKey The storage access key.
* @param {string} host The host address.
* @param {object} authenticationProvider The authentication provider.
*/
constructor(storageAccount: string, storageAccessKey: string, host?: string, authenticationProvider?: string);
//#endregion
//#region Service Methods
getServiceProperties(callback: StorageServicePropertiesCallback): void;
getServiceProperties(options: TimeoutIntervalOptions, callback: StorageServicePropertiesCallback): void;
setServiceProperties(serviceProperties: StorageServiceProperties, callback: StorageCallbackVoid): void;
setServiceProperties(serviceProperties: StorageServiceProperties, options: TimeoutIntervalOptions, callback: StorageCallbackVoid): void;
//#endregion
//#region Table Methods
getTable(table: string, callback?: TableRequestCallback): void;
getTable(table: string, options: TimeoutIntervalOptions, callback?: TableRequestCallback): void;
createTable(table: string, callback?: TableRequestCallback): void;
createTable(table: string, options: TimeoutIntervalOptions, callback?: TableRequestCallback): void;
createTableIfNotExists(table: string, callback?: CreateTableIfNotExistsCallback): void;
createTableIfNotExists(table: string, options: TimeoutIntervalOptions, callback?: CreateTableIfNotExistsCallback): void;
deleteTable(table: string, callback?: DeleteTableCallback): void;
deleteTable(table: string, options: TimeoutIntervalOptions, callback?: DeleteTableCallback): void;
queryTables(callback?: QueryTablesCallback): void;
queryTables(options: QueryTablesOptions, callback?: QueryTablesCallback): void;
//#endregion
//#region Entities Methods
queryEntity(table: string, partitionKey: string, rowKey: string, callback?: QueryEntityCallback): void;
queryEntity(table: string, partitionKey: string, rowKey: string, options: TimeoutIntervalOptions, callback?: QueryEntityCallback): void;
queryEntities(tableQuery: TableQuery, callback?: QueryEntitiesCallback): void;
queryEntities(tableQuery: TableQuery, options: TimeoutIntervalOptions, callback?: QueryEntitiesCallback): void;
insertEntity(tableName: string, entityDescriptor: Entity, callback?: ModifyEntityCallback): void;
insertEntity(tableName: string, entityDescriptor: Entity, options: TimeoutIntervalOptions, callback?: ModifyEntityCallback): void;
insertOrReplaceEntity(tableName: string, entityDescriptor: Entity, callback?: ModifyEntityCallback): void;
insertOrReplaceEntity(tableName: string, entityDescriptor: Entity, options: TimeoutIntervalOptions, callback?: ModifyEntityCallback): void;
updateEntity(tableName: string, entityDescriptor: Entity, callback?: ModifyEntityCallback): void;
updateEntity(tableName: string, entityDescriptor: Entity, options: UpdateEntityOptions, callback?: ModifyEntityCallback): void;
mergeEntity(tableName: string, entityDescriptor: Entity, callback?: ModifyEntityCallback): void;
mergeEntity(tableName: string, entityDescriptor: Entity, options: UpdateEntityOptions, callback?: ModifyEntityCallback): void;
insertOrMergeEntity(tableName: string, entityDescriptor: Entity, callback?: ModifyEntityCallback): void;
insertOrMergeEntity(tableName: string, entityDescriptor: Entity, options: UpdateEntityOptions, callback?: ModifyEntityCallback): void;
deleteEntity(tableName: string, entityDescriptor: Entity, callback?: DeleteEntityCallback): void;
deleteEntity(tableName: string, entityDescriptor: Entity, options: UpdateEntityOptions, callback?: DeleteEntityCallback): void;
//#endregion
}
export class BlobService extends StorageServiceClient {
singleBlobPutThresholdInBytes: number;
parallelOperationThreadCount: number;
SpeedSummary: typeof SpeedSummary;
//#region Constructors
/**
* Creates a new BlobService object.
* Uses the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables.
*
* @constructor
* @extends {StorageServiceClient}
*/
constructor();
/**
* Creates a new BlobService object.
* Uses a connectionString to connect
*
* @constructor
* @extends {StorageServiceClient}
* @param {string} connectionString The connection string.
*/
constructor(connectionString: string);
/**
* Creates a new BlobService object.
* Uses a storage account and an access key.
*
* @constructor
* @extends {StorageServiceClient}
* @param {string} storageAccount The storage account or the connection string.
* @param {string} storageAccessKey The storage access key.
* @param {string} host The host address.
* @param {object} sasToken The Shared Access Signature token.
*/
constructor(storageAccount: string, storageAccessKey: string, host?: string, sasToken?: string);
//#endregion
//#region Service Methods
/**
* Gets the properties of a storage account�s Blob service, including Azure Storage Analytics.
*/
getServiceProperties(callback: StorageServicePropertiesCallback): void;
getServiceProperties(options: TimeoutIntervalOptions, callback: StorageServicePropertiesCallback): void;
/**
* Sets the properties of a storage account�s Blob service, including Azure Storage Analytics.
* You can also use this operation to set the default request version for all incoming requests that do not have a version specified.
*/
setServiceProperties(serviceProperties: StorageServiceProperties, callback: StorageCallbackVoid): void;
setServiceProperties(serviceProperties: StorageServiceProperties, options: TimeoutIntervalOptions, callback: StorageCallbackVoid): void;
//#endregion
//#region Containers Methods
/**
* Lists a segment containing a collection of container items under the specified account.
*/
listContainers(callback: ListContainersCallback): void;
listContainers(options: ListContainersOptions, callback: ListContainersCallback): void;
/**
* Creates a new container under the specified account.
* If a container with the same name already exists, the operation fails.
*/
createContainer(container: string, callback: StorageCallback<ContainerResult>): void;
createContainer(container: string, options: CreateContainerOptions, callback: StorageCallback<ContainerResult>): void;
/**
* Creates a new container under the specified account if the container does not exists.
*/
createContainerIfNotExists(container: string, callback: StorageCallback<boolean>): void;
createContainerIfNotExists(container: string, options: CreateContainerOptions, callback: StorageCallback<boolean>): void;
/**
* Retrieves a container and its properties from a specified account.
*/
getContainerProperties(container: string, callback: StorageCallback<ContainerResult>): void;
getContainerProperties(container: string, options: GetContainerPropertiesOptions, callback: StorageCallback<ContainerResult>): void;
/**
* Returns all user-defined metadata for the container.
*/
getContainerMetadata(container: string, callback: StorageCallback<ContainerResult>): void;
getContainerMetadata(container: string, options: GetContainerPropertiesOptions, callback: StorageCallback<ContainerResult>): void;
/**
* Sets the container's metadata.
*/
setContainerMetadata(container: string, metadata: StorageMetadata, callback: StorageCallback<ContainerResult>): void;
setContainerMetadata(container: string, metadata: StorageMetadata, options: AccessConditionsOptions, callback: StorageCallback<ContainerResult>): void;
/**
* Gets the container's ACL.
*/
getContainerAcl(container: string, callback: StorageCallback<ContainerResult>): void;
getContainerAcl(container: string, options: GetContainerPropertiesOptions, callback: StorageCallback<ContainerResult>): void;
/**
* Updates the container's ACL.
*/
setContainerAcl(container: string, publicAccessLevel: string, callback: StorageCallback<ContainerResult>): void;
setContainerAcl(container: string, publicAccessLevel: string, options: StorageAclOptions, callback: StorageCallback<ContainerResult>): void;
/**
* Marks the specified container for deletion.
* The container and any blobs contained within it are later deleted during garbage collection.
*/
deleteContainer(container: string, callback: StorageCallbackVoid): void;
deleteContainer(container: string, options: LeaseIdOptions, callback: StorageCallbackVoid): void;
//#endregion
//#region Blob Methods
/**
* Lists all of the blobs in the given container.
*/
listBlobs(container: string, callback: ListBlobsCallback): void;
listBlobs(container: string, options: ListBlobsOptions, callback: ListBlobsCallback): void;
/**
* Returns all user-defined metadata, standard HTTP properties, and system properties for the blob.
* It does not return or modify the content of the blob.
*/
getBlobProperties(container: string, blob: string, callback: StorageCallback<BlobResult>): void;
getBlobProperties(container: string, blob: string, options: GetBlobPropertiesOptions, callback: StorageCallback<BlobResult>): void;
/**
* Sets user-defined properties for the specified blob or snapshot.
* It does not return or modify the content of the blob.
*/
setBlobProperties(container: string, blob: string, callback: StorageCallback<BlobResult>): void;
setBlobProperties(container: string, blob: string, options: SetBlobPropertiesOptions, callback: StorageCallback<BlobResult>): void;
/**
* Sets user-defined metadata for the specified blob or snapshot as one or more name-value pairs
* It does not return or modify the content of the blob.
*/
setBlobMetadata(container: string, blob: string, metadata: StorageMetadata, callback: StorageCallback<BlobResult>): void;
setBlobMetadata(container: string, blob: string, metadata: StorageMetadata, options: GetBlobPropertiesOptions, callback: StorageCallback<BlobResult>): void;
/**
* Provides a stream to read from a blob.
*/
getBlob(container: string, blob: string, callback: StorageCallback<BlobResult>): stream.Readable;
getBlob(container: string, blob: string, options: ReadBlobOptions, callback: StorageCallback<BlobResult>): stream.Readable;
/**
* Downloads a blob into a file.
*/
getBlobToFile(container: string, blob: string, localFileName: string, callback: StorageCallback<BlobResult>): void;
getBlobToFile(container: string, blob: string, localFileName: string, options: ReadBlobOptions, callback: StorageCallback<BlobResult>): void;
/**
* Downloads a blob into a stream.
*/
getBlobToStream(container: string, blob: string, stream: stream.Writable, callback: StorageCallback<BlobResult>): void;
getBlobToStream(container: string, blob: string, stream: stream.Writable, options: ReadBlobOptions, callback: StorageCallback<BlobResult>): void;
/**
* Downloads a blob into a text string.
*/
getBlobToText(container: string, blob: string, callback: GetBlobToTextCallback): void;
getBlobToText(container: string, blob: string, options: ReadBlobOptions, callback: GetBlobToTextCallback): void;
/**
* Marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.
* If a blob has snapshots, you must delete them when deleting the blob. Using the deleteSnapshots option, you can choose either to delete both the blob and its snapshots,
* or to delete only the snapshots but not the blob itself. If the blob has snapshots, you must include the deleteSnapshots option or the blob service will return an error
* and nothing will be deleted.
* If you are deleting a specific snapshot using the snapshotId option, the deleteSnapshots option must NOT be included.
*/
deleteBlob(container: string, blob: string, callback: StorageCallback<boolean>): void;
deleteBlob(container: string, blob: string, options: DeleteBlobOptions, callback: StorageCallback<boolean>): void;
/**
* Creates a read-only snapshot of a blob.
*/
createBlobSnapshot(container: string, blob: string, callback: StorageCallback<string>): void;
createBlobSnapshot(container: string, blob: string, options: BlobSnapshotOptions, callback: StorageCallback<string>): void;
/**
* Starts to copy a blob to a destination within the storage account. The Copy Blob operation copies the entire committed blob.
*/
copyBlob(sourceUri: string, targetContainer: string, targetBlob: string, callback: StorageCallback<BlobResult>): void;
copyBlob(sourceUri: string, targetContainer: string, targetBlob: string, options: CopyBlobOptions, callback: StorageCallback<BlobResult>): void;
/**
* Creates a read-only snapshot of a blob.
*/
abortCopyBlob(container: string, blob: string, copyId: string, callback: StorageCallbackVoid): void;
abortCopyBlob(container: string, blob: string, copyId: string, options: LeaseIdOptions, callback: StorageCallbackVoid): void;
/**
* Retrieves a shared access signature token.
*/
generateSharedAccessSignature(container: string, blob: string, sharedAccessPolicy: SharedAccessPolicy): SharedAccessSignatureResult;
/**
* Retrieves a blob or container URL.
*/
getBlobUrl(container: string): string;
getBlobUrl(container: string, blob: string): string;
getBlobUrl(container: string, blob: string, sharedAccessPolicy: SharedAccessPolicy): string;
/**
* Uploads a blob.
*/
createBlob(container: string, blob: string, blobType: string, callback: StorageCallback<string>): stream.Writable;
createBlob(container: string, blob: string, blobType: string, options: UploadBlockBlobOptions, callback: StorageCallback<string>): stream.Writable;
//#endregion
//#region Page Blob Methods
/**
* Creates a page blob of the specified length.
*/
createPageBlob(container: string, blob: string, length: number, callback: StorageCallbackVoid): void;
createPageBlob(container: string, blob: string, length: number, options: SetBlobPropertiesOptions, callback: StorageCallbackVoid): void;
/**
* Updates a page blob from a stream.
*/
createBlobPagesFromStream(container: string, blob: string, readStream: stream.Readable, rangeStart: number, rangeEnd: number, callback: StorageCallback<BlobResult>): void;
createBlobPagesFromStream(container: string, blob: string, readStream: stream.Readable, rangeStart: number, rangeEnd: number, options: CreatePagesOptions, callback: StorageCallback<BlobResult>): void;
/**
* Updates a page blob from a text string.
*/
createBlobPagesFromText(container: string, blob: string, text: string, rangeStart: number, rangeEnd: number, callback: StorageCallback<BlobResult>): void;
createBlobPagesFromText(container: string, blob: string, text: string, rangeStart: number, rangeEnd: number, options: CreatePagesOptions, callback: StorageCallback<BlobResult>): void;
/**
* Lists page ranges.
* Lists all of the page ranges by default, or only the page ranges over a specific range of bytes if rangeStart and rangeEnd are specified.
*/
listBlobRegions(container: string, blob: string, callback: StorageCallback<PageRange[]>): void;
listBlobRegions(container: string, blob: string, options: PageRangeOptions, callback: StorageCallback<PageRange[]>): void;
/**
* Clears a range of pages.
*/
clearBlobPages(container: string, blob: string, rangeStart: number, rangeEnd: number, callback: StorageCallbackVoid): void;
clearBlobPages(container: string, blob: string, rangeStart: number, rangeEnd: number, options: LeaseAccessConditionsOptions, callback: StorageCallbackVoid): void;
/**
* Resizes a page blob.
*/
resizePageBlob(container: string, blob: string, size: number, callback: StorageCallback<BlobResult>): void;
resizePageBlob(container: string, blob: string, size: number, options: LeaseAccessConditionsOptions, callback: StorageCallback<BlobResult>): void;
/**
* Sets the page blob's sequence number.
*/
setPageBlobSequenceNumber(container: string, blob: string, sequenceNumberAction: string, sequenceNumber: string, callback: StorageCallback<BlobResult>): void;
setPageBlobSequenceNumber(container: string, blob: string, sequenceNumberAction: string, sequenceNumber: string, options: AccessConditionsOptions, callback: StorageCallback<BlobResult>): void;
//#endregion
//#region Block Blob Methods
/**
* Uploads a block blob from file.
*/
putBlockBlobFromFile(container: string, blob: string, localFileName: string, callback: StorageCallback<BlobResult>): SpeedSummary;
putBlockBlobFromFile(container: string, blob: string, localFileName: string, options: UploadBlockBlobOptions, callback: StorageCallback<BlobResult>): SpeedSummary;
createBlockBlobFromFile(container: string, blob: string, localFileName: string, callback: StorageCallback<BlobResult>): SpeedSummary;
createBlockBlobFromFile(container: string, blob: string, localFileName: string, options: UploadBlockBlobOptions, callback: StorageCallback<BlobResult>): SpeedSummary;
/**
* Uploads a block blob from a stream.
*/
putBlockBlobFromStream(container: string, blob: string, stream: stream.Stream, streamLength: number, callback: StorageCallback<BlobResult>): SpeedSummary;
putBlockBlobFromStream(container: string, blob: string, stream: stream.Stream, streamLength: number, options: UploadBlockBlobOptions, callback: StorageCallback<BlobResult>): SpeedSummary;
createBlockBlobFromStream(container: string, blob: string, stream: stream.Stream, streamLength: number, callback: StorageCallback<BlobResult>): SpeedSummary;
createBlockBlobFromStream(container: string, blob: string, stream: stream.Stream, streamLength: number, options: UploadBlockBlobOptions, callback: StorageCallback<BlobResult>): SpeedSummary;
/**
* Uploads a block blob from a text string.
*/
createBlockBlobFromText(container: string, blob: string, text: string, callback: StorageCallback<BlobResult>): SpeedSummary;
createBlockBlobFromText(container: string, blob: string, text: string, options: UploadBlockBlobOptions, callback: StorageCallback<BlobResult>): SpeedSummary;
/**
* Creates a new block to be committed as part of a blob.
*/
createBlobBlockFromStream(blockId: string, container: string, blob: string, readStream: stream.Stream, streamLength: number, callback: StorageCallbackVoid): void;
createBlobBlockFromStream(blockId: string, container: string, blob: string, readStream: stream.Stream, streamLength: number, options: CreateBlockOptions, callback: StorageCallbackVoid): void;
/**
* Creates a new block to be committed as part of a blob.
*/
createBlobBlockFromText(blockId: string, container: string, blob: string, text: string, callback: StorageCallbackVoid): void;
createBlobBlockFromText(blockId: string, container: string, blob: string, text: string, options: CreateBlockOptions, callback: StorageCallbackVoid): void;
/**
* Writes a blob by specifying the list of block IDs that make up the blob.
* In order to be written as part of a blob, a block must have been successfully written to the server in a prior
* createBlock operation.
*/
commitBlobBlocks(container: string, blob: string, blockList: BlockList, callback: StorageCallback<BlockList>): void;
commitBlobBlocks(container: string, blob: string, blockList: BlockList, options: CreateBlockOptions, callback: StorageCallback<BlockList>): void;
/**
* Retrieves the list of blocks that have been uploaded as part of a block blob.
*/
listBlobBlocks(container: string, blob: string, blockListType: string, callback: StorageCallback<BlockList>): void;
listBlobBlocks(container: string, blob: string, blockListType: string, options: GetBlobPropertiesOptions, callback: StorageCallback<BlockList>): void;
/**
* Generate a random block id prefix.
*/
generateBlockIdPrefix(): string;
/**
* Get a block id according to prefix and block number.
*/
getBlockId(prefix: string, number: number): string;
//#endregion
//#region Lease Methods
/**
* Acquires a new lease.
* If container and blob are specified, acquires a blob lease.
* Otherwise, if only container is specified and blob is null, acquires a container lease.
*/
acquireLease(container: string, blob: string, callback: StorageCallback<LeaseResult>): void;
acquireLease(container: string, blob: string, options: LeaseOptions, callback: StorageCallback<LeaseResult>): void;
/**
* Renews an existing lease.
* If container and blob are specified, renews the blob lease.
* Otherwise, if only container is specified and blob is null, renews the container lease.
*/
renewLease(container: string, blob: string, leaseId: string, callback: StorageCallback<LeaseResult>): void;
renewLease(container: string, blob: string, leaseId: string, options: AccessConditionsOptions, callback: StorageCallback<LeaseResult>): void;
/**
* Releases the lease.
* If container and blob are specified, releases the blob lease.
* Otherwise, if only container is specified and blob is null, releases the container lease.
*/
releaseLease(container: string, blob: string, leaseId: string, callback: StorageCallback<LeaseResult>): void;
releaseLease(container: string, blob: string, leaseId: string, options: AccessConditionsOptions, callback: StorageCallback<LeaseResult>): void;
/**
* Breaks the lease but ensures that another client cannot acquire a new lease until the current lease period has expired.
* If container and blob are specified, breaks the blob lease.
* Otherwise, if only container is specified and blob is null, breaks the container lease.
*/
breakLease(container: string, blob: string, leaseId: string, callback: StorageCallback<LeaseResult>): void;
breakLease(container: string, blob: string, leaseId: string, options: BreakLeaseOptions, callback: StorageCallback<LeaseResult>): void;
//#endregion
}
export class QueueService extends StorageServiceClient {
authenticationProvider: SharedKey;
//#region Constructors
/**
* Creates a new BlobService object.
* Uses the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables.
*
* @constructor
* @extends {StorageServiceClient}
*/
constructor();
/**
* Creates a new BlobService object.
* Uses a connectionString to connect
*
* @constructor
* @extends {StorageServiceClient}
* @param {string} connectionString The connection string.
*/
constructor(connectionString: string);
/**
* Creates a new BlobService object.
* Uses a storage account and an access key.
*
* @constructor
* @extends {StorageServiceClient}
* @param {string} storageAccount The storage account or the connection string.
* @param {string} storageAccessKey The storage access key.
* @param {string} host The host address.
* @param {object} sasToken The Shared Access Signature token.
*/
constructor(storageAccount: string, storageAccessKey: string, host?: string, sasToken?: string);
//#endregion
//#region Service Methods
/**
* Gets the properties of a storage account�s Blob service, including Azure Storage Analytics.
*/
getServiceProperties(callback: StorageServicePropertiesCallback): void;
getServiceProperties(options: TimeoutIntervalOptions, callback: StorageServicePropertiesCallback): void;
/**
* Sets the properties of a storage account�s Blob service, including Azure Storage Analytics.
* You can also use this operation to set the default request version for all incoming requests that do not have a version specified.
*/
setServiceProperties(serviceProperties: StorageServiceProperties, callback: StorageCallbackVoid): void;
setServiceProperties(serviceProperties: StorageServiceProperties, options: TimeoutIntervalOptions, callback: StorageCallbackVoid): void;
//#endregion
//#region Queue Methods
/**
* Lists all queues under the given account.
*/
listQueues(callback: ListQueuesCallback): void;
listQueues(options: ListQueuesOptions, callback: ListQueuesCallback): void;
/**
* Creates a new queue under the given account.
*/
createQueue(queue: string, callback: StorageCallback<QueueResult>): void;
createQueue(queue: string, options: MetadataOptions, callback: StorageCallback<QueueResult>): void;
/**
* Creates a new queue under the given account if it doesn't exist.
*/
createQueueIfNotExists(queue: string, callback: StorageCallback<boolean>): void;
createQueueIfNotExists(queue: string, options: MetadataOptions, callback: StorageCallback<boolean>): void;
/**
* Permanently deletes the specified queue.
*/
deleteQueue(queue: string, callback: StorageCallback<boolean>): void;
deleteQueue(queue: string, options: TimeoutIntervalOptions, callback: StorageCallback<boolean>): void;
/**
* Returns queue properties, including user-defined metadata.
*/
getQueueMetadata(queue: string, callback: StorageCallback<QueueResult>): void;
getQueueMetadata(queue: string, options: TimeoutIntervalOptions, callback: StorageCallback<QueueResult>): void;
/**
* Sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs.
*/
setQueueMetadata(queue: string, metadata: StorageMetadata, callback: StorageCallback<QueueResult>): void;
setQueueMetadata(queue: string, metadata: StorageMetadata, options: TimeoutIntervalOptions, callback: StorageCallback<QueueResult>): void;
//#endregion
//#region Message Methods
/**
* Adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message
* invisible until the visibility timeout expires. A message must be in a format that can be included in an XML request
* with UTF-8 encoding. The encoded message can be up to 64KB in size for versions 2011-08-18 and newer, or 8KB in size
* for previous versions.
*/
createMessage(queue: string, messageText: string, callback: StorageCallback<QueueMessageResult>): void
createMessage(queue: string, messageText: string, options: CreateQueueMessageOptions, callback: StorageCallback<QueueMessageResult>): void
/**
* Retrieves a message from the queue and makes it invisible to other consumers.
*/
getMessages(queue: string, callback: StorageCallback<QueueMessageResult[]>): void;
getMessages(queue: string, options: GetQueueMessagesOptions, callback: StorageCallback<QueueMessageResult[]>): void;
/**
* Retrieves a message from the front of the queue, without changing the message visibility.
*/
peekMessages(queue: string, callback: StorageCallback<QueueMessageResult[]>): void;
peekMessages(queue: string, options: PeekQueueMessagesOptions, callback: StorageCallback<QueueMessageResult[]>): void;
/**
* Deletes a specified message from the queue.
*/
deleteMessage(queue: string, messageId: string, popreceipt: string, callback: StorageCallback<boolean>): void
deleteMessage(queue: string, messageId: string, popreceipt: string, options: TimeoutIntervalOptions, callback: StorageCallback<boolean>): void
/**
* Clears all messages from the queue.
*/
clearMessages(queue: string, callback: StorageCallbackVoid): void;
clearMessages(queue: string, options: TimeoutIntervalOptions, callback: StorageCallbackVoid): void;
/**
* Deletes a specified message from the queue.
*/
updateMessage(queue: string, messageId: string, popreceipt: string, visibilitytimeout: number, callback: StorageCallback<QueueMessageResult>): void
updateMessage(queue: string, messageId: string, popreceipt: string, visibilitytimeout: number, options: UpdateQueueMessagesOptions, callback: StorageCallback<QueueMessageResult>): void
//#endregion
}
export class ServiceBusService {
}
export class SqlService {
}
export class ServiceManagementService {
}
export class SqlManagementService {
}
//#endregion
//#region Service Creators
export function createTableService(): TableService;
export function createTableService(connectionString: string): TableService;
export function createTableService(storageAccount: string, storageAccessKey: string, host?: string, authenticationProvider?: string): TableService;
export function createBlobService(): BlobService;
export function createBlobService(connectionString: string): BlobService;
export function createBlobService(storageAccount: string, storageAccessKey: string, host?: string, authenticationProvider?: string): BlobService;
export function createQueueService(): QueueService;
export function createQueueService(connectionString: string): QueueService;
export function createQueueService(storageAccount: string, storageAccessKey: string, host?: string, authenticationProvider?: string): QueueService;
export function createServiceBusService(): ServiceBusService;
export function createServiceBusService(connectionString: string): ServiceBusService;
export function createServiceBusService(namespace: string, accessKey?: string, issuer?: string, acsNamespace?: string, host?: string, authenticationProvider?: string): ServiceBusService;
export function createSqlService(serverName: string, administratorLogin: string, administratorLoginPassword: string, host?: string, acsHost?: string, authenticationProvider?: string): SqlService;
export function createServiceManagementService(subscriptionId: string, authentication: string, hostOptions: string): ServiceManagementService;
export function createSqlManagementService(subscriptionId: string, authentication: string, hostOptions: string): SqlManagementService;
//#endregion
//#region RoleEnvironment
interface RoleEnvironmentInterface extends events.EventEmitter {
incorrectCallbackErr: string;
clientId: string;
VersionEndpointFixedPath: string;
EnvironmentVariables: {
[key: string]: string;
VersionEndpointEnvironmentName: string;
};
/**
* Returns a RoleInstance object that represents the role instance
* in which this code is currently executing.
*/
getCurrentRoleInstance(callback: SimpleCallback<RoleInstance>): void;
/**
* Returns the deployment ID that uniquely identifies the deployment in
* which this role instance is running.
*/
getDeploymentId(callback: SimpleCallback<string>): void;
/**
* Indicates whether the role instance is running in the Microsoft Azure
* environment. It is good practice to enclose any code that uses
* service runtime in the isAvailable callback.
*/
isAvailable(callback: SimpleCallback<boolean>): void;
/**
* Indicates whether the role instance is running in the development fabric.
*/
isEmulated(callback: SimpleCallback<boolean>): void;
/**
* Returns the set of Role objects defined for your service.
* Roles are defined in the service definition file.
*/
getRoles(callback: SimpleCallback<Dictionary<Role>>): void;
/**
* Retrieves the settings in the service configuration file.
*
* A role's configuration settings are defined in the service definition file.
* Values for configuration settings are set in the service configuration file.
* For more information on configuration settings, see the [Service Definition Schema](http://msdn.microsoft.com/en-us/library/windowsazure/ee758711.aspx)
* and [Service Configuration Schema](http://msdn.microsoft.com/en-us/library/windowsazure/ee758710.aspx).
*/
getConfigurationSettings(callback: SimpleCallback<Dictionary<string>>): void;
/**
* Retrieves the set of named local storage resources, along with the path.
* For example, the DiagnosticStore resource which is defined for every role
* provides a location for runtime diagnostics and logs.
*/
getLocalResources(callback: SimpleCallback<Dictionary<RoleLocalResource>>): void;
/**
* Requests that the current role instance be stopped and restarted.
*
* Before the role instance is recycled, the Microsoft Azure load balancer takes the role instance out of rotation.
* This ensures that no new requests are routed to the instance while it is restarting.
*
* A call to `RequestRecycle` initiates the normal shutdown cycle. Microsoft Azure raises the
* `Stopping` event and calls the `OnStop` method so that you can run the necessary code to
* prepare the instance to be recycled.
*/
requestRecycle(callback: ErrorCallback): void;
/**
* Sets the status of the role instance.
*
* An instance may indicate that it is in one of two states: Ready or Busy. If an instance's state is Ready, it is
* prepared to receive requests from the load balancer. If the instance's state is Busy, it will not receive
* requests from the load balancer.
*/
setStatus(roleInstanceStatus: string, expirationUtc: Date, callback: ErrorCallback): void;
/**
* Clears the status of the role instance.
* An instance may indicate that it has completed communicating status by calling this method.
*/
clearStatus(callback: ErrorCallback): void;
}
export var RoleEnvironment: RoleEnvironmentInterface;
//#endregion
//#region Export of internal classes
export class WebResource {
rawResponse: boolean;
queryString: Dictionary<string>;
constructor();
get(path: string): WebResource;
put(path: string): WebResource;
post(path: string): WebResource;
merge(path: string): WebResource;
head(path: string): WebResource;
del(path: string): WebResource;
withProperty(name: string, value: string): WebResource;
withRawResponse(rawResponse: boolean): WebResource;
withHeadersOnly(headersOnly: boolean): WebResource;
withQueryOption(name: string, value: string, defaultValue: string): WebResource;
withQueryOptions(queryOptions: Dictionary<string>): WebResource;
withHeader(name: string, value: string): WebResource;
withHeaders(headers: Dictionary<string>): WebResource;
withBody(body: any): WebResource;
addOptionalMetadataHeaders(metadata: StorageMetadata): WebResource;
validResponse(statusCode: number): boolean;
pipeInput(inputStream: stream.Stream, destStream: stream.Stream): stream.Stream;
}
export class ServiceClient extends events.EventEmitter {
static EnvironmentVariables: any;
static DEVSTORE_STORAGE_ACCOUNT: string;
static DEVSTORE_STORAGE_ACCESS_KEY: string;
static DEVSTORE_BLOB_HOST: string;
static DEVSTORE_QUEUE_HOST: string;
static DEVSTORE_TABLE_HOST: string;
static CLOUD_BLOB_HOST: string;
static CLOUD_QUEUE_HOST: string;
static CLOUD_TABLE_HOST: string;
static CLOUD_SERVICEBUS_HOST: string;
static CLOUD_ACCESS_CONTROL_HOST: string;
static CLOUD_SERVICE_MANAGEMENT_HOST: string;
static CLOUD_DATABASE_HOST: string;
static DEFAULT_SERVICEBUS_ISSUER: string;
static DEFAULT_WRAP_NAMESPACE_SUFFIX: string;
static DEFAULT_PROTOCOL: string;
constructor(host: string, authenticationProvider: any);
setHost(host: string): void;
performRequest(webResource: WebResource, outputData: string, options: any, callback: Function): void;
performRequestOutputStream(webResource: WebResource, outputStream: any, options: any, callback: Function): void;
performRequestInputStream(webResource: WebResource, outputData: string, inputStream: any, options: any, callback: Function): void;
withFilter(newFilter: Filter): ServiceClient;
parseMetadataHeaders(headers: any): any;
isEmulated(): boolean;
setProxy(proxyUrl: string, proxyPort: number): void;
}
export class BatchServiceClient extends StorageServiceClient {
operations: any[];
constructor(storageAccount: string, storageAccessKey: string, host: string, usePathstyleUri: boolean, authenticationProvider: any);
beginBatch(): void;
isInBatch(): boolean;
rollback(): void;
hasOperations(): boolean;
addOperation(webResource: WebResource, outputData: any): void;
commitBatch(callback: (error: any, operationResponses: any[], response: any) => void): void;
commitBatch(options: any, callback: (error: any, operationResponses: any[], response: any) => void): void;
processResponse(responseObject: any, requestOperations: any[]): any[];
processOperation(webResource: WebResource, rawResponse: string): any;
}
export class ServiceManagementClient {
}
export class TableQuery {
static select(...fields: string[]): TableQuery;
from(table: string): TableQuery;
whereKeys(partitionKey: string, rowKey: string): TableQuery;
whereNextKeys(partitionKey: string, rowKey: string): TableQuery;
where(condition: string, ...values: string[]): TableQuery;
and(condition: string, ...args: string[]): TableQuery;
or(condition: string, ...args: string[]): TableQuery;
top(integer: number): TableQuery;
toQueryObject(): any;
toPath(): string;
}
export class BlobResult {
blob: string;
container: string;
etag: string;
lastModified: string;
contentType: string;
contentEncoding: string;
contentLanguage: string;
contentMD5: string;
cacheControl: string;
contentRange: string;
contentTypeHeader: string;
contentEncodingHeader: string;
contentLanguageHeader: string;
contentMD5Header: string;
cacheControlHeader: string;
contentLength: number;
contentLengthHeader: number;
contentDisposition: string;
contentDispositionHeader: string;
range: string;
rangeHeader: string;
getContentMd5: string;
acceptRanges: string;
blobType: string;
leaseStatus: string;
leaseId: string;
leaseDuration: string;
leaseState: string;
sequenceNumber: string;
copyStatus: string;
copyCompletionTime: string;
copyStatusDescription: string;
copyId: string;
copyProgress: number;
requestId: string;
metadata: StorageMetadata;
constructor();
constructor(container: string);
constructor(container: string, blob: string);
static parse(blobXml: any): BlobResult;
static setHeadersFromBlob(webResource: WebResource, blob: BlobResult): void;
getPropertiesFromHeaders(headers: any): void;
}
export class ContainerResult {
name: string;
publicAccessLevel: string;
etag: string;
lastModified: string;
leaseStatus: string;
leaseDuration: string;
leaseState: string;
requestId: string;
metadata: StorageMetadata;
signedIdentifiers: SignedIdentifier[];
constructor();
constructor(name: string);
constructor(name: string, publicAccessLevel: string);
static parse(containerXml: any): ContainerResult;
getPropertiesFromHeaders(headers: any): void;
}
export class LeaseResult {
container: string;
blob: string;
id: string;
time: string;
etag: string;
lastModified: string;
constructor();
constructor(container: string);
constructor(container: string, blob: string);
constructor(container: string, blob: string, id: string);
constructor(container: string, blob: string, id: string, time: string);
getPropertiesFromHeaders(header: any): void;
}
export class QueueResult {
name: string;
metadata: StorageMetadata;
approximatemessagecount: number;
constructor();
constructor(name: string);
constructor(name: string, metadata: StorageMetadata);
static parse(messageXml: any): QueueResult;
getPropertiesFromHeaders(headers: any): void;
}
export class QueueMessageResult {
queue: string;
insertiontime: string;
expirationtime: string;
timenextvisible: string;
messagetext: string;
dequeuecount: string;
messageid: string;
popreceipt: string;
metadata: StorageMetadata;
constructor();
constructor(queue: string);
constructor(queue: string, messageid: string);
constructor(queue: string, messageid: string, popreceipt: string);
constructor(queue: string, messageid: string, popreceipt: string, metadata: StorageMetadata);
static serialize(messageJs: string): string;
static parse(messageXml: any): QueueMessageResult;
getPropertiesFromHeaders(headers: any): void;
}
export class SpeedSummary {
name: string;
totalSize: number;
completeSize: number;
_startTime: Date;
_timeWindowInSeconds: number;
_timeWindow: number;
_totalWindowSize: number;
_speedTracks: number[];
_speedTrackPtr: number;
constructor(name: string);
/**
* Get running seconds
*/
getElapsedSeconds(): string;
getElapsedSeconds(humanReadable: boolean): number;
/**
* Get complete percentage
*/
getCompletePercent(): number;
getCompletePercent(len: number): number;
/**
* Get average upload/download speed
*/
getAverageSpeed(): string;
getAverageSpeed(humanReadable: boolean): number;