ContainerURL class

A ContainerURL represents a URL to the Azure Storage container allowing you to manipulate its blobs.

Extends

Constructors

ContainerURL(string, Pipeline)

Creates an instance of ContainerURL.

Inherited Properties

credential

Credential used for authentication and authorization.

url

Encoded URL string value.

Methods

acquireLease(Aborter, string, number, IContainerAcquireLeaseOptions)

Establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

breakLease(Aborter, number, IContainerBreakLeaseOptions)

To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

changeLease(Aborter, string, string, IContainerChangeLeaseOptions)

To change the ID of an existing lease.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

create(Aborter, IContainerCreateOptions)

Creates a new container under the specified account. If the container with the same name already exists, the operation fails.

See https://docs.microsoft.com/en-us/rest/api/storageservices/create-container

delete(Aborter, IContainerDeleteMethodOptions)

Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.

See https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container

fromServiceURL(ServiceURL, string)

Creates a ContainerURL object from ServiceURL

getAccessPolicy(Aborter, IContainerGetAccessPolicyOptions)

Gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly.

WARNING: JavaScript Date will potential lost precision when parsing start and expiry string. For example, new Date("2018-12-31T03:44:23.8827891Z").toISOString() will get "2018-12-31T03:44:23.882Z".

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-acl

getProperties(Aborter, IContainerGetPropertiesOptions)

Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs.

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

listBlobFlatSegment(Aborter, string, IContainerListBlobsSegmentOptions)

listBlobFlatSegment returns a single segment of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. After getting a segment, process it, and then call ListBlobsFlatSegment again (passing the the previously-returned Marker) to get the next segment.

See https://docs.microsoft.com/rest/api/storageservices/list-blobs

listBlobHierarchySegment(Aborter, string, string, IContainerListBlobsSegmentOptions)

listBlobHierarchySegment returns a single segment of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. After getting a segment, process it, and then call ListBlobsHierarchicalSegment again (passing the the previously-returned Marker) to get the next segment.

See https://docs.microsoft.com/rest/api/storageservices/list-blobs

releaseLease(Aborter, string, IContainerReleaseLeaseOptions)

To free the lease if it is no longer needed so that another client may immediately acquire a lease against the container.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

renewLease(Aborter, string, IContainerRenewLeaseOptions)

To renew an existing lease.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

setAccessPolicy(Aborter, PublicAccessType, ISignedIdentifier[], IContainerSetAccessPolicyOptions)

Sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly.

When you set permissions for a container, the existing permissions are replaced. If no access or containerAcl provided, the existing container ACL will be removed.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-acl

setMetadata(Aborter, IMetadata, IContainerSetMetadataOptions)

Sets one or more user-defined name-value pairs for the specified container.

If no option provided, or no metadata defined in the parameter, the container metadata will be removed.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-metadata

withPipeline(Pipeline)

Creates a new ContainerURL 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

ContainerURL(string, Pipeline)

Creates an instance of ContainerURL.

new ContainerURL(url: string, pipeline: Pipeline)

Parameters

url

string

A URL string pointing to Azure Storage blob container, such as "https://myaccount.blob.core.windows.net/mycontainer". You can append a SAS if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net/mycontainer?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

acquireLease(Aborter, string, number, IContainerAcquireLeaseOptions)

Establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

function acquireLease(aborter: Aborter, proposedLeaseId: string, duration: number, options?: IContainerAcquireLeaseOptions): Promise<ContainerAcquireLeaseResponse>

Parameters

aborter
Aborter

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

proposedLeaseId

string

Can be specified in any valid GUID string format

duration

number

Must be between 15 to 60 seconds, or infinite (-1)

Returns

breakLease(Aborter, number, IContainerBreakLeaseOptions)

To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

function breakLease(aborter: Aborter, period: number, options?: IContainerBreakLeaseOptions): Promise<ContainerBreakLeaseResponse>

Parameters

aborter
Aborter

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

period

number

break period

Returns

changeLease(Aborter, string, string, IContainerChangeLeaseOptions)

To change the ID of an existing lease.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

function changeLease(aborter: Aborter, leaseId: string, proposedLeaseId: string, options?: IContainerChangeLeaseOptions): Promise<ContainerChangeLeaseResponse>

Parameters

aborter
Aborter

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

leaseId

string

proposedLeaseId

string

Returns

create(Aborter, IContainerCreateOptions)

Creates a new container under the specified account. If the container with the same name already exists, the operation fails.

See https://docs.microsoft.com/en-us/rest/api/storageservices/create-container

function create(aborter: Aborter, options?: IContainerCreateOptions): Promise<ContainerCreateResponse>

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

delete(Aborter, IContainerDeleteMethodOptions)

Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.

See https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container

function delete(aborter: Aborter, options?: IContainerDeleteMethodOptions): Promise<ContainerDeleteResponse>

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

fromServiceURL(ServiceURL, string)

Creates a ContainerURL object from ServiceURL

static function fromServiceURL(serviceURL: ServiceURL, containerName: string): ContainerURL

Parameters

serviceURL
ServiceURL

A ServiceURL object

containerName

string

A container name

Returns

getAccessPolicy(Aborter, IContainerGetAccessPolicyOptions)

Gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly.

WARNING: JavaScript Date will potential lost precision when parsing start and expiry string. For example, new Date("2018-12-31T03:44:23.8827891Z").toISOString() will get "2018-12-31T03:44:23.882Z".

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-acl

function getAccessPolicy(aborter: Aborter, options?: IContainerGetAccessPolicyOptions): Promise<ContainerGetAccessPolicyResponse>

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, IContainerGetPropertiesOptions)

Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs.

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

function getProperties(aborter: Aborter, options?: IContainerGetPropertiesOptions): Promise<ContainerGetPropertiesResponse>

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

listBlobFlatSegment(Aborter, string, IContainerListBlobsSegmentOptions)

listBlobFlatSegment returns a single segment of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. After getting a segment, process it, and then call ListBlobsFlatSegment again (passing the the previously-returned Marker) to get the next segment.

See https://docs.microsoft.com/rest/api/storageservices/list-blobs

function listBlobFlatSegment(aborter: Aborter, marker?: string, options?: IContainerListBlobsSegmentOptions): Promise<ContainerListBlobFlatSegmentResponse>

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

Returns

listBlobHierarchySegment(Aborter, string, string, IContainerListBlobsSegmentOptions)

listBlobHierarchySegment returns a single segment of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. After getting a segment, process it, and then call ListBlobsHierarchicalSegment again (passing the the previously-returned Marker) to get the next segment.

See https://docs.microsoft.com/rest/api/storageservices/list-blobs

function listBlobHierarchySegment(aborter: Aborter, delimiter: string, marker?: string, options?: IContainerListBlobsSegmentOptions): Promise<ContainerListBlobHierarchySegmentResponse>

Parameters

aborter
Aborter

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

delimiter

string

marker

string

Returns

releaseLease(Aborter, string, IContainerReleaseLeaseOptions)

To free the lease if it is no longer needed so that another client may immediately acquire a lease against the container.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

function releaseLease(aborter: Aborter, leaseId: string, options?: IContainerReleaseLeaseOptions): Promise<ContainerReleaseLeaseResponse>

Parameters

aborter
Aborter

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

leaseId

string

Returns

renewLease(Aborter, string, IContainerRenewLeaseOptions)

To renew an existing lease.

See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container

function renewLease(aborter: Aborter, leaseId: string, options?: IContainerRenewLeaseOptions): Promise<ContainerRenewLeaseResponse>

Parameters

aborter
Aborter

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

leaseId

string

Returns

setAccessPolicy(Aborter, PublicAccessType, ISignedIdentifier[], IContainerSetAccessPolicyOptions)

Sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly.

When you set permissions for a container, the existing permissions are replaced. If no access or containerAcl provided, the existing container ACL will be removed.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-acl

function setAccessPolicy(aborter: Aborter, access?: PublicAccessType, containerAcl?: ISignedIdentifier[], options?: IContainerSetAccessPolicyOptions): Promise<ContainerSetAccessPolicyResponse>

Parameters

aborter
Aborter

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

containerAcl

ISignedIdentifier[]

Returns

setMetadata(Aborter, IMetadata, IContainerSetMetadataOptions)

Sets one or more user-defined name-value pairs for the specified container.

If no option provided, or no metadata defined in the parameter, the container metadata will be removed.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-metadata

function setMetadata(aborter: Aborter, metadata?: IMetadata, options?: IContainerSetMetadataOptions): Promise<ContainerSetMetadataResponse>

Parameters

aborter
Aborter

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

metadata

IMetadata

Replace existing metadata with this value. If no value provided the existing metadata will be removed.

Returns

withPipeline(Pipeline)

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

function withPipeline(pipeline: Pipeline): ContainerURL

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