Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataLakeServiceClient

Package version

DataLakeServiceClient allows you to manipulate Azure Data Lake service resources and file systems. The storage account provides the top-level namespace for the Data Lake service.

export

Hierarchy

Index

Constructors

constructor

Properties

accountName

accountName: string

Protected blobEndpointUrl

blobEndpointUrl: string

Encoded URL string value for corresponding blob endpoint.

memberof

StorageClient

credential

credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential

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.

memberof

StorageClient

Protected dfsEndpointUrl

dfsEndpointUrl: string

Encoded URL string value for corresponding dfs endpoint.

memberof

StorageClient

Protected isHttps

isHttps: boolean
memberof

StorageClient

Protected storageClientContext

storageClientContext: StorageClientContext

StorageClient is a reference to protocol layer operations entry, which is generated by AutoRest generator.

memberof

StorageClient

Protected storageClientContextToBlobEndpoint

storageClientContextToBlobEndpoint: StorageClientContext

storageClientContextWithBlobEndpoint is a reference to protocol layer operations entry, which is generated by AutoRest generator, with its url pointing to the Blob endpoint.

memberof

StorageClient

url

url: string

Encoded URL string value.

memberof

StorageClient

Methods

generateAccountSasUrl

getFileSystemClient

getUserDelegationKey

  • ONLY AVAILABLE WHEN USING BEARER TOKEN AUTHENTICATION (TokenCredential).

    Retrieves a user delegation key for the Data Lake service. This is only a valid operation when using bearer token authentication.

    example
    // 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 >= 2018-11-09 to generate user delegation SAS
      },
      userDelegationKey, // UserDelegationKey
      accountName
    ).toString();
    see

    https://docs.microsoft.com/en-us/rest/api/storageservices/get-user-delegation-key

    memberof

    DataLakeServiceClient

    Parameters

    • startsOn: Date

      The start time for the user delegation SAS. Must be within 7 days of the current time.

    • expiresOn: Date

      The end time for the user delegation SAS. Must be within 7 days of the current time.

    • Default value options: ServiceGetUserDelegationKeyOptions = {}

    Returns Promise<ServiceGetUserDelegationKeyResponse>

listFileSystems

  • Returns an async iterable iterator to list all the file systems under the specified account.

    .byPage() returns an async iterable iterator to list the file systems in pages.

    Example using for await syntax:

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

    Example using 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();
    }

    Example using 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}`);
        }
      }
    }

    Example using paging with a marker:

    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}`);
      }
    }
    see

    https://docs.microsoft.com/en-us/rest/api/storageservices/list-containers2

    memberof

    DataLakeServiceClient

    Parameters

    Returns PagedAsyncIterableIterator<FileSystemItem, ServiceListFileSystemsSegmentResponse>

undeleteFileSystem

Static fromConnectionString

  • Creates an instance of DataLakeServiceClient from connection string.

    memberof

    DataLakeServiceClient

    Parameters

    • connectionString: string

      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

    • Optional options: StoragePipelineOptions

    Returns DataLakeServiceClient

Generated using TypeDoc