ServiceURL class

A ServiceURL represents a URL to the Azure Storage Blob service allowing you to manipulate blob containers.

Extends

Constructors

ServiceURL(string, Pipeline)

Creates an instance of ServiceURL.

Inherited Properties

credential

Credential used for authentication and authorization.

url

Encoded URL string value.

Methods

getAccountInfo(Aborter)

The Get Account Information operation returns the sku name and account kind for the specified account. The Get Account Information operation is available on service versions beginning with version 2018-03-28.

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information

getProperties(Aborter)

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

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties}

getStatistics(Aborter)

Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats}

getUserDelegationKey(Aborter, Date, Date)

ONLY AVAILABLE WHEN USING BEARER TOKEN AUTHENTICATION (TokenCredential).

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

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

listContainersSegment(Aborter, string, IServiceListContainersSegmentOptions)

Returns a list of the containers under the specified account.

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

setProperties(Aborter, StorageServiceProperties)

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://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties}

submitBatch(Aborter, BatchRequest, ServiceSubmitBatchOptionalParams)

Submit batch request which consists of multiple subrequests.

Example

let batchDeleteRequest = new BatchDeleteRequest();
await batchDeleteRequest.addSubRequest(urlInString0, credential0);
await batchDeleteRequest.addSubRequest(urlInString1, credential1, {
 deleteSnapshots: "include"
});
const deleteBatchResp = await serviceURL.submitBatch(Aborter.none, batchDeleteRequest);
console.log(deleteBatchResp.subResponsesSucceededCount);

Example

let batchSetTierRequest = new BatchSetTierRequest();
await batchSetTierRequest.addSubRequest(blockBlobURL0, "Cool");
await batchSetTierRequest.addSubRequest(blockBlobURL1, "Cool", {
 leaseAccessConditions: { leaseId: leaseId }
});
const setTierBatchResp = await serviceURL.submitBatch(Aborter.none, batchSetTierRequest);
console.log(setTierBatchResp.subResponsesSucceededCount);

See https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch

withPipeline(Pipeline)

Creates a new ServiceURL object identical to the source but with the specified request policy pipeline.

Inherited Methods

newPipeline(Credential, INewPipelineOptions)

A static method used to create a new Pipeline object with Credential provided.

Constructor Details

ServiceURL(string, Pipeline)

Creates an instance of ServiceURL.

new ServiceURL(url: string, pipeline: Pipeline)

Parameters

url

string

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

pipeline
Pipeline

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

Inherited Property Details

credential

Credential used for authentication and authorization.

credential: Credential

Property Value

Inherited From StorageURL.credential

url

Encoded URL string value.

url: string

Property Value

string

Inherited From StorageURL.url

Method Details

getAccountInfo(Aborter)

The Get Account Information operation returns the sku name and account kind for the specified account. The Get Account Information operation is available on service versions beginning with version 2018-03-28.

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information

function getAccountInfo(aborter: Aborter): Promise<ServiceGetAccountInfoResponse>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

Returns

getProperties(Aborter)

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

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties}

function getProperties(aborter: Aborter): Promise<ServiceGetPropertiesResponse>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

Returns

getStatistics(Aborter)

Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats}

function getStatistics(aborter: Aborter): Promise<ServiceGetStatisticsResponse>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

Returns

getUserDelegationKey(Aborter, Date, Date)

ONLY AVAILABLE WHEN USING BEARER TOKEN AUTHENTICATION (TokenCredential).

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

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

function getUserDelegationKey(aborter: Aborter, start: Date, expiry: Date): Promise<ServiceGetUserDelegationKeyResponse>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

start

Date

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

expiry

Date

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

Returns

listContainersSegment(Aborter, string, IServiceListContainersSegmentOptions)

Returns a list of the containers under the specified account.

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

function listContainersSegment(aborter: Aborter, marker?: string, options?: IServiceListContainersSegmentOptions): Promise<ServiceListContainersSegmentResponse>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

marker

string

A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.

Returns

setProperties(Aborter, StorageServiceProperties)

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://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties}

function setProperties(aborter: Aborter, properties: StorageServiceProperties): Promise<ServiceSetPropertiesResponse>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

Returns

submitBatch(Aborter, BatchRequest, ServiceSubmitBatchOptionalParams)

Submit batch request which consists of multiple subrequests.

Example

let batchDeleteRequest = new BatchDeleteRequest();
await batchDeleteRequest.addSubRequest(urlInString0, credential0);
await batchDeleteRequest.addSubRequest(urlInString1, credential1, {
 deleteSnapshots: "include"
});
const deleteBatchResp = await serviceURL.submitBatch(Aborter.none, batchDeleteRequest);
console.log(deleteBatchResp.subResponsesSucceededCount);

Example

let batchSetTierRequest = new BatchSetTierRequest();
await batchSetTierRequest.addSubRequest(blockBlobURL0, "Cool");
await batchSetTierRequest.addSubRequest(blockBlobURL1, "Cool", {
 leaseAccessConditions: { leaseId: leaseId }
});
const setTierBatchResp = await serviceURL.submitBatch(Aborter.none, batchSetTierRequest);
console.log(setTierBatchResp.subResponsesSucceededCount);

See https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch

function submitBatch(aborter: Aborter, batchRequest: BatchRequest, options?: ServiceSubmitBatchOptionalParams): Promise<ServiceSubmitBatchResponse>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation.

batchRequest
BatchRequest

Supported batch request: BatchDeleteRequest or BatchSetTierRequest.

Returns

withPipeline(Pipeline)

Creates a new ServiceURL object identical to the source but with the specified request policy pipeline.

function withPipeline(pipeline: Pipeline): ServiceURL

Parameters

pipeline
Pipeline

Returns

Inherited Method Details

newPipeline(Credential, INewPipelineOptions)

A static method used to create a new Pipeline object with Credential provided.

static function newPipeline(credential: Credential, pipelineOptions?: INewPipelineOptions): Pipeline

Parameters

credential
Credential

Such as AnonymousCredential, SharedKeyCredential or TokenCredential.

pipelineOptions
INewPipelineOptions

Optional. Options.

Returns

A new Pipeline object.

Inherited From StorageURL.newPipeline