@azure/storage-queue 12.29.0 → 12.30.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Pipeline.d.ts +2 -3
- package/dist/browser/Pipeline.d.ts.map +1 -1
- package/dist/browser/Pipeline.js.map +1 -1
- package/dist/browser/QueueClient.d.ts +2 -1
- package/dist/browser/QueueClient.d.ts.map +1 -1
- package/dist/browser/QueueClient.js.map +1 -1
- package/dist/browser/QueueSASSignatureValues.d.ts +2 -1
- package/dist/browser/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/browser/QueueSASSignatureValues.js +2 -2
- package/dist/browser/QueueSASSignatureValues.js.map +1 -1
- package/dist/browser/QueueServiceClient.d.ts +28 -0
- package/dist/browser/QueueServiceClient.d.ts.map +1 -1
- package/dist/browser/QueueServiceClient.js +21 -13
- package/dist/browser/QueueServiceClient.js.map +1 -1
- package/dist/browser/SASQueryParameters.d.ts +6 -1
- package/dist/browser/SASQueryParameters.d.ts.map +1 -1
- package/dist/browser/SASQueryParameters.js +10 -0
- package/dist/browser/SASQueryParameters.js.map +1 -1
- package/dist/browser/generated/src/models/index.d.ts +4 -0
- package/dist/browser/generated/src/models/index.d.ts.map +1 -1
- package/dist/browser/generated/src/models/index.js.map +1 -1
- package/dist/browser/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/browser/generated/src/models/mappers.js +14 -0
- package/dist/browser/generated/src/models/mappers.js.map +1 -1
- package/dist/browser/generated/src/models/parameters.js +1 -1
- package/dist/browser/generated/src/models/parameters.js.map +1 -1
- package/dist/browser/generated/src/storageClient.js +2 -2
- package/dist/browser/generated/src/storageClient.js.map +1 -1
- package/dist/browser/generatedModels.d.ts +2 -2
- package/dist/browser/generatedModels.d.ts.map +1 -1
- package/dist/browser/generatedModels.js.map +1 -1
- package/dist/browser/index.d.ts +8 -8
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +1 -2
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/utils/constants.d.ts.map +1 -1
- package/dist/browser/utils/constants.js +2 -2
- package/dist/browser/utils/constants.js.map +1 -1
- package/dist/commonjs/AccountSASPermissions.js +133 -126
- package/dist/commonjs/AccountSASPermissions.js.map +7 -1
- package/dist/commonjs/AccountSASResourceTypes.js +80 -70
- package/dist/commonjs/AccountSASResourceTypes.js.map +7 -1
- package/dist/commonjs/AccountSASServices.js +88 -78
- package/dist/commonjs/AccountSASServices.js.map +7 -1
- package/dist/commonjs/AccountSASSignatureValues.js +91 -72
- package/dist/commonjs/AccountSASSignatureValues.js.map +7 -1
- package/dist/commonjs/Pipeline.d.ts +2 -3
- package/dist/commonjs/Pipeline.d.ts.map +1 -1
- package/dist/commonjs/Pipeline.js +244 -244
- package/dist/commonjs/Pipeline.js.map +7 -1
- package/dist/commonjs/QueueClient.d.ts +2 -1
- package/dist/commonjs/QueueClient.d.ts.map +1 -1
- package/dist/commonjs/QueueClient.js +710 -683
- package/dist/commonjs/QueueClient.js.map +7 -1
- package/dist/commonjs/QueueSASPermissions.js +90 -80
- package/dist/commonjs/QueueSASPermissions.js.map +7 -1
- package/dist/commonjs/QueueSASSignatureValues.d.ts +2 -1
- package/dist/commonjs/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/commonjs/QueueSASSignatureValues.js +151 -111
- package/dist/commonjs/QueueSASSignatureValues.js.map +7 -1
- package/dist/commonjs/QueueServiceClient.d.ts +28 -0
- package/dist/commonjs/QueueServiceClient.d.ts.map +1 -1
- package/dist/commonjs/QueueServiceClient.js +532 -472
- package/dist/commonjs/QueueServiceClient.js.map +7 -1
- package/dist/commonjs/SASQueryParameters.d.ts +6 -1
- package/dist/commonjs/SASQueryParameters.d.ts.map +1 -1
- package/dist/commonjs/SASQueryParameters.js +308 -267
- package/dist/commonjs/SASQueryParameters.js.map +7 -1
- package/dist/commonjs/SasIPRange.js +27 -14
- package/dist/commonjs/SasIPRange.js.map +7 -1
- package/dist/commonjs/StorageClient.js +75 -65
- package/dist/commonjs/StorageClient.js.map +7 -1
- package/dist/commonjs/StorageContextClient.js +34 -20
- package/dist/commonjs/StorageContextClient.js.map +7 -1
- package/dist/commonjs/generated/src/index.js +32 -16
- package/dist/commonjs/generated/src/index.js.map +7 -1
- package/dist/commonjs/generated/src/models/index.d.ts +4 -0
- package/dist/commonjs/generated/src/models/index.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models/index.js +86 -129
- package/dist/commonjs/generated/src/models/index.js.map +7 -1
- package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models/mappers.js +1947 -1817
- package/dist/commonjs/generated/src/models/mappers.js.map +7 -1
- package/dist/commonjs/generated/src/models/parameters.js +378 -305
- package/dist/commonjs/generated/src/models/parameters.js.map +7 -1
- package/dist/commonjs/generated/src/operations/index.js +27 -15
- package/dist/commonjs/generated/src/operations/index.js.map +7 -1
- package/dist/commonjs/generated/src/operations/messageId.js +130 -99
- package/dist/commonjs/generated/src/operations/messageId.js.map +7 -1
- package/dist/commonjs/generated/src/operations/messages.js +213 -185
- package/dist/commonjs/generated/src/operations/messages.js.map +7 -1
- package/dist/commonjs/generated/src/operations/queue.js +243 -206
- package/dist/commonjs/generated/src/operations/queue.js.map +7 -1
- package/dist/commonjs/generated/src/operations/service.js +239 -199
- package/dist/commonjs/generated/src/operations/service.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/index.js +27 -15
- package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/messageId.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/messageId.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/messages.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/messages.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/queue.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/queue.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/service.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/service.js.map +7 -1
- package/dist/commonjs/generated/src/storageClient.js +77 -59
- package/dist/commonjs/generated/src/storageClient.js.map +7 -1
- package/dist/commonjs/generatedModels.d.ts +2 -2
- package/dist/commonjs/generatedModels.d.ts.map +1 -1
- package/dist/commonjs/generatedModels.js +15 -5
- package/dist/commonjs/generatedModels.js.map +7 -1
- package/dist/commonjs/index.d.ts +9 -9
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +88 -43
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/log.js +28 -11
- package/dist/commonjs/log.js.map +7 -1
- package/dist/commonjs/models.js +33 -21
- package/dist/commonjs/models.js.map +7 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils/constants.d.ts.map +1 -1
- package/dist/commonjs/utils/constants.js +151 -114
- package/dist/commonjs/utils/constants.js.map +7 -1
- package/dist/commonjs/utils/tracing.js +32 -16
- package/dist/commonjs/utils/tracing.js.map +7 -1
- package/dist/commonjs/utils/utils.common.js +242 -338
- package/dist/commonjs/utils/utils.common.js.map +7 -1
- package/dist/esm/AccountSASPermissions.js +111 -123
- package/dist/esm/AccountSASPermissions.js.map +7 -1
- package/dist/esm/AccountSASResourceTypes.js +58 -67
- package/dist/esm/AccountSASResourceTypes.js.map +7 -1
- package/dist/esm/AccountSASServices.js +66 -75
- package/dist/esm/AccountSASServices.js.map +7 -1
- package/dist/esm/AccountSASSignatureValues.js +62 -63
- package/dist/esm/AccountSASSignatureValues.js.map +7 -1
- package/dist/esm/Pipeline.d.ts +2 -3
- package/dist/esm/Pipeline.d.ts.map +1 -1
- package/dist/esm/Pipeline.js +239 -239
- package/dist/esm/Pipeline.js.map +7 -1
- package/dist/esm/QueueClient.d.ts +2 -1
- package/dist/esm/QueueClient.d.ts.map +1 -1
- package/dist/esm/QueueClient.js +689 -671
- package/dist/esm/QueueClient.js.map +7 -1
- package/dist/esm/QueueSASPermissions.js +68 -77
- package/dist/esm/QueueSASPermissions.js.map +7 -1
- package/dist/esm/QueueSASSignatureValues.d.ts +2 -1
- package/dist/esm/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/esm/QueueSASSignatureValues.js +124 -104
- package/dist/esm/QueueSASSignatureValues.js.map +7 -1
- package/dist/esm/QueueServiceClient.d.ts +28 -0
- package/dist/esm/QueueServiceClient.d.ts.map +1 -1
- package/dist/esm/QueueServiceClient.js +507 -457
- package/dist/esm/QueueServiceClient.js.map +7 -1
- package/dist/esm/SASQueryParameters.d.ts +6 -1
- package/dist/esm/SASQueryParameters.d.ts.map +1 -1
- package/dist/esm/SASQueryParameters.js +283 -262
- package/dist/esm/SASQueryParameters.js.map +7 -1
- package/dist/esm/SasIPRange.js +5 -12
- package/dist/esm/SasIPRange.js.map +7 -1
- package/dist/esm/StorageClient.js +50 -59
- package/dist/esm/StorageClient.js.map +7 -1
- package/dist/esm/StorageContextClient.js +10 -15
- package/dist/esm/StorageContextClient.js.map +7 -1
- package/dist/esm/generated/src/index.js +4 -9
- package/dist/esm/generated/src/index.js.map +7 -1
- package/dist/esm/generated/src/models/index.d.ts +4 -0
- package/dist/esm/generated/src/models/index.d.ts.map +1 -1
- package/dist/esm/generated/src/models/index.js +63 -126
- package/dist/esm/generated/src/models/index.js.map +7 -1
- package/dist/esm/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/esm/generated/src/models/mappers.js +1873 -1813
- package/dist/esm/generated/src/models/mappers.js.map +7 -1
- package/dist/esm/generated/src/models/parameters.js +330 -302
- package/dist/esm/generated/src/models/parameters.js.map +7 -1
- package/dist/esm/generated/src/operations/index.js +0 -8
- package/dist/esm/generated/src/operations/index.js.map +7 -1
- package/dist/esm/generated/src/operations/messageId.js +95 -92
- package/dist/esm/generated/src/operations/messageId.js.map +7 -1
- package/dist/esm/generated/src/operations/messages.js +178 -178
- package/dist/esm/generated/src/operations/messages.js.map +7 -1
- package/dist/esm/generated/src/operations/queue.js +208 -199
- package/dist/esm/generated/src/operations/queue.js.map +7 -1
- package/dist/esm/generated/src/operations/service.js +204 -192
- package/dist/esm/generated/src/operations/service.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/index.js +0 -8
- package/dist/esm/generated/src/operationsInterfaces/index.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/messageId.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/messageId.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/messages.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/messages.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/queue.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/queue.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/service.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/service.js.map +7 -1
- package/dist/esm/generated/src/storageClient.js +49 -54
- package/dist/esm/generated/src/storageClient.js.map +7 -1
- package/dist/esm/generatedModels.d.ts +2 -2
- package/dist/esm/generatedModels.d.ts.map +1 -1
- package/dist/esm/generatedModels.js +0 -4
- package/dist/esm/generatedModels.js.map +7 -1
- package/dist/esm/index.d.ts +9 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +50 -11
- package/dist/esm/index.js.map +7 -1
- package/dist/esm/log.js +4 -7
- package/dist/esm/log.js.map +7 -1
- package/dist/esm/models.js +10 -18
- package/dist/esm/models.js.map +7 -1
- package/dist/esm/utils/constants.d.ts.map +1 -1
- package/dist/esm/utils/constants.js +117 -111
- package/dist/esm/utils/constants.js.map +7 -1
- package/dist/esm/utils/tracing.js +7 -11
- package/dist/esm/utils/tracing.js.map +7 -1
- package/dist/esm/utils/utils.common.js +247 -358
- package/dist/esm/utils/utils.common.js.map +7 -1
- package/dist/react-native/Pipeline.d.ts +2 -3
- package/dist/react-native/Pipeline.d.ts.map +1 -1
- package/dist/react-native/Pipeline.js.map +1 -1
- package/dist/react-native/QueueClient.d.ts +2 -1
- package/dist/react-native/QueueClient.d.ts.map +1 -1
- package/dist/react-native/QueueClient.js.map +1 -1
- package/dist/react-native/QueueSASSignatureValues.d.ts +2 -1
- package/dist/react-native/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/react-native/QueueSASSignatureValues.js +2 -2
- package/dist/react-native/QueueSASSignatureValues.js.map +1 -1
- package/dist/react-native/QueueServiceClient.d.ts +28 -0
- package/dist/react-native/QueueServiceClient.d.ts.map +1 -1
- package/dist/react-native/QueueServiceClient.js +21 -13
- package/dist/react-native/QueueServiceClient.js.map +1 -1
- package/dist/react-native/SASQueryParameters.d.ts +6 -1
- package/dist/react-native/SASQueryParameters.d.ts.map +1 -1
- package/dist/react-native/SASQueryParameters.js +10 -0
- package/dist/react-native/SASQueryParameters.js.map +1 -1
- package/dist/react-native/generated/src/models/index.d.ts +4 -0
- package/dist/react-native/generated/src/models/index.d.ts.map +1 -1
- package/dist/react-native/generated/src/models/index.js.map +1 -1
- package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/react-native/generated/src/models/mappers.js +14 -0
- package/dist/react-native/generated/src/models/mappers.js.map +1 -1
- package/dist/react-native/generated/src/models/parameters.js +1 -1
- package/dist/react-native/generated/src/models/parameters.js.map +1 -1
- package/dist/react-native/generated/src/storageClient.js +2 -2
- package/dist/react-native/generated/src/storageClient.js.map +1 -1
- package/dist/react-native/generatedModels.d.ts +2 -2
- package/dist/react-native/generatedModels.d.ts.map +1 -1
- package/dist/react-native/generatedModels.js.map +1 -1
- package/dist/react-native/index.d.ts +9 -9
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +0 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/utils/constants.d.ts.map +1 -1
- package/dist/react-native/utils/constants.js +2 -2
- package/dist/react-native/utils/constants.js.map +1 -1
- package/package.json +2 -19
- package/dist/browser/index-browser.d.mts.map +0 -1
- package/dist/browser/index-browser.mjs.map +0 -1
|
@@ -1,483 +1,533 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
1
|
import { isTokenCredential } from "@azure/core-auth";
|
|
4
2
|
import { isNodeLike } from "@azure/core-util";
|
|
5
3
|
import { newPipeline, isPipelineLike } from "./Pipeline.js";
|
|
6
4
|
import { StorageClient } from "./StorageClient.js";
|
|
7
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
appendToURLPath,
|
|
7
|
+
appendToURLQuery,
|
|
8
|
+
extractConnectionStringParts,
|
|
9
|
+
assertResponse,
|
|
10
|
+
truncatedISO8061Date
|
|
11
|
+
} from "./utils/utils.common.js";
|
|
8
12
|
import { StorageSharedKeyCredential } from "@azure/storage-common";
|
|
9
13
|
import { AnonymousCredential } from "@azure/storage-common";
|
|
10
14
|
import { tracingClient } from "./utils/tracing.js";
|
|
11
15
|
import { QueueClient } from "./QueueClient.js";
|
|
12
16
|
import { AccountSASPermissions } from "./AccountSASPermissions.js";
|
|
13
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
generateAccountSASQueryParameters,
|
|
19
|
+
generateAccountSASQueryParametersInternal
|
|
20
|
+
} from "./AccountSASSignatureValues.js";
|
|
14
21
|
import { AccountSASServices } from "./AccountSASServices.js";
|
|
15
22
|
import { getDefaultProxySettings } from "@azure/core-rest-pipeline";
|
|
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
|
-
else {
|
|
49
|
-
throw new Error("Account connection string is only supported in Node.js environment");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else if (extractedCreds.kind === "SASConnString") {
|
|
53
|
-
const pipeline = newPipeline(new AnonymousCredential(), options);
|
|
54
|
-
return new QueueServiceClient(extractedCreds.url + "?" + extractedCreds.accountSas, pipeline);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new Error("Connection string must be either an Account connection string or a SAS connection string");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* serviceContext provided by protocol layer.
|
|
62
|
-
*/
|
|
63
|
-
serviceContext;
|
|
64
|
-
constructor(url, credentialOrPipeline,
|
|
65
|
-
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
66
|
-
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
67
|
-
options) {
|
|
68
|
-
let pipeline;
|
|
69
|
-
if (isPipelineLike(credentialOrPipeline)) {
|
|
70
|
-
pipeline = credentialOrPipeline;
|
|
71
|
-
}
|
|
72
|
-
else if ((isNodeLike && credentialOrPipeline instanceof StorageSharedKeyCredential) ||
|
|
73
|
-
credentialOrPipeline instanceof AnonymousCredential ||
|
|
74
|
-
isTokenCredential(credentialOrPipeline)) {
|
|
75
|
-
pipeline = newPipeline(credentialOrPipeline, options);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
// The second parameter is undefined. Use anonymous credential.
|
|
79
|
-
pipeline = newPipeline(new AnonymousCredential(), options);
|
|
80
|
-
}
|
|
81
|
-
super(url, pipeline);
|
|
82
|
-
this.serviceContext = this.storageClientContext.service;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Creates a {@link QueueClient} object.
|
|
86
|
-
*
|
|
87
|
-
* @param queueName -
|
|
88
|
-
* @returns a new QueueClient
|
|
89
|
-
*
|
|
90
|
-
* Example usage:
|
|
91
|
-
*
|
|
92
|
-
* ```ts snippet:ReadmeSampleCreateQueue
|
|
93
|
-
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
94
|
-
* import { DefaultAzureCredential } from "@azure/identity";
|
|
95
|
-
*
|
|
96
|
-
* const account = "<account>";
|
|
97
|
-
* const queueServiceClient = new QueueServiceClient(
|
|
98
|
-
* `https://${account}.queue.core.windows.net`,
|
|
99
|
-
* new DefaultAzureCredential(),
|
|
100
|
-
* );
|
|
101
|
-
*
|
|
102
|
-
* const queueName = "<valid queue name>";
|
|
103
|
-
* const queueClient = queueServiceClient.getQueueClient(queueName);
|
|
104
|
-
* const createQueueResponse = await queueClient.create();
|
|
105
|
-
* console.log(
|
|
106
|
-
* `Created queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`,
|
|
107
|
-
* );
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
getQueueClient(queueName) {
|
|
111
|
-
return new QueueClient(appendToURLPath(this.url, queueName), this.pipeline);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Returns a list of the queues under the specified account.
|
|
115
|
-
* @see https://learn.microsoft.com/rest/api/storageservices/list-queues1
|
|
116
|
-
*
|
|
117
|
-
* @param marker - A string value that identifies the portion of
|
|
118
|
-
* the list of queues to be returned with the next listing operation. The
|
|
119
|
-
* operation returns the continuationToken value within the response body if the
|
|
120
|
-
* listing operation did not return all queues remaining to be listed
|
|
121
|
-
* with the current page. The continuationToken value can be used as the value for
|
|
122
|
-
* the marker parameter in a subsequent call to request the next page of list
|
|
123
|
-
* items. The marker value is opaque to the client.
|
|
124
|
-
* @param options - Options to list queues operation.
|
|
125
|
-
* @returns Response data for the list queues segment operation.
|
|
126
|
-
*/
|
|
127
|
-
async listQueuesSegment(marker, options = {}) {
|
|
128
|
-
if (options.prefix === "") {
|
|
129
|
-
options.prefix = undefined;
|
|
23
|
+
function isQueueGetUserDelegationKeyParameters(parameter) {
|
|
24
|
+
if (!parameter || typeof parameter !== "object") {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const castParameter = parameter;
|
|
28
|
+
return castParameter.expiresOn instanceof Date;
|
|
29
|
+
}
|
|
30
|
+
class QueueServiceClient extends StorageClient {
|
|
31
|
+
/**
|
|
32
|
+
* Creates an instance of QueueServiceClient.
|
|
33
|
+
*
|
|
34
|
+
* @param connectionString - Account connection string or a SAS connection string of an Azure storage account.
|
|
35
|
+
* [ Note - Account connection string can only be used in NODE.JS runtime. ]
|
|
36
|
+
* Account connection string example -
|
|
37
|
+
* `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
|
|
38
|
+
* SAS connection string example -
|
|
39
|
+
* `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
|
|
40
|
+
* @param options - Options to configure the HTTP pipeline.
|
|
41
|
+
* @returns A new QueueServiceClient object from the given connection string.
|
|
42
|
+
*/
|
|
43
|
+
static fromConnectionString(connectionString, options) {
|
|
44
|
+
options = options || {};
|
|
45
|
+
const extractedCreds = extractConnectionStringParts(connectionString);
|
|
46
|
+
if (extractedCreds.kind === "AccountConnString") {
|
|
47
|
+
if (isNodeLike) {
|
|
48
|
+
const sharedKeyCredential = new StorageSharedKeyCredential(
|
|
49
|
+
extractedCreds.accountName,
|
|
50
|
+
extractedCreds.accountKey
|
|
51
|
+
);
|
|
52
|
+
if (!options.proxyOptions) {
|
|
53
|
+
options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
|
|
130
54
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
55
|
+
const pipeline = newPipeline(sharedKeyCredential, options);
|
|
56
|
+
return new QueueServiceClient(extractedCreds.url, pipeline);
|
|
57
|
+
} else {
|
|
58
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
|
59
|
+
}
|
|
60
|
+
} else if (extractedCreds.kind === "SASConnString") {
|
|
61
|
+
const pipeline = newPipeline(new AnonymousCredential(), options);
|
|
62
|
+
return new QueueServiceClient(extractedCreds.url + "?" + extractedCreds.accountSas, pipeline);
|
|
63
|
+
} else {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"Connection string must be either an Account connection string or a SAS connection string"
|
|
66
|
+
);
|
|
138
67
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (options.prefix === "") {
|
|
153
|
-
options.prefix = undefined;
|
|
154
|
-
}
|
|
155
|
-
let listQueuesResponse;
|
|
156
|
-
do {
|
|
157
|
-
listQueuesResponse = await this.listQueuesSegment(marker, options);
|
|
158
|
-
marker = listQueuesResponse.continuationToken;
|
|
159
|
-
yield await listQueuesResponse;
|
|
160
|
-
} while (marker);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* serviceContext provided by protocol layer.
|
|
71
|
+
*/
|
|
72
|
+
serviceContext;
|
|
73
|
+
constructor(url, credentialOrPipeline, options) {
|
|
74
|
+
let pipeline;
|
|
75
|
+
if (isPipelineLike(credentialOrPipeline)) {
|
|
76
|
+
pipeline = credentialOrPipeline;
|
|
77
|
+
} else if (isNodeLike && credentialOrPipeline instanceof StorageSharedKeyCredential || credentialOrPipeline instanceof AnonymousCredential || isTokenCredential(credentialOrPipeline)) {
|
|
78
|
+
pipeline = newPipeline(credentialOrPipeline, options);
|
|
79
|
+
} else {
|
|
80
|
+
pipeline = newPipeline(new AnonymousCredential(), options);
|
|
161
81
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
82
|
+
super(url, pipeline);
|
|
83
|
+
this.serviceContext = this.storageClientContext.service;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates a {@link QueueClient} object.
|
|
87
|
+
*
|
|
88
|
+
* @param queueName -
|
|
89
|
+
* @returns a new QueueClient
|
|
90
|
+
*
|
|
91
|
+
* Example usage:
|
|
92
|
+
*
|
|
93
|
+
* ```ts snippet:ReadmeSampleCreateQueue
|
|
94
|
+
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
95
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
96
|
+
*
|
|
97
|
+
* const account = "<account>";
|
|
98
|
+
* const queueServiceClient = new QueueServiceClient(
|
|
99
|
+
* `https://${account}.queue.core.windows.net`,
|
|
100
|
+
* new DefaultAzureCredential(),
|
|
101
|
+
* );
|
|
102
|
+
*
|
|
103
|
+
* const queueName = "<valid queue name>";
|
|
104
|
+
* const queueClient = queueServiceClient.getQueueClient(queueName);
|
|
105
|
+
* const createQueueResponse = await queueClient.create();
|
|
106
|
+
* console.log(
|
|
107
|
+
* `Created queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`,
|
|
108
|
+
* );
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
getQueueClient(queueName) {
|
|
112
|
+
return new QueueClient(appendToURLPath(this.url, queueName), this.pipeline);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns a list of the queues under the specified account.
|
|
116
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/list-queues1
|
|
117
|
+
*
|
|
118
|
+
* @param marker - A string value that identifies the portion of
|
|
119
|
+
* the list of queues to be returned with the next listing operation. The
|
|
120
|
+
* operation returns the continuationToken value within the response body if the
|
|
121
|
+
* listing operation did not return all queues remaining to be listed
|
|
122
|
+
* with the current page. The continuationToken value can be used as the value for
|
|
123
|
+
* the marker parameter in a subsequent call to request the next page of list
|
|
124
|
+
* items. The marker value is opaque to the client.
|
|
125
|
+
* @param options - Options to list queues operation.
|
|
126
|
+
* @returns Response data for the list queues segment operation.
|
|
127
|
+
*/
|
|
128
|
+
async listQueuesSegment(marker, options = {}) {
|
|
129
|
+
if (options.prefix === "") {
|
|
130
|
+
options.prefix = void 0;
|
|
177
131
|
}
|
|
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
|
-
* const account = "<account>";
|
|
209
|
-
* const queueServiceClient = new QueueServiceClient(
|
|
210
|
-
* `https://${account}.queue.core.windows.net`,
|
|
211
|
-
* new DefaultAzureCredential(),
|
|
212
|
-
* );
|
|
213
|
-
*
|
|
214
|
-
* let i = 1;
|
|
215
|
-
* const iterator = queueServiceClient.listQueues();
|
|
216
|
-
* let { done, value } = await iterator.next();
|
|
217
|
-
* while (!done) {
|
|
218
|
-
* console.log(`Queue${i++}: ${value.name}`);
|
|
219
|
-
* ({ done, value } = await iterator.next());
|
|
220
|
-
* }
|
|
221
|
-
* ```
|
|
222
|
-
*
|
|
223
|
-
* Example using `byPage()`:
|
|
224
|
-
*
|
|
225
|
-
* ```ts snippet:ReadmeSampleListQueues_ByPage
|
|
226
|
-
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
227
|
-
* import { DefaultAzureCredential } from "@azure/identity";
|
|
228
|
-
*
|
|
229
|
-
* const account = "<account>";
|
|
230
|
-
* const queueServiceClient = new QueueServiceClient(
|
|
231
|
-
* `https://${account}.queue.core.windows.net`,
|
|
232
|
-
* new DefaultAzureCredential(),
|
|
233
|
-
* );
|
|
234
|
-
*
|
|
235
|
-
* let i = 1;
|
|
236
|
-
* for await (const page of queueServiceClient.listQueues().byPage({ maxPageSize: 20 })) {
|
|
237
|
-
* for (const item of page.queueItems || []) {
|
|
238
|
-
* console.log(`Queue${i++}: ${item.name}`);
|
|
239
|
-
* }
|
|
240
|
-
* }
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* Example using paging with a marker:
|
|
244
|
-
*
|
|
245
|
-
* ```ts snippet:ReadmeSampleListQueues_Continuation
|
|
246
|
-
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
247
|
-
* import { DefaultAzureCredential } from "@azure/identity";
|
|
248
|
-
*
|
|
249
|
-
* const account = "<account>";
|
|
250
|
-
* const queueServiceClient = new QueueServiceClient(
|
|
251
|
-
* `https://${account}.queue.core.windows.net`,
|
|
252
|
-
* new DefaultAzureCredential(),
|
|
253
|
-
* );
|
|
254
|
-
*
|
|
255
|
-
* let i = 1;
|
|
256
|
-
* let iterator = queueServiceClient.listQueues().byPage({ maxPageSize: 2 });
|
|
257
|
-
* let response = (await iterator.next()).value;
|
|
258
|
-
* // Prints 2 queues
|
|
259
|
-
* if (response.queueItems) {
|
|
260
|
-
* for (const item of response.queueItems) {
|
|
261
|
-
* console.log(`Queue${i++}: ${item.name}`);
|
|
262
|
-
* }
|
|
263
|
-
* }
|
|
264
|
-
* // Gets next marker
|
|
265
|
-
* let marker = response.continuationToken;
|
|
266
|
-
* // Passing next marker as continuationToken
|
|
267
|
-
* iterator = queueServiceClient.listQueues().byPage({ continuationToken: marker, maxPageSize: 10 });
|
|
268
|
-
* response = (await iterator.next()).value;
|
|
269
|
-
* // Prints 10 queues
|
|
270
|
-
* if (response.queueItems) {
|
|
271
|
-
* for (const item of response.queueItems) {
|
|
272
|
-
* console.log(`Queue${i++}: ${item.name}`);
|
|
273
|
-
* }
|
|
274
|
-
* }
|
|
275
|
-
* ```
|
|
276
|
-
*
|
|
277
|
-
* @param options - Options to list queues operation.
|
|
278
|
-
* @returns An asyncIterableIterator that supports paging.
|
|
279
|
-
*/
|
|
280
|
-
listQueues(options = {}) {
|
|
281
|
-
if (options.prefix === "") {
|
|
282
|
-
options.prefix = undefined;
|
|
283
|
-
}
|
|
284
|
-
const updatedOptions = {
|
|
285
|
-
...options,
|
|
286
|
-
...(options.includeMetadata ? { include: "metadata" } : {}),
|
|
287
|
-
};
|
|
288
|
-
// AsyncIterableIterator to iterate over queues
|
|
289
|
-
const iter = this.listItems(updatedOptions);
|
|
290
|
-
return {
|
|
291
|
-
/**
|
|
292
|
-
* The next method, part of the iteration protocol
|
|
293
|
-
*/
|
|
294
|
-
next() {
|
|
295
|
-
return iter.next();
|
|
296
|
-
},
|
|
297
|
-
/**
|
|
298
|
-
* The connection to the async iterator, part of the iteration protocol
|
|
299
|
-
*/
|
|
300
|
-
[Symbol.asyncIterator]() {
|
|
301
|
-
return this;
|
|
302
|
-
},
|
|
303
|
-
/**
|
|
304
|
-
* Return an AsyncIterableIterator that works a page at a time
|
|
305
|
-
*/
|
|
306
|
-
byPage: (settings = {}) => {
|
|
307
|
-
return this.listSegments(settings.continuationToken, {
|
|
308
|
-
maxPageSize: settings.maxPageSize,
|
|
309
|
-
...updatedOptions,
|
|
310
|
-
});
|
|
311
|
-
},
|
|
312
|
-
};
|
|
132
|
+
return tracingClient.withSpan(
|
|
133
|
+
"QueueServiceClient-listQueuesSegment",
|
|
134
|
+
options,
|
|
135
|
+
async (updatedOptions) => {
|
|
136
|
+
return assertResponse(
|
|
137
|
+
await this.serviceContext.listQueuesSegment({
|
|
138
|
+
...updatedOptions,
|
|
139
|
+
marker,
|
|
140
|
+
include: options.include === void 0 ? void 0 : [options.include]
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Returns an AsyncIterableIterator for {@link ServiceListQueuesSegmentResponse} objects
|
|
148
|
+
*
|
|
149
|
+
* @param marker - A string value that identifies the portion of
|
|
150
|
+
* the list of queues to be returned with the next listing operation. The
|
|
151
|
+
* operation returns the continuationToken value within the response body if the
|
|
152
|
+
* listing operation did not return all queues remaining to be listed
|
|
153
|
+
* with the current page. The continuationToken value can be used as the value for
|
|
154
|
+
* the marker parameter in a subsequent call to request the next page of list
|
|
155
|
+
* items. The marker value is opaque to the client.
|
|
156
|
+
* @param options - Options to list queues operation.
|
|
157
|
+
*/
|
|
158
|
+
async *listSegments(marker, options = {}) {
|
|
159
|
+
if (options.prefix === "") {
|
|
160
|
+
options.prefix = void 0;
|
|
313
161
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
162
|
+
let listQueuesResponse;
|
|
163
|
+
do {
|
|
164
|
+
listQueuesResponse = await this.listQueuesSegment(marker, options);
|
|
165
|
+
marker = listQueuesResponse.continuationToken;
|
|
166
|
+
yield await listQueuesResponse;
|
|
167
|
+
} while (marker);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Returns an AsyncIterableIterator for {@link QueueItem} objects
|
|
171
|
+
*
|
|
172
|
+
* @param options - Options to list queues operation.
|
|
173
|
+
*/
|
|
174
|
+
async *listItems(options = {}) {
|
|
175
|
+
if (options.prefix === "") {
|
|
176
|
+
options.prefix = void 0;
|
|
326
177
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
* @param properties -
|
|
333
|
-
* @param options - Options to set properties operation.
|
|
334
|
-
* @returns Response data for the Set Properties operation.
|
|
335
|
-
*/
|
|
336
|
-
async setProperties(properties, options = {}) {
|
|
337
|
-
return tracingClient.withSpan("QueueServiceClient-setProperties", options, async (updatedOptions) => {
|
|
338
|
-
return assertResponse(await this.serviceContext.setProperties(properties, updatedOptions));
|
|
339
|
-
});
|
|
178
|
+
let marker;
|
|
179
|
+
for await (const segment of this.listSegments(marker, options)) {
|
|
180
|
+
if (segment.queueItems) {
|
|
181
|
+
yield* segment.queueItems;
|
|
182
|
+
}
|
|
340
183
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Returns an async iterable iterator to list all the queues
|
|
187
|
+
* under the specified account.
|
|
188
|
+
*
|
|
189
|
+
* .byPage() returns an async iterable iterator to list the queues in pages.
|
|
190
|
+
*
|
|
191
|
+
* Example using `for await` syntax:
|
|
192
|
+
*
|
|
193
|
+
* ```ts snippet:ReadmeSampleListQueues
|
|
194
|
+
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
195
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
196
|
+
*
|
|
197
|
+
* const account = "<account>";
|
|
198
|
+
* const queueServiceClient = new QueueServiceClient(
|
|
199
|
+
* `https://${account}.queue.core.windows.net`,
|
|
200
|
+
* new DefaultAzureCredential(),
|
|
201
|
+
* );
|
|
202
|
+
*
|
|
203
|
+
* let i = 1;
|
|
204
|
+
* for await (const item of queueServiceClient.listQueues()) {
|
|
205
|
+
* console.log(`Queue${i++}: ${item.name}`);
|
|
206
|
+
* }
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* Example using `iter.next()`:
|
|
210
|
+
*
|
|
211
|
+
* ```ts snippet:ReadmeSampleListQueues_Iterator
|
|
212
|
+
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
213
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
214
|
+
*
|
|
215
|
+
* const account = "<account>";
|
|
216
|
+
* const queueServiceClient = new QueueServiceClient(
|
|
217
|
+
* `https://${account}.queue.core.windows.net`,
|
|
218
|
+
* new DefaultAzureCredential(),
|
|
219
|
+
* );
|
|
220
|
+
*
|
|
221
|
+
* let i = 1;
|
|
222
|
+
* const iterator = queueServiceClient.listQueues();
|
|
223
|
+
* let { done, value } = await iterator.next();
|
|
224
|
+
* while (!done) {
|
|
225
|
+
* console.log(`Queue${i++}: ${value.name}`);
|
|
226
|
+
* ({ done, value } = await iterator.next());
|
|
227
|
+
* }
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* Example using `byPage()`:
|
|
231
|
+
*
|
|
232
|
+
* ```ts snippet:ReadmeSampleListQueues_ByPage
|
|
233
|
+
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
234
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
235
|
+
*
|
|
236
|
+
* const account = "<account>";
|
|
237
|
+
* const queueServiceClient = new QueueServiceClient(
|
|
238
|
+
* `https://${account}.queue.core.windows.net`,
|
|
239
|
+
* new DefaultAzureCredential(),
|
|
240
|
+
* );
|
|
241
|
+
*
|
|
242
|
+
* let i = 1;
|
|
243
|
+
* for await (const page of queueServiceClient.listQueues().byPage({ maxPageSize: 20 })) {
|
|
244
|
+
* for (const item of page.queueItems || []) {
|
|
245
|
+
* console.log(`Queue${i++}: ${item.name}`);
|
|
246
|
+
* }
|
|
247
|
+
* }
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* Example using paging with a marker:
|
|
251
|
+
*
|
|
252
|
+
* ```ts snippet:ReadmeSampleListQueues_Continuation
|
|
253
|
+
* import { QueueServiceClient } from "@azure/storage-queue";
|
|
254
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
255
|
+
*
|
|
256
|
+
* const account = "<account>";
|
|
257
|
+
* const queueServiceClient = new QueueServiceClient(
|
|
258
|
+
* `https://${account}.queue.core.windows.net`,
|
|
259
|
+
* new DefaultAzureCredential(),
|
|
260
|
+
* );
|
|
261
|
+
*
|
|
262
|
+
* let i = 1;
|
|
263
|
+
* let iterator = queueServiceClient.listQueues().byPage({ maxPageSize: 2 });
|
|
264
|
+
* let response = (await iterator.next()).value;
|
|
265
|
+
* // Prints 2 queues
|
|
266
|
+
* if (response.queueItems) {
|
|
267
|
+
* for (const item of response.queueItems) {
|
|
268
|
+
* console.log(`Queue${i++}: ${item.name}`);
|
|
269
|
+
* }
|
|
270
|
+
* }
|
|
271
|
+
* // Gets next marker
|
|
272
|
+
* let marker = response.continuationToken;
|
|
273
|
+
* // Passing next marker as continuationToken
|
|
274
|
+
* iterator = queueServiceClient.listQueues().byPage({ continuationToken: marker, maxPageSize: 10 });
|
|
275
|
+
* response = (await iterator.next()).value;
|
|
276
|
+
* // Prints 10 queues
|
|
277
|
+
* if (response.queueItems) {
|
|
278
|
+
* for (const item of response.queueItems) {
|
|
279
|
+
* console.log(`Queue${i++}: ${item.name}`);
|
|
280
|
+
* }
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @param options - Options to list queues operation.
|
|
285
|
+
* @returns An asyncIterableIterator that supports paging.
|
|
286
|
+
*/
|
|
287
|
+
listQueues(options = {}) {
|
|
288
|
+
if (options.prefix === "") {
|
|
289
|
+
options.prefix = void 0;
|
|
354
290
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
291
|
+
const updatedOptions = {
|
|
292
|
+
...options,
|
|
293
|
+
...options.includeMetadata ? { include: "metadata" } : {}
|
|
294
|
+
};
|
|
295
|
+
const iter = this.listItems(updatedOptions);
|
|
296
|
+
return {
|
|
297
|
+
/**
|
|
298
|
+
* The next method, part of the iteration protocol
|
|
299
|
+
*/
|
|
300
|
+
next() {
|
|
301
|
+
return iter.next();
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* The connection to the async iterator, part of the iteration protocol
|
|
305
|
+
*/
|
|
306
|
+
[Symbol.asyncIterator]() {
|
|
307
|
+
return this;
|
|
308
|
+
},
|
|
309
|
+
/**
|
|
310
|
+
* Return an AsyncIterableIterator that works a page at a time
|
|
311
|
+
*/
|
|
312
|
+
byPage: (settings = {}) => {
|
|
313
|
+
return this.listSegments(settings.continuationToken, {
|
|
314
|
+
maxPageSize: settings.maxPageSize,
|
|
315
|
+
...updatedOptions
|
|
366
316
|
});
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Gets the properties of a storage account’s Queue service, including properties
|
|
322
|
+
* for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
|
|
323
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-properties
|
|
324
|
+
*
|
|
325
|
+
* @param options - Options to get properties operation.
|
|
326
|
+
* @returns Response data including the queue service properties.
|
|
327
|
+
*/
|
|
328
|
+
async getProperties(options = {}) {
|
|
329
|
+
return tracingClient.withSpan(
|
|
330
|
+
"QueueServiceClient-getProperties",
|
|
331
|
+
options,
|
|
332
|
+
async (updatedOptions) => {
|
|
333
|
+
return assertResponse(await this.serviceContext.getProperties(updatedOptions));
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Sets properties for a storage account’s Queue service endpoint, including properties
|
|
339
|
+
* for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings.
|
|
340
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-queue-service-properties
|
|
341
|
+
*
|
|
342
|
+
* @param properties -
|
|
343
|
+
* @param options - Options to set properties operation.
|
|
344
|
+
* @returns Response data for the Set Properties operation.
|
|
345
|
+
*/
|
|
346
|
+
async setProperties(properties, options = {}) {
|
|
347
|
+
return tracingClient.withSpan(
|
|
348
|
+
"QueueServiceClient-setProperties",
|
|
349
|
+
options,
|
|
350
|
+
async (updatedOptions) => {
|
|
351
|
+
return assertResponse(
|
|
352
|
+
await this.serviceContext.setProperties(properties, updatedOptions)
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Retrieves statistics related to replication for the Queue service. It is only
|
|
359
|
+
* available on the secondary location endpoint when read-access geo-redundant
|
|
360
|
+
* replication is enabled for the storage account.
|
|
361
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-stats
|
|
362
|
+
*
|
|
363
|
+
* @param options - Options to get statistics operation.
|
|
364
|
+
* @returns Response data for get statistics the operation.
|
|
365
|
+
*/
|
|
366
|
+
async getStatistics(options = {}) {
|
|
367
|
+
return tracingClient.withSpan(
|
|
368
|
+
"QueueServiceClient-getStatistics",
|
|
369
|
+
options,
|
|
370
|
+
async (updatedOptions) => {
|
|
371
|
+
return assertResponse(await this.serviceContext.getStatistics(updatedOptions));
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Creates a new queue under the specified account.
|
|
377
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-queue4
|
|
378
|
+
*
|
|
379
|
+
* @param queueName - name of the queue to create
|
|
380
|
+
* @param options - Options to Queue create operation.
|
|
381
|
+
* @returns Response data for the Queue create operation.
|
|
382
|
+
*/
|
|
383
|
+
async createQueue(queueName, options = {}) {
|
|
384
|
+
return tracingClient.withSpan(
|
|
385
|
+
"QueueServiceClient-createQueue",
|
|
386
|
+
options,
|
|
387
|
+
async (updatedOptions) => {
|
|
388
|
+
return this.getQueueClient(queueName).create(updatedOptions);
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Deletes the specified queue permanently.
|
|
394
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-queue3
|
|
395
|
+
*
|
|
396
|
+
* @param queueName - name of the queue to delete.
|
|
397
|
+
* @param options - Options to Queue delete operation.
|
|
398
|
+
* @returns Response data for the Queue delete operation.
|
|
399
|
+
*/
|
|
400
|
+
async deleteQueue(queueName, options = {}) {
|
|
401
|
+
return tracingClient.withSpan(
|
|
402
|
+
"QueueServiceClient-deleteQueue",
|
|
403
|
+
options,
|
|
404
|
+
async (updatedOptions) => {
|
|
405
|
+
return this.getQueueClient(queueName).delete(updatedOptions);
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Only available for QueueServiceClient constructed with a shared key credential.
|
|
411
|
+
*
|
|
412
|
+
* Generates an account Shared Access Signature (SAS) URI based on the client properties
|
|
413
|
+
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
|
414
|
+
*
|
|
415
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
|
|
416
|
+
*
|
|
417
|
+
* @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
|
|
418
|
+
* @param permissions - Specifies the list of permissions to be associated with the SAS.
|
|
419
|
+
* @param resourceTypes - Specifies the resource types associated with the shared access signature.
|
|
420
|
+
* @param options - Optional parameters.
|
|
421
|
+
* @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
|
422
|
+
*/
|
|
423
|
+
generateAccountSasUrl(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
|
|
424
|
+
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
|
425
|
+
throw RangeError(
|
|
426
|
+
"Can only generate the account SAS when the client is initialized with a shared key credential"
|
|
427
|
+
);
|
|
367
428
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
*
|
|
372
|
-
* @param queueName - name of the queue to delete.
|
|
373
|
-
* @param options - Options to Queue delete operation.
|
|
374
|
-
* @returns Response data for the Queue delete operation.
|
|
375
|
-
*/
|
|
376
|
-
async deleteQueue(queueName, options = {}) {
|
|
377
|
-
return tracingClient.withSpan("QueueServiceClient-deleteQueue", options, async (updatedOptions) => {
|
|
378
|
-
return this.getQueueClient(queueName).delete(updatedOptions);
|
|
379
|
-
});
|
|
429
|
+
if (expiresOn === void 0) {
|
|
430
|
+
const now = /* @__PURE__ */ new Date();
|
|
431
|
+
expiresOn = new Date(now.getTime() + 3600 * 1e3);
|
|
380
432
|
}
|
|
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
|
-
|
|
433
|
+
const sas = generateAccountSASQueryParameters(
|
|
434
|
+
{
|
|
435
|
+
permissions,
|
|
436
|
+
expiresOn,
|
|
437
|
+
resourceTypes,
|
|
438
|
+
services: AccountSASServices.parse("q").toString(),
|
|
439
|
+
...options
|
|
440
|
+
},
|
|
441
|
+
this.credential
|
|
442
|
+
).toString();
|
|
443
|
+
return appendToURLQuery(this.url, sas);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Only available for QueueServiceClient constructed with a shared key credential.
|
|
447
|
+
*
|
|
448
|
+
* Generates string to sign for an account Shared Access Signature (SAS) URI based on the client properties
|
|
449
|
+
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
|
450
|
+
*
|
|
451
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
|
|
452
|
+
*
|
|
453
|
+
* @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
|
|
454
|
+
* @param permissions - Specifies the list of permissions to be associated with the SAS.
|
|
455
|
+
* @param resourceTypes - Specifies the resource types associated with the shared access signature.
|
|
456
|
+
* @param options - Optional parameters.
|
|
457
|
+
* @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
|
458
|
+
*/
|
|
459
|
+
generateSasStringToSign(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
|
|
460
|
+
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
|
461
|
+
throw RangeError(
|
|
462
|
+
"Can only generate the account SAS when the client is initialized with a shared key credential"
|
|
463
|
+
);
|
|
411
464
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
* Generates string to sign for an account Shared Access Signature (SAS) URI based on the client properties
|
|
416
|
-
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
|
417
|
-
*
|
|
418
|
-
* @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
|
|
419
|
-
*
|
|
420
|
-
* @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
|
|
421
|
-
* @param permissions - Specifies the list of permissions to be associated with the SAS.
|
|
422
|
-
* @param resourceTypes - Specifies the resource types associated with the shared access signature.
|
|
423
|
-
* @param options - Optional parameters.
|
|
424
|
-
* @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
|
425
|
-
*/
|
|
426
|
-
generateSasStringToSign(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
|
|
427
|
-
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
|
428
|
-
throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
|
|
429
|
-
}
|
|
430
|
-
if (expiresOn === undefined) {
|
|
431
|
-
const now = new Date();
|
|
432
|
-
expiresOn = new Date(now.getTime() + 3600 * 1000);
|
|
433
|
-
}
|
|
434
|
-
return generateAccountSASQueryParametersInternal({
|
|
435
|
-
permissions,
|
|
436
|
-
expiresOn,
|
|
437
|
-
resourceTypes,
|
|
438
|
-
services: AccountSASServices.parse("q").toString(),
|
|
439
|
-
...options,
|
|
440
|
-
}, this.credential).stringToSign;
|
|
465
|
+
if (expiresOn === void 0) {
|
|
466
|
+
const now = /* @__PURE__ */ new Date();
|
|
467
|
+
expiresOn = new Date(now.getTime() + 3600 * 1e3);
|
|
441
468
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
signedObjectId: response.signedObjectId,
|
|
464
|
-
signedTenantId: response.signedTenantId,
|
|
465
|
-
signedStartsOn: new Date(response.signedStartsOn),
|
|
466
|
-
signedExpiresOn: new Date(response.signedExpiresOn),
|
|
467
|
-
signedService: response.signedService,
|
|
468
|
-
signedVersion: response.signedVersion,
|
|
469
|
-
value: response.value,
|
|
470
|
-
};
|
|
471
|
-
const res = {
|
|
472
|
-
_response: response._response,
|
|
473
|
-
requestId: response.requestId,
|
|
474
|
-
clientRequestId: response.clientRequestId,
|
|
475
|
-
version: response.version,
|
|
476
|
-
date: response.date,
|
|
477
|
-
...userDelegationKey,
|
|
478
|
-
};
|
|
479
|
-
return res;
|
|
480
|
-
});
|
|
469
|
+
return generateAccountSASQueryParametersInternal(
|
|
470
|
+
{
|
|
471
|
+
permissions,
|
|
472
|
+
expiresOn,
|
|
473
|
+
resourceTypes,
|
|
474
|
+
services: AccountSASServices.parse("q").toString(),
|
|
475
|
+
...options
|
|
476
|
+
},
|
|
477
|
+
this.credential
|
|
478
|
+
).stringToSign;
|
|
479
|
+
}
|
|
480
|
+
async getUserDelegationKey(startsOnOrParam, expiresOnOrOption, options = {}) {
|
|
481
|
+
let startsOn = startsOnOrParam;
|
|
482
|
+
let expiresOn = expiresOnOrOption;
|
|
483
|
+
let userDelegationTid = void 0;
|
|
484
|
+
let getUserDelegationKeyOptions = options;
|
|
485
|
+
if (isQueueGetUserDelegationKeyParameters(startsOnOrParam)) {
|
|
486
|
+
startsOn = startsOnOrParam.startsOn;
|
|
487
|
+
expiresOn = startsOnOrParam.expiresOn;
|
|
488
|
+
userDelegationTid = startsOnOrParam.delegatedUserTenantId;
|
|
489
|
+
getUserDelegationKeyOptions = expiresOnOrOption;
|
|
481
490
|
}
|
|
491
|
+
return tracingClient.withSpan(
|
|
492
|
+
"QueueServiceClient-getUserDelegationKey",
|
|
493
|
+
getUserDelegationKeyOptions,
|
|
494
|
+
async (updatedOptions) => {
|
|
495
|
+
const response = assertResponse(
|
|
496
|
+
await this.serviceContext.getUserDelegationKey(
|
|
497
|
+
{
|
|
498
|
+
start: truncatedISO8061Date(startsOn, false),
|
|
499
|
+
expiry: truncatedISO8061Date(expiresOn, false),
|
|
500
|
+
delegatedUserTid: userDelegationTid
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
abortSignal: options.abortSignal,
|
|
504
|
+
tracingOptions: updatedOptions.tracingOptions
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
);
|
|
508
|
+
const userDelegationKey = {
|
|
509
|
+
signedObjectId: response.signedObjectId,
|
|
510
|
+
signedTenantId: response.signedTenantId,
|
|
511
|
+
signedStartsOn: new Date(response.signedStartsOn),
|
|
512
|
+
signedExpiresOn: new Date(response.signedExpiresOn),
|
|
513
|
+
signedService: response.signedService,
|
|
514
|
+
signedVersion: response.signedVersion,
|
|
515
|
+
signedDelegatedUserTenantId: response.signedDelegatedUserTenantId,
|
|
516
|
+
value: response.value
|
|
517
|
+
};
|
|
518
|
+
const res = {
|
|
519
|
+
_response: response._response,
|
|
520
|
+
requestId: response.requestId,
|
|
521
|
+
clientRequestId: response.clientRequestId,
|
|
522
|
+
version: response.version,
|
|
523
|
+
date: response.date,
|
|
524
|
+
...userDelegationKey
|
|
525
|
+
};
|
|
526
|
+
return res;
|
|
527
|
+
}
|
|
528
|
+
);
|
|
529
|
+
}
|
|
482
530
|
}
|
|
483
|
-
|
|
531
|
+
export {
|
|
532
|
+
QueueServiceClient
|
|
533
|
+
};
|