@azure/storage-queue
Version:
Microsoft Azure Storage SDK for JavaScript - Queue
1,032 lines (966 loc) • 131 kB
TypeScript
import type { AbortSignalLike } from '@azure/abort-controller';
import { AzureLogger } from '@azure/logger';
import * as coreClient from '@azure/core-client';
import * as coreHttpCompat from '@azure/core-http-compat';
import { HttpHeadersLike as HttpHeaders } from '@azure/core-http-compat';
import { CompatResponse as HttpOperationResponse } from '@azure/core-http-compat';
import type { HttpPipelineLogLevel } from '@azure/core-http-compat';
import { RequestBodyType as HttpRequestBody } from '@azure/core-rest-pipeline';
import type { KeepAliveOptions } from '@azure/core-http-compat';
import type { OperationTracingOptions } from '@azure/core-tracing';
import type { PagedAsyncIterableIterator } from '@azure/core-paging';
import type { ProxySettings } from '@azure/core-rest-pipeline';
import { RequestPolicy } from '@azure/core-http-compat';
import { RequestPolicyFactory } from '@azure/core-http-compat';
import { RequestPolicyOptionsLike as RequestPolicyOptions } from '@azure/core-http-compat';
import { RestError } from '@azure/core-rest-pipeline';
import type { TokenCredential } from '@azure/core-auth';
import type { UserAgentPolicyOptions } from '@azure/core-rest-pipeline';
import { WebResourceLike as WebResource } from '@azure/core-http-compat';
/** An Access policy */
export declare interface AccessPolicy {
/** the date-time the policy is active */
startsOn?: string;
/** the date-time the policy expires */
expiresOn?: string;
/** the permissions for the acl policy */
permissions?: string;
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* This is a helper class to construct a string representing the permissions granted by an AccountSAS. Setting a value
* to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the
* values are set, this should be serialized with toString and set as the permissions field on an
* {@link AccountSASSignatureValues} object. It is possible to construct the permissions string without this class, but
* the order of the permissions is particular and this class guarantees correctness.
*/
export declare class AccountSASPermissions {
/**
* Parse initializes the AccountSASPermissions fields from a string.
*
* @param permissions -
*/
static parse(permissions: string): AccountSASPermissions;
/**
* Permission to read resources granted.
*/
read: boolean;
/**
* Permission to write resources granted.
*/
write: boolean;
/**
* Permission to delete queues and messages granted.
*/
delete: boolean;
/**
* Permission to list queues granted.
*/
list: boolean;
/**
* Permission to add messages, table entities, and append to blobs granted.
*/
add: boolean;
/**
* Permission to create queues, blobs and files granted.
*/
create: boolean;
/**
* Permissions to update messages and table entities granted.
*/
update: boolean;
/**
* Permission to get and delete messages granted.
*/
process: boolean;
/**
* Produces the SAS permissions string for an Azure Storage account.
* Call this method to set AccountSASSignatureValues Permissions field.
*
* Using this method will guarantee the resource types are in
* an order accepted by the service.
*
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
*
*/
toString(): string;
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* This is a helper class to construct a string representing the resources accessible by an AccountSAS. Setting a value
* to true means that any SAS which uses these permissions will grant access to that resource type. Once all the
* values are set, this should be serialized with toString and set as the resources field on an
* {@link AccountSASSignatureValues} object. It is possible to construct the resources string without this class, but
* the order of the resources is particular and this class guarantees correctness.
*/
export declare class AccountSASResourceTypes {
/**
* Creates an {@link AccountSASResourceTypes} from the specified resource types string. This method will throw an
* Error if it encounters a character that does not correspond to a valid resource type.
*
* @param resourceTypes -
*/
static parse(resourceTypes: string): AccountSASResourceTypes;
/**
* Permission to access service level APIs granted.
*/
service: boolean;
/**
* Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted.
*/
container: boolean;
/**
* Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted.
*/
object: boolean;
/**
* Converts the given resource types to a string.
*
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
*
*/
toString(): string;
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* This is a helper class to construct a string representing the services accessible by an AccountSAS. Setting a value
* to true means that any SAS which uses these permissions will grant access to that service. Once all the
* values are set, this should be serialized with toString and set as the services field on an
* {@link AccountSASSignatureValues} object. It is possible to construct the services string without this class, but
* the order of the services is particular and this class guarantees correctness.
*/
export declare class AccountSASServices {
/**
* Creates an {@link AccountSASServices} from the specified services string. This method will throw an
* Error if it encounters a character that does not correspond to a valid service.
*
* @param services -
*/
static parse(services: string): AccountSASServices;
/**
* Permission to access blob resources granted.
*/
blob: boolean;
/**
* Permission to access file resources granted.
*/
file: boolean;
/**
* Permission to access queue resources granted.
*/
queue: boolean;
/**
* Permission to access table resources granted.
*/
table: boolean;
/**
* Converts the given services to a string.
*
*/
toString(): string;
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once
* all the values here are set appropriately, call generateSASQueryParameters() to obtain a representation of the SAS
* which can actually be applied to queue urls. Note: that both this class and {@link SASQueryParameters} exist because
* the former is mutable and a logical representation while the latter is immutable and used to generate actual REST
* requests.
*
* @see https://learn.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1
* for more conceptual information on SAS
*
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
* for descriptions of the parameters, including which are required
*/
export declare interface AccountSASSignatureValues {
/**
* If not provided, this defaults to the service version targeted by this version of the library.
*/
version?: string;
/**
* Optional. SAS protocols allowed.
*/
protocol?: SASProtocol;
/**
* Optional. When the SAS will take effect.
*/
startsOn?: Date;
/**
* The time after which the SAS will no longer work.
*/
expiresOn: Date;
/**
* Specifies which operations the SAS user may perform. Please refer to {@link AccountSASPermissions} for help
* constructing the permissions string.
*/
permissions: AccountSASPermissions;
/**
* Optional. IP range allowed.
*/
ipRange?: SasIPRange;
/**
* The values that indicate the services accessible with this SAS. Please refer to {@link AccountSASServices} to
* construct this value.
*/
services: string;
/**
* The values that indicate the resource types accessible with this SAS. Please refer
* to {@link AccountSASResourceTypes} to construct this value.
*/
resourceTypes: string;
}
/**
* AnonymousCredential provides a credentialPolicyCreator member used to create
* AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with
* HTTP(S) requests that read public resources or for use with Shared Access
* Signatures (SAS).
*/
export declare class AnonymousCredential extends Credential_2 {
/**
* Creates an {@link AnonymousCredentialPolicy} object.
*
* @param nextPolicy -
* @param options -
*/
create(nextPolicy: RequestPolicy, options: RequestPolicyOptions): AnonymousCredentialPolicy;
}
/**
* AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources
* or for use with Shared Access Signatures (SAS).
*/
export declare class AnonymousCredentialPolicy extends CredentialPolicy {
/**
* Creates an instance of AnonymousCredentialPolicy.
* @param nextPolicy -
* @param options -
*/
constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions);
}
/**
* The base class from which all request policies derive.
*/
export declare abstract class BaseRequestPolicy implements RequestPolicy {
/**
* The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline.
*/
readonly _nextPolicy: RequestPolicy;
/**
* The options that can be passed to a given request policy.
*/
readonly _options: RequestPolicyOptions;
/**
* The main method to implement that manipulates a request/response.
*/
protected constructor(
/**
* The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline.
*/
_nextPolicy: RequestPolicy,
/**
* The options that can be passed to a given request policy.
*/
_options: RequestPolicyOptions);
/**
* Sends a network request based on the given web resource.
* @param webResource - A {@link WebResourceLike} that describes a HTTP request to be made.
*/
abstract sendRequest(webResource: WebResource): Promise<HttpOperationResponse>;
/**
* Get whether or not a log with the provided log level should be logged.
* @param logLevel - The log level of the log that will be logged.
* @returns Whether or not a log with the provided log level should be logged.
*/
shouldLog(logLevel: HttpPipelineLogLevel): boolean;
/**
* Attempt to log the provided message to the provided logger. If no logger was provided or if
* the log level does not meat the logger's threshold, then nothing will be logged.
* @param logLevel - The log level of this log.
* @param message - The message of this log.
*/
log(logLevel: HttpPipelineLogLevel, message: string): void;
}
/**
* An interface for options common to every remote operation.
*/
export declare interface CommonOptions {
/**
* Options to configure spans created when tracing is enabled.
*/
tracingOptions?: OperationTracingOptions;
}
/** CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain */
export declare interface CorsRule {
/** The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. */
allowedOrigins: string;
/** The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) */
allowedMethods: string;
/** the request headers that the origin domain may specify on the CORS request. */
allowedHeaders: string;
/** The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer */
exposedHeaders: string;
/** The maximum amount time that a browser should cache the preflight OPTIONS request. */
maxAgeInSeconds: number;
}
/**
* Credential is an abstract class for Azure Storage HTTP requests signing. This
* class will host an credentialPolicyCreator factory which generates CredentialPolicy.
*/
declare abstract class Credential_2 implements RequestPolicyFactory {
/**
* Creates a RequestPolicy object.
*
* @param _nextPolicy -
* @param _options -
*/
create(_nextPolicy: RequestPolicy, _options: RequestPolicyOptions): RequestPolicy;
}
export { Credential_2 as Credential }
/**
* Credential policy used to sign HTTP(S) requests before sending. This is an
* abstract class.
*/
export declare abstract class CredentialPolicy extends BaseRequestPolicy {
/**
* Sends out request.
*
* @param request -
*/
sendRequest(request: WebResource): Promise<HttpOperationResponse>;
/**
* Child classes must implement this method with request signing. This method
* will be executed in {@link sendRequest}.
*
* @param request -
*/
protected signRequest(request: WebResource): WebResource;
}
/**
* A factory function that creates a new CredentialPolicy that uses the provided nextPolicy.
*/
export declare type CredentialPolicyCreator = (nextPolicy: RequestPolicy, options: RequestPolicyOptions) => CredentialPolicy;
/** The object returned in the QueueMessageList array when calling Get Messages on a Queue. */
export declare interface DequeuedMessageItem {
/** The Id of the Message. */
messageId: string;
/** The time the Message was inserted into the Queue. */
insertedOn: Date;
/** The time that the Message will expire and be automatically deleted. */
expiresOn: Date;
/** This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client. */
popReceipt: string;
/** The time that the message will again become visible in the Queue. */
nextVisibleOn: Date;
/** The number of times the message has been dequeued. */
dequeueCount: number;
/** The content of the Message. */
messageText: string;
}
/** The object returned in the QueueMessageList array when calling Put Message on a Queue */
export declare interface EnqueuedMessage {
/** The Id of the Message. */
messageId: string;
/** The time the Message was inserted into the Queue. */
insertedOn: Date;
/** The time that the Message will expire and be automatically deleted. */
expiresOn: Date;
/** This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client. */
popReceipt: string;
/** The time that the message will again become visible in the Queue. */
nextVisibleOn: Date;
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* Generates a {@link SASQueryParameters} object which contains all SAS query parameters needed to make an actual
* REST request.
*
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
*
* @param accountSASSignatureValues - SAS Signature values of the account
* @param sharedKeyCredential - Shared key credential.
*/
export declare function generateAccountSASQueryParameters(accountSASSignatureValues: AccountSASSignatureValues, sharedKeyCredential: StorageSharedKeyCredential): SASQueryParameters;
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn and identifier.
*
* WARNING: When identifier is not provided, permissions and expiresOn are required.
* You MUST assign value to identifier or expiresOn & permissions manually if you initial with
* this constructor.
*
* @param queueSASSignatureValues -
* @param sharedKeyCredential -
*/
export declare function generateQueueSASQueryParameters(queueSASSignatureValues: QueueSASSignatureValues, sharedKeyCredential: StorageSharedKeyCredential): SASQueryParameters;
/** Geo-Replication information for the Secondary Storage Service */
export declare interface GeoReplication {
/** The status of the secondary location */
status: GeoReplicationStatusType;
/** A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. */
lastSyncOn: Date;
}
/** Defines values for GeoReplicationStatusType. */
export declare type GeoReplicationStatusType = "live" | "bootstrap" | "unavailable";
/**
* To get OAuth audience for a storage account for queue service.
*/
export declare function getQueueServiceAccountAudience(storageAccountName: string): string;
export { HttpHeaders }
export { HttpOperationResponse }
export { HttpRequestBody }
/**
* A representation of an HTTP response that
* includes a reference to the request that
* originated it.
*/
export declare interface HttpResponse {
/**
* The headers from the response.
*/
headers: HttpHeaders;
/**
* The original request that resulted in this response.
*/
request: WebResource;
/**
* The HTTP status code returned from the service.
*/
status: number;
}
/**
* A helper to decide if a given argument satisfies the Pipeline contract
* @param pipeline - An argument that may be a Pipeline
* @returns true when the argument satisfies the Pipeline contract
*/
export declare function isPipelineLike(pipeline: unknown): pipeline is PipelineLike;
/**
* Defines values for ListQueuesIncludeType.
* Possible values include: 'metadata'
* @readonly
*/
export declare type ListQueuesIncludeType = "metadata";
/** The object returned when calling List Queues on a Queue Service. */
export declare interface ListQueuesSegmentResponse {
serviceEndpoint: string;
prefix: string;
marker?: string;
maxPageSize: number;
queueItems?: QueueItem[];
continuationToken: string;
}
/**
* The `@azure/logger` configuration for this package.
*/
export declare const logger: AzureLogger;
/** Azure Analytics Logging settings. */
export declare interface Logging {
/** The version of Storage Analytics to configure. */
version: string;
/** Indicates whether all delete requests should be logged. */
deleteProperty: boolean;
/** Indicates whether all read requests should be logged. */
read: boolean;
/** Indicates whether all write requests should be logged. */
write: boolean;
/** the retention policy */
retentionPolicy: RetentionPolicy;
}
/** Interface representing a MessageId. */
declare interface MessageId {
/**
* The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update
* Message operation updates the visibility timeout of a message. You can also use this operation to
* update the contents of a message. A message must be in a format that can be included in an XML
* request with UTF-8 encoding, and the encoded message can be up to 64KB in size.
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to
* the Get Messages or Update Message operation.
* @param visibilityTimeout Optional. Specifies the new visibility timeout value, in seconds, relative
* to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1
* second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to
* version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry
* time.
* @param options The options parameters.
*/
update(popReceipt: string, visibilityTimeout: number, options?: MessageIdUpdateOptionalParams): Promise<MessageIdUpdateResponse_2>;
/**
* The Delete operation deletes the specified message.
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to
* the Get Messages or Update Message operation.
* @param options The options parameters.
*/
delete(popReceipt: string, options?: MessageIdDeleteOptionalParams): Promise<MessageIdDeleteResponse_2>;
}
/** Defines headers for MessageId_delete operation. */
export declare interface MessageIdDeleteHeaders {
/** This header uniquely identifies the request that was made and can be used for troubleshooting the request. */
requestId?: string;
/** Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above. */
version?: string;
/** UTC date/time value generated by the service that indicates the time at which the response was initiated */
date?: Date;
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
clientRequestId?: string;
/** Error Code */
errorCode?: string;
}
/** Optional parameters. */
declare interface MessageIdDeleteOptionalParams extends coreClient.OperationOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
}
/** Contains response data for the delete operation. */
export declare type MessageIdDeleteResponse = WithResponse<MessageIdDeleteHeaders, MessageIdDeleteHeaders>;
/** Contains response data for the delete operation. */
declare type MessageIdDeleteResponse_2 = MessageIdDeleteHeaders;
/** Defines headers for MessageId_update operation. */
export declare interface MessageIdUpdateHeaders {
/** This header uniquely identifies the request that was made and can be used for troubleshooting the request. */
requestId?: string;
/** Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above. */
version?: string;
/** UTC date/time value generated by the service that indicates the time at which the response was initiated */
date?: Date;
/** The pop receipt of the queue message. */
popReceipt?: string;
/** A UTC date/time value that represents when the message will be visible on the queue. */
nextVisibleOn?: Date;
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
clientRequestId?: string;
/** Error Code */
errorCode?: string;
}
/** Optional parameters. */
declare interface MessageIdUpdateOptionalParams extends coreClient.OperationOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
/** A Message object which can be stored in a Queue */
queueMessage?: QueueMessage;
}
/** Contains response data for the update operation. */
export declare type MessageIdUpdateResponse = WithResponse<MessageIdUpdateHeaders, MessageIdUpdateHeaders>;
/** Contains response data for the update operation. */
declare type MessageIdUpdateResponse_2 = MessageIdUpdateHeaders;
/** Interface representing a Messages. */
declare interface Messages {
/**
* The Dequeue operation retrieves one or more messages from the front of the queue.
* @param options The options parameters.
*/
dequeue(options?: MessagesDequeueOptionalParams_2): Promise<MessagesDequeueResponse>;
/**
* The Clear operation deletes all messages from the specified queue.
* @param options The options parameters.
*/
clear(options?: MessagesClearOptionalParams): Promise<MessagesClearResponse_2>;
/**
* The Enqueue operation 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 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions.
* @param queueMessage A Message object which can be stored in a Queue
* @param options The options parameters.
*/
enqueue(queueMessage: QueueMessage, options?: MessagesEnqueueOptionalParams_2): Promise<MessagesEnqueueResponse>;
/**
* The Peek operation retrieves one or more messages from the front of the queue, but does not alter
* the visibility of the message.
* @param options The options parameters.
*/
peek(options?: MessagesPeekOptionalParams_2): Promise<MessagesPeekResponse>;
}
/** Defines headers for Messages_clear operation. */
export declare interface MessagesClearHeaders {
/** This header uniquely identifies the request that was made and can be used for troubleshooting the request. */
requestId?: string;
/** Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above. */
version?: string;
/** UTC date/time value generated by the service that indicates the time at which the response was initiated */
date?: Date;
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
clientRequestId?: string;
/** Error Code */
errorCode?: string;
}
/** Optional parameters. */
declare interface MessagesClearOptionalParams extends coreClient.OperationOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
}
/** Contains response data for the clear operation. */
export declare type MessagesClearResponse = WithResponse<MessagesClearHeaders, MessagesClearHeaders>;
/** Contains response data for the clear operation. */
declare type MessagesClearResponse_2 = MessagesClearHeaders;
/** Defines headers for Messages_dequeue operation. */
export declare interface MessagesDequeueHeaders {
/** This header uniquely identifies the request that was made and can be used for troubleshooting the request. */
requestId?: string;
/** Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above. */
version?: string;
/** UTC date/time value generated by the service that indicates the time at which the response was initiated */
date?: Date;
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
clientRequestId?: string;
/** Error Code */
errorCode?: string;
}
/** Optional parameters. */
export declare interface MessagesDequeueOptionalParams extends CommonOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
/** Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation. */
numberOfMessages?: number;
/** Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time. */
visibilityTimeout?: number;
}
/** Optional parameters. */
declare interface MessagesDequeueOptionalParams_2 extends coreClient.OperationOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
/** Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation. */
numberOfMessages?: number;
/** Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time. */
visibilityTimeout?: number;
}
/** Contains response data for the dequeue operation. */
declare type MessagesDequeueResponse = MessagesDequeueHeaders & DequeuedMessageItem[];
/** Defines headers for Messages_enqueue operation. */
export declare interface MessagesEnqueueHeaders {
/** This header uniquely identifies the request that was made and can be used for troubleshooting the request. */
requestId?: string;
/** Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above. */
version?: string;
/** UTC date/time value generated by the service that indicates the time at which the response was initiated */
date?: Date;
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
clientRequestId?: string;
/** Error Code */
errorCode?: string;
}
/** Optional parameters. */
export declare interface MessagesEnqueueOptionalParams extends CommonOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
/** Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a value smaller than the time-to-live value. */
visibilityTimeout?: number;
/** Optional. Specifies the time-to-live interval for the message, in seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this parameter is omitted, the default time-to-live is 7 days. */
messageTimeToLive?: number;
}
/** Optional parameters. */
declare interface MessagesEnqueueOptionalParams_2 extends coreClient.OperationOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
/** Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a value smaller than the time-to-live value. */
visibilityTimeout?: number;
/** Optional. Specifies the time-to-live interval for the message, in seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this parameter is omitted, the default time-to-live is 7 days. */
messageTimeToLive?: number;
}
/** Contains response data for the enqueue operation. */
declare type MessagesEnqueueResponse = MessagesEnqueueHeaders & EnqueuedMessage[];
/** Defines headers for Messages_peek operation. */
export declare interface MessagesPeekHeaders {
/** This header uniquely identifies the request that was made and can be used for troubleshooting the request. */
requestId?: string;
/** Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above. */
version?: string;
/** UTC date/time value generated by the service that indicates the time at which the response was initiated */
date?: Date;
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
clientRequestId?: string;
/** Error Code */
errorCode?: string;
}
/** Optional parameters. */
export declare interface MessagesPeekOptionalParams extends CommonOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
/** Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation. */
numberOfMessages?: number;
}
/** Optional parameters. */
declare interface MessagesPeekOptionalParams_2 extends coreClient.OperationOptions {
/** The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a> */
timeoutInSeconds?: number;
/** Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. */
requestId?: string;
/** Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation. */
numberOfMessages?: number;
}
/** Contains response data for the peek operation. */
declare type MessagesPeekResponse = MessagesPeekHeaders & PeekedMessageItem[];
/**
* A collection of key-value string pairs.
*/
export declare interface Metadata {
/**
* A key-value string pair.
*/
[propertyName: string]: string;
}
/** An interface representing Metrics. */
export declare interface Metrics {
/** The version of Storage Analytics to configure. */
version?: string;
/** Indicates whether metrics are enabled for the Queue service. */
enabled: boolean;
/** Indicates whether metrics should generate summary statistics for called API operations. */
includeAPIs?: boolean;
/** the retention policy */
retentionPolicy?: RetentionPolicy;
}
/**
* Creates a new Pipeline object with Credential provided.
*
* @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
* @param pipelineOptions - Optional. Options.
* @returns A new Pipeline object.
*/
export declare function newPipeline(credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, pipelineOptions?: StoragePipelineOptions): Pipeline;
/** The object returned in the QueueMessageList array when calling Peek Messages on a Queue */
export declare interface PeekedMessageItem {
/** The Id of the Message. */
messageId: string;
/** The time the Message was inserted into the Queue. */
insertedOn: Date;
/** The time that the Message will expire and be automatically deleted. */
expiresOn: Date;
/** The number of times the message has been dequeued. */
dequeueCount: number;
/** The content of the Message. */
messageText: string;
}
/**
* A Pipeline class containing HTTP request policies.
* You can create a default Pipeline by calling {@link newPipeline}.
* Or you can create a Pipeline with your own policies by the constructor of Pipeline.
*
* Refer to {@link newPipeline} and provided policies before implementing your
* customized Pipeline.
*/
export declare class Pipeline implements PipelineLike {
/**
* A list of chained request policy factories.
*/
readonly factories: RequestPolicyFactory[];
/**
* Configures pipeline logger and HTTP client.
*/
readonly options: PipelineOptions;
/**
* Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.
*
* @param factories -
* @param options -
*/
constructor(factories: RequestPolicyFactory[], options?: PipelineOptions);
/**
* Transfer Pipeline object to ServiceClientOptions object which is required by
* ServiceClient constructor.
*
* @returns The ServiceClientOptions object from this Pipeline.
*/
toServiceClientOptions(): ServiceClientOptions;
}
/**
* An interface for the {@link Pipeline} class containing HTTP request policies.
* You can create a default Pipeline by calling {@link newPipeline}.
* Or you can create a Pipeline with your own policies by the constructor of Pipeline.
*
* Refer to {@link newPipeline} and provided policies before implementing your
* customized Pipeline.
*/
export declare interface PipelineLike {
/**
* A list of chained request policy factories.
*/
readonly factories: RequestPolicyFactory[];
/**
* Configures pipeline logger and HTTP client.
*/
readonly options: PipelineOptions;
/**
* Transfer Pipeline object to ServiceClientOptions object which is required by
* ServiceClient constructor.
*
* @returns The ServiceClientOptions object from this Pipeline.
*/
toServiceClientOptions(): ServiceClientOptions;
}
/**
* Option interface for Pipeline constructor.
*/
export declare interface PipelineOptions {
/**
* Optional. Configures the HTTP client to send requests and receive responses.
*/
httpClient?: RequestPolicy;
}
/** Interface representing a Queue. */
declare interface Queue {
/**
* creates a new queue under the given account.
* @param options The options parameters.
*/
create(options?: QueueCreateOptionalParams): Promise<QueueCreateResponse_2>;
/**
* operation permanently deletes the specified queue
* @param options The options parameters.
*/
delete(options?: QueueDeleteOptionalParams): Promise<QueueDeleteResponse_2>;
/**
* Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated
* with the queue as name-values pairs.
* @param options The options parameters.
*/
getProperties(options?: QueueGetPropertiesOptionalParams): Promise<QueueGetPropertiesResponse_2>;
/**
* sets user-defined metadata on the specified queue. Metadata is associated with the queue as
* name-value pairs.
* @param options The options parameters.
*/
setMetadata(options?: QueueSetMetadataOptionalParams): Promise<QueueSetMetadataResponse_2>;
/**
* returns details about any stored access policies specified on the queue that may be used with Shared
* Access Signatures.
* @param options The options parameters.
*/
getAccessPolicy(options?: QueueGetAccessPolicyOptionalParams): Promise<QueueGetAccessPolicyResponse_2>;
/**
* sets stored access policies for the queue that may be used with Shared Access Signatures
* @param options The options parameters.
*/
setAccessPolicy(options?: QueueSetAccessPolicyOptionalParams): Promise<QueueSetAccessPolicyResponse_2>;
}
/**
* Options to configure {@link QueueClient.clearMessages} operation
*/
export declare interface QueueClearMessagesOptions extends CommonOptions {
/**
* An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
* For example, use the @azure/abort-controller to create an `AbortSignal`.
*/
abortSignal?: AbortSignalLike;
}
/**
* Contains response data for the {@link QueueClient.clearMessages} operation.
*/
export declare type QueueClearMessagesResponse = MessagesClearResponse;
/**
* A QueueClient represents a URL to an Azure Storage Queue's messages allowing you to manipulate its messages.
*/
export declare class QueueClient extends StorageClient {
/**
* messagesContext provided by protocol layer.
*/
private messagesContext;
/**
* queueContext provided by protocol layer.
*/
private queueContext;
private _name;
private _messagesUrl;
/**
* The name of the queue.
*/
get name(): string;
/**
* Creates an instance of QueueClient.
*
* @param connectionString - Account connection string or a SAS connection string of an Azure storage account.
* [ Note - Account connection string can only be used in NODE.JS runtime. ]
* Account connection string example -
* `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
* SAS connection string example -
* `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`
* @param queueName - Queue name.
* @param options - Options to configure the HTTP pipeline.
*/
constructor(connectionString: string, queueName: string, options?: StoragePipelineOptions);
/**
* Creates an instance of QueueClient.
*
* @param url - A URL string pointing to Azure Storage queue, such as
* "https://myaccount.queue.core.windows.net/myqueue". You can
* append a SAS if using AnonymousCredential, such as
* "https://myaccount.queue.core.windows.net/myqueue?sasString".
* @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
* @param options - Options to configure the HTTP pipeline.
*/
constructor(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions);
/**
* Creates an instance of QueueClient.
*
* @param url - A URL string pointing to Azure Storage queue, such as
* "https://myaccount.queue.core.windows.net/myqueue". You can
* append a SAS if using AnonymousCredential, such as
* "https://myaccount.queue.core.windows.net/myqueue?sasString".
* @param pipeline - Call newPipeline() to create a default
* pipeline, or provide a customized pipeline.
*/
constructor(url: string, pipeline: Pipeline);
private getMessageIdContext;
/**
* Creates a new queue under the specified account.
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-queue4
*
* @param options - Options to Queue create operation.
* @returns Response data for the Queue create operation.
*
* Example usage:
*
* ```js
* const queueClient = queueServiceClient.getQueueClient("<new queue name>");
* const createQueueResponse = await queueClient.create();
* ```
*/
create(options?: QueueCreateOptions): Promise<QueueCreateResponse>;
/**
* Creates a new queue under the specified account if it doesn't already exist.
* If the queue already exists, it is not changed.
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-queue4
*
* @param options -
*/
createIfNotExists(options?: QueueCreateOptions): Promise<QueueCreateIfNotExistsResponse>;
/**
* Deletes the specified queue permanently if it exists.
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-queue3
*
* @param options -
*/
deleteIfExists(options?: QueueDeleteOptions): Promise<QueueDeleteIfExistsResponse>;
/**
* Deletes the specified queue permanently.
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-queue3
*
* @param options - Options to Queue delete operation.
* @returns Response data for the Queue delete operation.
*
* Example usage:
*
* ```js
* con