DataLakeServiceClient class
DataLakeServiceClient を使用すると、Azure Data Lake サービスのリソースとファイル システムを操作できます。 ストレージ アカウントは、Data Lake サービスの最上位レベルの名前空間を提供します。
- Extends
-
StorageClient
コンストラクター
Data |
URL とパイプラインから DataLakeServiceClient のインスタンスを作成します。 |
Data |
URL から DataLakeServiceClient のインスタンスを作成します。 |
継承されたプロパティ
account |
|
credential | AnonymousCredential、StorageSharedKeyCredential、サービスへの要求を認証するための |
url | エンコードされた URL 文字列値。 |
メソッド
from |
接続文字列から DataLakeServiceClient のインスタンスを作成します。 |
generate |
共有キー資格情報を使用して構築された DataLakeServiceClient でのみ使用できます。 渡されたクライアントのプロパティとパラメーターに基づいて、アカウント Shared Access Signature (SAS) URI を生成します。 SAS は、クライアントの共有キー資格情報によって署名されます。 https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas を参照してください |
generate |
共有キー資格情報を使用して構築された DataLakeServiceClient でのみ使用できます。 渡されたクライアントのプロパティとパラメーターに基づいて、アカウント Shared Access Signature (SAS) に署名する文字列を生成します。 SAS は、クライアントの共有キー資格情報によって署名されます。 https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas を参照してください |
get |
DataLakeFileSystemClient オブジェクトを作成します。 |
get |
ストレージ アカウントの BLOB サービス エンドポイントのプロパティ (Storage Analytics および CORS (クロスオリジン リソース共有) ルールのプロパティを含む) を取得します。 https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties を参照してください |
get |
ベアラー トークン認証 (TokenCredential) を使用している場合にのみ使用できます。 Data Lake サービスのユーザー委任キーを取得します。 これは、ベアラー トークン認証を使用する場合にのみ有効な操作です。 「例」
https://learn.microsoft.com/en-us/rest/api/storageservices/get-user-delegation-key を参照してください |
list |
指定したアカウントのすべてのファイル システムを一覧表示する非同期反復可能反復子を返します。 .byPage() は非同期反復可能な反復子を返して、ページ内のファイル システムを一覧表示します。
マーカーでのページングの使用例:
https://learn.microsoft.com/en-us/rest/api/storageservices/list-containers2 を参照してください |
set |
Storage Analytics のプロパティ、CORS (クロスオリジン リソース共有) ルール、論理的な削除設定など、ストレージ アカウントの BLOB サービス エンドポイントのプロパティを設定します。 https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties を参照してください |
undelete |
以前に削除したファイル システムを復元します。 この API は、ストレージ アカウントに対してコンテナーの論理的な削除が有効になっている場合にのみ機能します。 |
コンストラクターの詳細
DataLakeServiceClient(string, Pipeline)
URL とパイプラインから DataLakeServiceClient のインスタンスを作成します。
new DataLakeServiceClient(url: string, pipeline: Pipeline)
パラメーター
- url
-
string
"https://myaccount.dfs.core.windows.net" など、Azure Storage Data Lake サービスを指すクライアント文字列。 "https://myaccount.dfs.core.windows.net?sasString" など、AnonymousCredential を使用している場合は SAS を追加できます。
- 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 Data Lake サービスを指すクライアント文字列。 "https://myaccount.dfs.core.windows.net?sasString" など、AnonymousCredential を使用している場合は SAS を追加できます。
- 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://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 に関連付けられているリソースの種類を指定します。
省略可能なパラメーター。
戻り値
string
このクライアントによって表されるリソースへの URI と、生成された SAS トークンで構成されるアカウント SAS URI。
generateSasStringToSign(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)
共有キー資格情報を使用して構築された DataLakeServiceClient でのみ使用できます。
渡されたクライアントのプロパティとパラメーターに基づいて、アカウント Shared Access Signature (SAS) に署名する文字列を生成します。 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 に関連付けられているリソースの種類を指定します。
省略可能なパラメーター。
戻り値
string
このクライアントによって表されるリソースへの URI と、生成された SAS トークンで構成されるアカウント SAS URI。
getFileSystemClient(string)
DataLakeFileSystemClient オブジェクトを作成します。
function getFileSystemClient(fileSystemName: string): DataLakeFileSystemClient
パラメーター
- fileSystemName
-
string
ファイル システム名。
戻り値
getProperties(ServiceGetPropertiesOptions)
ストレージ アカウントの BLOB サービス エンドポイントのプロパティ (Storage Analytics および CORS (クロスオリジン リソース共有) ルールのプロパティを含む) を取得します。
https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties を参照してください
function getProperties(options?: ServiceGetPropertiesOptions): Promise<ServiceGetPropertiesResponse>
パラメーター
- options
- ServiceGetPropertiesOptions
サービスのプロパティの取得操作のオプション。
戻り値
Promise<DataLakeServiceGetPropertiesResponse>
サービスのプロパティの取得操作の応答データ。
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://learn.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 日以内である必要があります。
戻り値
Promise<ServiceGetUserDelegationKeyResponse>
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://learn.microsoft.com/en-us/rest/api/storageservices/list-containers2 を参照してください
function listFileSystems(options?: ServiceListFileSystemsOptions): PagedAsyncIterableIterator<FileSystemItem, ServiceListFileSystemsSegmentResponse, PageSettings>
パラメーター
- options
- ServiceListFileSystemsOptions
戻り値
setProperties(BlobServiceProperties, ServiceSetPropertiesOptions)
Storage Analytics のプロパティ、CORS (クロスオリジン リソース共有) ルール、論理的な削除設定など、ストレージ アカウントの BLOB サービス エンドポイントのプロパティを設定します。
https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties を参照してください
function setProperties(properties: BlobServiceProperties, options?: ServiceSetPropertiesOptions): Promise<ServiceSetPropertiesResponse>
パラメーター
- properties
- DataLakeServiceProperties
- options
- ServiceSetPropertiesOptions
サービス セットのプロパティ操作のオプション。
戻り値
Promise<ServiceSetPropertiesResponse>
サービス セットのプロパティ操作の応答データ。
undeleteFileSystem(string, string, ServiceUndeleteFileSystemOptions)
以前に削除したファイル システムを復元します。 この API は、ストレージ アカウントに対してコンテナーの論理的な削除が有効になっている場合にのみ機能します。
function undeleteFileSystem(deletedFileSystemName: string, deleteFileSystemVersion: string, options?: ServiceUndeleteFileSystemOptions): Promise<{ fileSystemClient: DataLakeFileSystemClient, fileSystemUndeleteResponse: ContainerUndeleteResponse }>
パラメーター
- deletedFileSystemName
-
string
ソース ファイル システムの名前。
- deleteFileSystemVersion
-
string
ファイル システムの新しい名前。
- options
- ServiceUndeleteFileSystemOptions
ファイル システムの復元操作を構成するためのオプション。
戻り値
Promise<{ fileSystemClient: DataLakeFileSystemClient, fileSystemUndeleteResponse: ContainerUndeleteResponse }>