A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/javascript/api/@azure/storage-file-datalake/datalakeserviceclient below:

DataLakeServiceClient class | Microsoft Learn

DataLakeServiceClient class

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.

Inherited Properties accountName credential

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.

url

Encoded URL string value.

Methods fromConnectionString(string, StoragePipelineOptions)

Creates an instance of DataLakeServiceClient from connection string.

generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

Only available for DataLakeServiceClient constructed with a shared key credential.

Generates an account Shared Access Signature (SAS) URI based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.

See https://learn.microsoft.com/rest/api/storageservices/create-account-sas

generateSasStringToSign(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

Only available for DataLakeServiceClient constructed with a shared key credential.

Generates string to sign for an account Shared Access Signature (SAS) based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.

See https://learn.microsoft.com/rest/api/storageservices/create-account-sas

getFileSystemClient(string)

Creates a DataLakeFileSystemClient object.

getProperties(ServiceGetPropertiesOptions)

Gets the properties of a storage account’s Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.

See https://learn.microsoft.com/rest/api/storageservices/get-blob-service-properties

getUserDelegationKey(Date, Date, ServiceGetUserDelegationKeyOptions)

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

import {
  DataLakeServiceClient,
  generateDataLakeSASQueryParameters,
  FileSystemSASPermissions,
  SASProtocol,
} from "@azure/storage-file-datalake";

const account = "<account>";
const sas = "<sas token>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net${sas}`,
);

const fileSystemName = "<file system name>";
const accountName = "<account name>";
const startsOn = new Date();
const expiresOn = new Date(+new Date() + 86400 * 1000);
// 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();

See https://learn.microsoft.com/rest/api/storageservices/get-user-delegation-key

listFileSystems(ServiceListFileSystemsOptions)

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:

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
const fileSystems = datalakeServiceClient.listFileSystems();
for await (const fileSystem of fileSystems) {
  console.log(`File system ${i++}: ${fileSystem.name}`);
}

Example using iter.next():

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
const fileSystems = datalakeServiceClient.listFileSystems();
let { value, done } = await fileSystems.next();
while (!done) {
  console.log(`File system ${i++}: ${value.name}`);
  ({ value, done } = await fileSystems.next());
}

Example using byPage():

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
for await (const response of datalakeServiceClient.listFileSystems().byPage({ maxPageSize: 20 })) {
  if (response.fileSystemItems) {
    for (const fileSystem of response.fileSystemItems) {
      console.log(`File System ${i++}: ${fileSystem.name}`);
    }
  }
}

Example using paging with a marker:

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
let fileSystems = datalakeServiceClient.listFileSystems().byPage({ maxPageSize: 2 });
let response = (await fileSystems.next()).value;
// Prints 2 file systems
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
    console.log(`File system ${i++}: ${fileSystem.name}`);
  }
}
// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
fileSystems = datalakeServiceClient
  .listFileSystems()
  .byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await fileSystems.next()).value;
// Prints 10 file systems
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
    console.log(`File system ${i++}: ${fileSystem.name}`);
  }
}

See https://learn.microsoft.com/rest/api/storageservices/list-containers2

setProperties(BlobServiceProperties, ServiceSetPropertiesOptions)

Sets properties for a storage account’s Blob service endpoint, including properties for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings.

See https://learn.microsoft.com/rest/api/storageservices/set-blob-service-properties

undeleteFileSystem(string, string, ServiceUndeleteFileSystemOptions)

Restore a previously deleted File System. This API is only functional if Container Soft Delete is enabled for the storage account.

Constructor Details DataLakeServiceClient(string, Pipeline)

Creates an instance of DataLakeServiceClient from url and pipeline.

new DataLakeServiceClient(url: string, pipeline: Pipeline)
Parameters
url

string

A Client string pointing to Azure Storage data lake service, such as "https://myaccount.dfs.core.windows.net". You can append a SAS if using AnonymousCredential, such as "https://myaccount.dfs.core.windows.net?sasString".

pipeline
Pipeline

Call newPipeline() to create a default pipeline, or provide a customized pipeline.

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

Creates an instance of DataLakeServiceClient from url.

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

string

A Client string pointing to Azure Storage data lake service, such as "https://myaccount.dfs.core.windows.net". You can append a SAS if using AnonymousCredential, such as "https://myaccount.dfs.core.windows.net?sasString".

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.

Inherited Property Details accountName
accountName: string
Property Value

string

Inherited From StorageClient.accountName

credential

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.

credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential
Property Value

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

Inherited From StorageClient.credential

url

Encoded URL string value.

url: string
Property Value

string

Inherited From StorageClient.url

Method Details fromConnectionString(string, StoragePipelineOptions)

Creates an instance of DataLakeServiceClient from connection string.

static function fromConnectionString(connectionString: string, options?: StoragePipelineOptions): 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

Returns generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

Only available for DataLakeServiceClient constructed with a shared key credential.

Generates an account Shared Access Signature (SAS) URI based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.

See https://learn.microsoft.com/rest/api/storageservices/create-account-sas

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

Date

Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.

resourceTypes

string

Specifies the resource types associated with the shared access signature.

Returns

string

An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.

generateSasStringToSign(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)

Only available for DataLakeServiceClient constructed with a shared key credential.

Generates string to sign for an account Shared Access Signature (SAS) based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.

See https://learn.microsoft.com/rest/api/storageservices/create-account-sas

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

Date

Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.

resourceTypes

string

Specifies the resource types associated with the shared access signature.

Returns

string

An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.

getFileSystemClient(string)

Creates a DataLakeFileSystemClient object.

function getFileSystemClient(fileSystemName: string): DataLakeFileSystemClient
Parameters
fileSystemName

string

File system name.

Returns getProperties(ServiceGetPropertiesOptions) getUserDelegationKey(Date, Date, ServiceGetUserDelegationKeyOptions)

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

import {
  DataLakeServiceClient,
  generateDataLakeSASQueryParameters,
  FileSystemSASPermissions,
  SASProtocol,
} from "@azure/storage-file-datalake";

const account = "<account>";
const sas = "<sas token>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net${sas}`,
);

const fileSystemName = "<file system name>";
const accountName = "<account name>";
const startsOn = new Date();
const expiresOn = new Date(+new Date() + 86400 * 1000);
// 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();

See https://learn.microsoft.com/rest/api/storageservices/get-user-delegation-key

function getUserDelegationKey(startsOn: Date, expiresOn: Date, options?: ServiceGetUserDelegationKeyOptions): Promise<ServiceGetUserDelegationKeyResponse>
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.

Returns

Promise<ServiceGetUserDelegationKeyResponse>

listFileSystems(ServiceListFileSystemsOptions)

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:

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
const fileSystems = datalakeServiceClient.listFileSystems();
for await (const fileSystem of fileSystems) {
  console.log(`File system ${i++}: ${fileSystem.name}`);
}

Example using iter.next():

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
const fileSystems = datalakeServiceClient.listFileSystems();
let { value, done } = await fileSystems.next();
while (!done) {
  console.log(`File system ${i++}: ${value.name}`);
  ({ value, done } = await fileSystems.next());
}

Example using byPage():

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
for await (const response of datalakeServiceClient.listFileSystems().byPage({ maxPageSize: 20 })) {
  if (response.fileSystemItems) {
    for (const fileSystem of response.fileSystemItems) {
      console.log(`File System ${i++}: ${fileSystem.name}`);
    }
  }
}

Example using paging with a marker:

import { DataLakeServiceClient } from "@azure/storage-file-datalake";
import { DefaultAzureCredential } from "@azure/identity";

const account = "<account>";
const datalakeServiceClient = new DataLakeServiceClient(
  `https://${account}.dfs.core.windows.net`,
  new DefaultAzureCredential(),
);

let i = 1;
let fileSystems = datalakeServiceClient.listFileSystems().byPage({ maxPageSize: 2 });
let response = (await fileSystems.next()).value;
// Prints 2 file systems
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
    console.log(`File system ${i++}: ${fileSystem.name}`);
  }
}
// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
fileSystems = datalakeServiceClient
  .listFileSystems()
  .byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await fileSystems.next()).value;
// Prints 10 file systems
if (response.fileSystemItems) {
  for (const fileSystem of response.fileSystemItems) {
    console.log(`File system ${i++}: ${fileSystem.name}`);
  }
}

See https://learn.microsoft.com/rest/api/storageservices/list-containers2

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

PagedAsyncIterableIterator<FileSystemItem, ServiceListFileSystemsSegmentResponse, PageSettings>

setProperties(BlobServiceProperties, ServiceSetPropertiesOptions) undeleteFileSystem(string, string, ServiceUndeleteFileSystemOptions)

Restore a previously deleted File System. This API is only functional if Container Soft Delete is enabled for the storage account.

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

string

The name of the source File System.

deleteFileSystemVersion

string

The new name of the File System.

Returns

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4