QueueServiceClient class

QueueServiceClient は、キューを操作できる Azure Storage Queue サービスへの URL を表します。

Extends

StorageClient

コンストラクター

QueueServiceClient(string, Pipeline)

QueueServiceClient のインスタンスを作成します。

QueueServiceClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions)

QueueServiceClient のインスタンスを作成します。

継承されたプロパティ

accountName
url

URL 文字列値。

メソッド

createQueue(string, QueueCreateOptions)

指定したアカウントの下に新しいキューを作成します。

https://docs.microsoft.com/en-us/rest/api/storageservices/create-queue4」を参照してください。

deleteQueue(string, QueueDeleteOptions)

指定したキューを完全に削除します。

https://docs.microsoft.com/en-us/rest/api/storageservices/delete-queue3」を参照してください。

fromConnectionString(string, StoragePipelineOptions)

QueueServiceClient のインスタンスを作成します。

generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

共有キー資格情報を使用して構築された QueueServiceClient でのみ使用できます。

渡されたクライアントのプロパティとパラメーターに基づいて、アカウント Shared Access Signature (SAS) URI を生成します。 SAS は、クライアントの共有キー資格情報によって署名されます。

https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas」を参照してください。

getProperties(ServiceGetPropertiesOptions)

Storage Analyticsおよび CORS (クロスオリジン リソース共有) ルールのプロパティを含む、ストレージ アカウントの Queue サービスのプロパティを取得します。

https://docs.microsoft.com/en-us/rest/api/storageservices/get-queue-service-properties」を参照してください。

getQueueClient(string)

QueueClient オブジェクトを作成します。

getStatistics(ServiceGetStatisticsOptions)

キュー サービスのレプリケーションに関連する統計情報を取得します。 読み取りアクセスの地理冗長レプリケーションがストレージ アカウントで有効なとき、これは 2 次拠点のエンドポイントでのみ使用できます。

https://docs.microsoft.com/en-us/rest/api/storageservices/get-queue-service-stats」を参照してください。

listQueues(ServiceListQueuesOptions)

指定したアカウントのすべてのキューを一覧表示する非同期反復可能反復子を返します。

.byPage() は、ページ内のキューを一覧表示する非同期反復可能な反復子を返します。

構文の使用 for await 例:

let i = 1;
for await (const item of queueServiceClient.listQueues()) {
  console.log(`Queue${i}: ${item.name}`);
  i++;
}

iter.next() の使用例:

let i = 1;
let iterator = queueServiceClient.listQueues();
let item = await iterator.next();
while (!item.done) {
  console.log(`Queue${i}: ${iterator.value.name}`);
  i++;
  item = await iterator.next();
}

byPage() の使用例:

// passing optional maxPageSize in the page settings
let i = 1;
for await (const item2 of queueServiceClient.listQueues().byPage({ maxPageSize: 20 })) {
  if (item2.queueItems) {
    for (const queueItem of item2.queueItems) {
      console.log(`Queue${i}: ${queueItem.name}`);
      i++;
    }
  }
}

マーカーでページングを使用する例:

let i = 1;
let iterator = queueServiceClient.listQueues().byPage({ maxPageSize: 2 });
let item = (await iterator.next()).value;

// Prints 2 queue names
if (item.queueItems) {
  for (const queueItem of item.queueItems) {
    console.log(`Queue${i}: ${queueItem.name}`);
    i++;
  }
}
// Gets next marker
let marker = item.continuationToken;

// Passing next marker as continuationToken
iterator = queueServiceClient.listQueues().byPage({ continuationToken: marker, maxPageSize: 10 });
item = (await iterator.next()).value;

// Prints 10 queue names
if (item.queueItems) {
  for (const queueItem of item.queueItems) {
    console.log(`Queue${i}: ${queueItem.name}`);
    i++;
  }
}
setProperties(QueueServiceProperties, ServiceGetPropertiesOptions)

ストレージ アカウントのキュー サービス エンドポイントのプロパティを設定します。これには、Storage Analytics、CORS (クロスオリジン リソース共有) ルール、論理的な削除設定のプロパティが含まれます。

https://docs.microsoft.com/en-us/rest/api/storageservices/set-queue-service-properties」を参照してください。

コンストラクターの詳細

QueueServiceClient(string, Pipeline)

QueueServiceClient のインスタンスを作成します。

new QueueServiceClient(url: string, pipeline: Pipeline)

パラメーター

url

string

"; などhttps://myaccount.queue.core.windows.net"、Azure Storage キュー サービスを指す URL 文字列。 AnonymousCredential を使用している場合は、SAS を追加できます (例: "https://myaccount.queue.core.windows.net?sasString")。

pipeline
Pipeline

newPipeline() を呼び出して既定のパイプラインを作成するか、カスタマイズされたパイプラインを提供します。

QueueServiceClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions)

QueueServiceClient のインスタンスを作成します。

new QueueServiceClient(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)

パラメーター

url

string

"; などhttps://myaccount.queue.core.windows.net"、Azure Storage キュー サービスを指す URL 文字列。 AnonymousCredential を使用している場合は、SAS を追加できます (例: "https://myaccount.queue.core.windows.net?sasString")。

credential

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

AnonymousCredential、StorageSharedKeyCredential、またはサービスへの要求を @azure/identity 認証するためのパッケージからの資格情報など。 TokenCredential インターフェイスを実装する オブジェクトを指定することもできます。 指定しない場合は、AnonymousCredential が使用されます。

options
StoragePipelineOptions

HTTP パイプラインを構成するためのオプション。

DefaultAzureCredential の使用例:@azure/identity

const account = "<account>";

const credential = new DefaultAzureCredential();

const queueServiceClient = new QueueServiceClient(
  `https://${account}.queue.core.windows.net`,
  credential
}

アカウント名/キーの使用例:

const account = "<account>";

const sharedKeyCredential = new StorageSharedKeyCredential(account, "<account key>");

const queueServiceClient = new QueueServiceClient(
  `https://${account}.queue.core.windows.net`,
  sharedKeyCredential,
  {
    retryOptions: { maxTries: 4 }, // Retry options
    telemetry: { value: "BasicSample/V11.0.0" } // Customized telemetry string
  }
);

継承されたプロパティの詳細

accountName

accountName: string

プロパティ値

string

継承元 StorageClient.accountName

url

URL 文字列値。

url: string

プロパティ値

string

継承元 StorageClient.url

メソッドの詳細

createQueue(string, QueueCreateOptions)

指定したアカウントの下に新しいキューを作成します。

https://docs.microsoft.com/en-us/rest/api/storageservices/create-queue4」を参照してください。

function createQueue(queueName: string, options?: QueueCreateOptions): Promise<QueueCreateResponse>

パラメーター

queueName

string

作成するキューの名前

options
QueueCreateOptions

キュー作成操作のオプション。

戻り値

キュー作成操作の応答データ。

deleteQueue(string, QueueDeleteOptions)

指定したキューを完全に削除します。

https://docs.microsoft.com/en-us/rest/api/storageservices/delete-queue3」を参照してください。

function deleteQueue(queueName: string, options?: QueueDeleteOptions): Promise<QueueDeleteResponse>

パラメーター

queueName

string

削除するキューの名前。

options
QueueDeleteOptions

キュー削除操作のオプション。

戻り値

キュー削除操作の応答データ。

fromConnectionString(string, StoragePipelineOptions)

QueueServiceClient のインスタンスを作成します。

static function fromConnectionString(connectionString: string, options?: StoragePipelineOptions): QueueServiceClient

パラメーター

connectionString

string

Azure ストレージ アカウントのアカウント接続文字列または SAS 接続文字列。 [ 注 - アカウント接続文字列は、NODE.JSランタイムでのみ使用できます。 ] アカウント接続文字列の例 -DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS 接続文字列の例 - 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

options
StoragePipelineOptions

HTTP パイプラインを構成するためのオプション。

戻り値

指定された接続文字列からの新しい QueueServiceClient オブジェクト。

generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

共有キー資格情報を使用して構築された QueueServiceClient でのみ使用できます。

渡されたクライアントのプロパティとパラメーターに基づいて、アカウント Shared Access Signature (SAS) URI を生成します。 SAS は、クライアントの共有キー資格情報によって署名されます。

https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas」を参照してください。

function generateAccountSasUrl(expiresOn?: Date, permissions?: AccountSASPermissions, resourceTypes?: string, options?: ServiceGenerateAccountSasUrlOptions): string

パラメーター

expiresOn

Date

省略可能。 共有アクセス署名が無効になる時刻。 指定しない場合、既定値は 1 時間後です。

permissions
AccountSASPermissions

SAS に関連付けるアクセス許可の一覧を指定します。

resourceTypes

string

共有アクセス署名に関連付けられているリソースの種類を指定します。

options
ServiceGenerateAccountSasUrlOptions

省略可能なパラメーター。

戻り値

string

このクライアントで表されるリソースへの URI と、生成された SAS トークンで構成されるアカウント SAS URI。

getProperties(ServiceGetPropertiesOptions)

Storage Analyticsおよび CORS (クロスオリジン リソース共有) ルールのプロパティを含む、ストレージ アカウントの Queue サービスのプロパティを取得します。

https://docs.microsoft.com/en-us/rest/api/storageservices/get-queue-service-properties」を参照してください。

function getProperties(options?: ServiceGetPropertiesOptions): Promise<ServiceGetPropertiesResponse>

パラメーター

options
ServiceGetPropertiesOptions

プロパティ操作を取得するためのオプション。

戻り値

キュー サービスのプロパティを含む応答データ。

getQueueClient(string)

QueueClient オブジェクトを作成します。

function getQueueClient(queueName: string): QueueClient

パラメーター

queueName

string

戻り値

新しい QueueClient

使用例:

const queueClient = queueServiceClient.getQueueClient("<new queue name>");
const createQueueResponse = await queueClient.create();

getStatistics(ServiceGetStatisticsOptions)

キュー サービスのレプリケーションに関連する統計情報を取得します。 読み取りアクセスの地理冗長レプリケーションがストレージ アカウントで有効なとき、これは 2 次拠点のエンドポイントでのみ使用できます。

https://docs.microsoft.com/en-us/rest/api/storageservices/get-queue-service-stats」を参照してください。

function getStatistics(options?: ServiceGetStatisticsOptions): Promise<ServiceGetStatisticsResponse>

パラメーター

options
ServiceGetStatisticsOptions

統計操作を取得するためのオプション。

戻り値

操作の統計情報を取得するための応答データ。

listQueues(ServiceListQueuesOptions)

指定したアカウントのすべてのキューを一覧表示する非同期反復可能反復子を返します。

.byPage() は、ページ内のキューを一覧表示する非同期反復可能な反復子を返します。

構文の使用 for await 例:

let i = 1;
for await (const item of queueServiceClient.listQueues()) {
  console.log(`Queue${i}: ${item.name}`);
  i++;
}

iter.next() の使用例:

let i = 1;
let iterator = queueServiceClient.listQueues();
let item = await iterator.next();
while (!item.done) {
  console.log(`Queue${i}: ${iterator.value.name}`);
  i++;
  item = await iterator.next();
}

byPage() の使用例:

// passing optional maxPageSize in the page settings
let i = 1;
for await (const item2 of queueServiceClient.listQueues().byPage({ maxPageSize: 20 })) {
  if (item2.queueItems) {
    for (const queueItem of item2.queueItems) {
      console.log(`Queue${i}: ${queueItem.name}`);
      i++;
    }
  }
}

マーカーでページングを使用する例:

let i = 1;
let iterator = queueServiceClient.listQueues().byPage({ maxPageSize: 2 });
let item = (await iterator.next()).value;

// Prints 2 queue names
if (item.queueItems) {
  for (const queueItem of item.queueItems) {
    console.log(`Queue${i}: ${queueItem.name}`);
    i++;
  }
}
// Gets next marker
let marker = item.continuationToken;

// Passing next marker as continuationToken
iterator = queueServiceClient.listQueues().byPage({ continuationToken: marker, maxPageSize: 10 });
item = (await iterator.next()).value;

// Prints 10 queue names
if (item.queueItems) {
  for (const queueItem of item.queueItems) {
    console.log(`Queue${i}: ${queueItem.name}`);
    i++;
  }
}
function listQueues(options?: ServiceListQueuesOptions): PagedAsyncIterableIterator<QueueItem, ServiceListQueuesSegmentResponse, PageSettings>

パラメーター

options
ServiceListQueuesOptions

キュー操作を一覧表示するオプション。

戻り値

ページングをサポートする asyncIterableIterator。

setProperties(QueueServiceProperties, ServiceGetPropertiesOptions)

ストレージ アカウントのキュー サービス エンドポイントのプロパティを設定します。これには、Storage Analytics、CORS (クロスオリジン リソース共有) ルール、論理的な削除設定のプロパティが含まれます。

https://docs.microsoft.com/en-us/rest/api/storageservices/set-queue-service-properties」を参照してください。

function setProperties(properties: QueueServiceProperties, options?: ServiceGetPropertiesOptions): Promise<ServiceSetPropertiesResponse>

パラメーター

options
ServiceGetPropertiesOptions

プロパティ操作を設定するオプション。

戻り値

プロパティの設定操作の応答データ。