次の方法で共有


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://learn.microsoft.com/en-us/rest/api/storageservices/create-queue4 を参照してください

deleteQueue(string, QueueDeleteOptions)

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

https://learn.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://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas を参照してください

generateSasStringToSign(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

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

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

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

getProperties(ServiceGetPropertiesOptions)

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

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

getQueueClient(string)

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

getStatistics(ServiceGetStatisticsOptions)

Queue サービスのレプリケーションに関連する統計を取得します。 これは、ストレージ アカウントに対して読み取りアクセス geo 冗長レプリケーションが有効になっている場合にのみ、セカンダリ ロケーション エンドポイントで使用できます。

https://learn.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}: ${item.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 (クロスオリジン リソース共有) ルール、論理的な削除設定など、ストレージ アカウントの Queue サービス エンドポイントのプロパティを設定します。

https://learn.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 文字列。 "https://myaccount.queue.core.windows.net?sasString" など、AnonymousCredential を使用している場合は SAS を追加できます。

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 文字列。 "https://myaccount.queue.core.windows.net?sasString" など、AnonymousCredential を使用している場合は SAS を追加できます。

credential

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

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

options
StoragePipelineOptions

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

@azure/identityからの DefaultAzureCredential の使用例:

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://learn.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://learn.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://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas を参照してください

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

パラメーター

expiresOn

Date

随意。 Shared Access Signature が無効になる時刻。 指定しない場合、既定値は 1 時間後です。

permissions
AccountSASPermissions

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

resourceTypes

string

Shared Access Signature に関連付けられているリソースの種類を指定します。

options
ServiceGenerateAccountSasUrlOptions

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

戻り値

string

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

generateSasStringToSign(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

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

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

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

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

パラメーター

expiresOn

Date

随意。 Shared Access Signature が無効になる時刻。 指定しない場合、既定値は 1 時間後です。

permissions
AccountSASPermissions

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

resourceTypes

string

Shared Access Signature に関連付けられているリソースの種類を指定します。

options
ServiceGenerateAccountSasUrlOptions

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

戻り値

string

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

getProperties(ServiceGetPropertiesOptions)

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

https://learn.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)

Queue サービスのレプリケーションに関連する統計を取得します。 これは、ストレージ アカウントに対して読み取りアクセス geo 冗長レプリケーションが有効になっている場合にのみ、セカンダリ ロケーション エンドポイントで使用できます。

https://learn.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}: ${item.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 (クロスオリジン リソース共有) ルール、論理的な削除設定など、ストレージ アカウントの Queue サービス エンドポイントのプロパティを設定します。

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

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

パラメーター

options
ServiceGetPropertiesOptions

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

戻り値

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