DataLakeServiceClient class

DataLakeServiceClient を使用すると、Azure Data Lake サービス リソースとファイル システムを操作できます。 ストレージ アカウントは、Data Lake サービスの最上位レベルの名前空間を提供します。

Extends

StorageClient

コンストラクター

DataLakeServiceClient(string, Pipeline)

URL とパイプラインから DataLakeServiceClient のインスタンスを作成します。

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

Url から DataLakeServiceClient のインスタンスを作成します。

継承されたプロパティ

accountName
credential

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

url

エンコードされた URL 文字列値。

メソッド

fromConnectionString(string, StoragePipelineOptions)

接続文字列から DataLakeServiceClient のインスタンスを作成します。

generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

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

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

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

getFileSystemClient(string)

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

getProperties(ServiceGetPropertiesOptions)

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

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

getUserDelegationKey(Date, Date, ServiceGetUserDelegationKeyOptions)

ベアラー トークン認証 (TokenCredential) を使用している場合にのみ使用できます。

Data Lake サービスのユーザー委任キーを取得します。 これは、ベアラー トークン認証を使用する場合にのみ有効な操作です。

// Generate user delegation SAS for a file system
const userDelegationKey = await dataLakeServiceClient.getUserDelegationKey(startsOn, expiresOn);
const fileSystemSAS = generateDataLakeSASQueryParameters({
    fileSystemName, // Required
    permissions: FileSystemSASPermissions.parse("racwdl"), // Required
    startsOn, // Required. Date type
    expiresOn, // Optional. Date type
    ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, // Optional
    protocol: SASProtocol.HttpsAndHttp, // Optional
    version: "2018-11-09" // Must greater than or equal to 2018-11-09 to generate user delegation SAS
  },
  userDelegationKey, // UserDelegationKey
  accountName
).toString();

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

listFileSystems(ServiceListFileSystemsOptions)

指定したアカウントのすべてのファイル システムを一覧表示する非同期反復可能反復子を返します。

.byPage() は非同期反復可能な反復子を返し、ページ内のファイル システムを一覧表示します。

構文を使用する for await 例:

let i = 1;
for await (const fileSystem of serviceClient.listFileSystems()) {
  console.log(`FileSystem ${i++}: ${fileSystem.name}`);
}

iter.next() の使用例:

let i = 1;
const iter = serviceClient.listFileSystems();
let fileSystemItem = await iter.next();
while (!fileSystemItem.done) {
  console.log(`FileSystem ${i++}: ${fileSystemItem.value.name}`);
  fileSystemItem = await iter.next();
}

byPage() の使用例:

// passing optional maxPageSize in the page settings
let i = 1;
for await (const response of serviceClient.listFileSystems().byPage({ maxPageSize: 20 })) {
  if (response.fileSystemItems) {
    for (const fileSystem of response.fileSystemItems) {
      console.log(`FileSystem ${i++}: ${fileSystem.name}`);
    }
  }
}

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

let i = 1;
let iterator = serviceClient.listFileSystems().byPage({ maxPageSize: 2 });
let response = (await iterator.next()).value;

// Prints 2 file system names
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
    console.log(`FileSystem ${i++}: ${fileSystem.name}`);
  }
}

// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
iterator = serviceClient
  .listContainers()
  .byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await iterator.next()).value;

// Prints 10 file system names
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
     console.log(`FileSystem ${i++}: ${fileSystem.name}`);
  }
}

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

setProperties(BlobServiceProperties, ServiceSetPropertiesOptions)

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

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

undeleteFileSystem(string, string, ServiceUndeleteFileSystemOptions)

以前に削除したファイル システムを復元します。 この API は、ストレージ アカウントに対して Container Soft Delete が有効になっている場合にのみ機能します。

コンストラクターの詳細

DataLakeServiceClient(string, Pipeline)

URL とパイプラインから DataLakeServiceClient のインスタンスを作成します。

new DataLakeServiceClient(url: string, pipeline: Pipeline)

パラメーター

url

string

"https://myaccount.dfs.core.windows.net" など、Azure Storage データ レイク サービスを指すクライアント文字列。 AnonymousCredential を使用している場合は、SAS を追加できます (例: "https://myaccount.dfs.core.windows.net?sasString")。

pipeline
Pipeline

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

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

Url から DataLakeServiceClient のインスタンスを作成します。

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

パラメーター

url

string

"https://myaccount.dfs.core.windows.net" など、Azure Storage データ レイク サービスを指すクライアント文字列。 AnonymousCredential を使用している場合は、SAS を追加できます (例: "https://myaccount.dfs.core.windows.net?sasString")。

credential

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

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

options
StoragePipelineOptions

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

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

accountName

accountName: string

プロパティ値

string

継承元 StorageClient.accountName

credential

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

credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential

プロパティ値

継承元 StorageClient.credential

url

エンコードされた URL 文字列値。

url: string

プロパティ値

string

継承元 StorageClient.url

メソッドの詳細

fromConnectionString(string, StoragePipelineOptions)

接続文字列から DataLakeServiceClient のインスタンスを作成します。

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

パラメーター

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 パイプラインを構成するためのオプション。

戻り値

generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

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

渡されたクライアントのプロパティとパラメーターに基づいて、アカウント 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。

getFileSystemClient(string)

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

function getFileSystemClient(fileSystemName: string): DataLakeFileSystemClient

パラメーター

fileSystemName

string

ファイル システム名。

戻り値

getProperties(ServiceGetPropertiesOptions)

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

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

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

パラメーター

options
ServiceGetPropertiesOptions

Service Get Properties 操作のオプション。

戻り値

Service Get Properties 操作の応答データ。

getUserDelegationKey(Date, Date, ServiceGetUserDelegationKeyOptions)

ベアラー トークン認証 (TokenCredential) を使用している場合にのみ使用できます。

Data Lake サービスのユーザー委任キーを取得します。 これは、ベアラー トークン認証を使用する場合にのみ有効な操作です。

// Generate user delegation SAS for a file system
const userDelegationKey = await dataLakeServiceClient.getUserDelegationKey(startsOn, expiresOn);
const fileSystemSAS = generateDataLakeSASQueryParameters({
    fileSystemName, // Required
    permissions: FileSystemSASPermissions.parse("racwdl"), // Required
    startsOn, // Required. Date type
    expiresOn, // Optional. Date type
    ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, // Optional
    protocol: SASProtocol.HttpsAndHttp, // Optional
    version: "2018-11-09" // Must greater than or equal to 2018-11-09 to generate user delegation SAS
  },
  userDelegationKey, // UserDelegationKey
  accountName
).toString();

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

function getUserDelegationKey(startsOn: Date, expiresOn: Date, options?: ServiceGetUserDelegationKeyOptions): Promise<ServiceGetUserDelegationKeyResponse>

パラメーター

startsOn

Date

ユーザー委任 SAS の開始時刻。 現在の時刻から 7 日以内である必要があります。

expiresOn

Date

ユーザー委任 SAS の終了時刻。 現在の時刻から 7 日以内である必要があります。

戻り値

listFileSystems(ServiceListFileSystemsOptions)

指定したアカウントのすべてのファイル システムを一覧表示する非同期反復可能反復子を返します。

.byPage() は非同期反復可能な反復子を返し、ページ内のファイル システムを一覧表示します。

構文を使用する for await 例:

let i = 1;
for await (const fileSystem of serviceClient.listFileSystems()) {
  console.log(`FileSystem ${i++}: ${fileSystem.name}`);
}

iter.next() の使用例:

let i = 1;
const iter = serviceClient.listFileSystems();
let fileSystemItem = await iter.next();
while (!fileSystemItem.done) {
  console.log(`FileSystem ${i++}: ${fileSystemItem.value.name}`);
  fileSystemItem = await iter.next();
}

byPage() の使用例:

// passing optional maxPageSize in the page settings
let i = 1;
for await (const response of serviceClient.listFileSystems().byPage({ maxPageSize: 20 })) {
  if (response.fileSystemItems) {
    for (const fileSystem of response.fileSystemItems) {
      console.log(`FileSystem ${i++}: ${fileSystem.name}`);
    }
  }
}

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

let i = 1;
let iterator = serviceClient.listFileSystems().byPage({ maxPageSize: 2 });
let response = (await iterator.next()).value;

// Prints 2 file system names
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
    console.log(`FileSystem ${i++}: ${fileSystem.name}`);
  }
}

// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
iterator = serviceClient
  .listContainers()
  .byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await iterator.next()).value;

// Prints 10 file system names
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
     console.log(`FileSystem ${i++}: ${fileSystem.name}`);
  }
}

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

function listFileSystems(options?: ServiceListFileSystemsOptions): PagedAsyncIterableIterator<FileSystemItem, ServiceListFileSystemsSegmentResponse, PageSettings>

パラメーター

戻り値

setProperties(BlobServiceProperties, ServiceSetPropertiesOptions)

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

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

function setProperties(properties: BlobServiceProperties, options?: ServiceSetPropertiesOptions): Promise<ServiceSetPropertiesResponse>

パラメーター

options
ServiceSetPropertiesOptions

サービス セットのプロパティ操作のオプション。

戻り値

サービス セット プロパティ操作の応答データ。

undeleteFileSystem(string, string, ServiceUndeleteFileSystemOptions)

以前に削除したファイル システムを復元します。 この API は、ストレージ アカウントに対して Container Soft Delete が有効になっている場合にのみ機能します。

function undeleteFileSystem(deletedFileSystemName: string, deleteFileSystemVersion: string, options?: ServiceUndeleteFileSystemOptions): Promise<{ fileSystemClient: DataLakeFileSystemClient, fileSystemUndeleteResponse: ContainerUndeleteResponse }>

パラメーター

deletedFileSystemName

string

ソース ファイル システムの名前。

deleteFileSystemVersion

string

ファイル システムの新しい名前。

options
ServiceUndeleteFileSystemOptions

ファイル システムの復元操作を構成するためのオプション。

戻り値

Promise<{ fileSystemClient: DataLakeFileSystemClient, fileSystemUndeleteResponse: ContainerUndeleteResponse }>