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. |
Properties
credential | Credential used for authentication and authorization. |
pipeline | Request policy pipeline. |
url | Encoded URL string value. |
Methods
acquire |
Establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. |
break |
To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired. |
change |
To change the ID of an existing lease. |
create(Aborter, IContainer |
Creates a new container under the specified account. If the container with the same name already exists, the operation fails. |
delete(Aborter, IContainer |
Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. |
from |
Creates a ContainerURL object from ServiceURL |
get |
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". |
get |
Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. |
list |
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. |
list |
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. |
new |
A static method used to create a new Pipeline object with Credential provided. |
release |
To free the lease if it is no longer needed so that another client may immediately acquire a lease against the container. |
renew |
To renew an existing lease. |
set |
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. |
set |
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. |
with |
Creates a new ContainerURL object identical to the source but with the specified request policy pipeline. |
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.
Property Details
credential
Credential used for authentication and authorization.
credential: Credential
Property Value
pipeline
url
Encoded URL string value.
url: string
Property Value
string
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.
function acquireLease(aborter: Aborter, proposedLeaseId: string, duration: number, options?: IContainerAcquireLeaseOptions)
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)
- options
- IContainerAcquireLeaseOptions
Returns
Promise<Models.ContainerAcquireLeaseResponse>
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.
function breakLease(aborter: Aborter, period: number, options?: IContainerBreakLeaseOptions)
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
- options
- IContainerBreakLeaseOptions
Returns
Promise<Models.ContainerBreakLeaseResponse>
changeLease(Aborter, string, string, IContainerChangeLeaseOptions)
To change the ID of an existing lease.
function changeLease(aborter: Aborter, leaseId: string, proposedLeaseId: string, options?: IContainerChangeLeaseOptions)
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
- options
- IContainerChangeLeaseOptions
Returns
Promise<Models.ContainerChangeLeaseResponse>
create(Aborter, IContainerCreateOptions)
Creates a new container under the specified account. If the container with the same name already exists, the operation fails.
function create(aborter: Aborter, options?: IContainerCreateOptions)
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- options
- IContainerCreateOptions
Returns
Promise<Models.ContainerCreateResponse>
delete(Aborter, IContainerDeleteMethodOptions)
Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.
function delete(aborter: Aborter, options?: IContainerDeleteMethodOptions)
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- options
- IContainerDeleteMethodOptions
Returns
Promise<Models.ContainerDeleteResponse>
fromServiceURL(ServiceURL, string)
Creates a ContainerURL object from ServiceURL
static function fromServiceURL(serviceURL: ServiceURL, containerName: string)
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".
function getAccessPolicy(aborter: Aborter, options?: IContainerGetAccessPolicyOptions)
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- options
- IContainerGetAccessPolicyOptions
Returns
Promise<ContainerGetAccessPolicyResponse>
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.
function getProperties(aborter: Aborter, options?: IContainerGetPropertiesOptions)
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- options
- IContainerGetPropertiesOptions
Returns
Promise<Models.ContainerGetPropertiesResponse>
listBlobFlatSegment(Aborter, undefined | 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.
function listBlobFlatSegment(aborter: Aborter, marker?: undefined | string, options?: IContainerListBlobsSegmentOptions)
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
-
undefined | string
Returns
Promise<Models.ContainerListBlobFlatSegmentResponse>
listBlobHierarchySegment(Aborter, string, undefined | 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.
function listBlobHierarchySegment(aborter: Aborter, delimiter: string, marker?: undefined | string, options?: IContainerListBlobsSegmentOptions)
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
-
undefined | string
Returns
Promise<Models.ContainerListBlobHierarchySegmentResponse>
newPipeline(Credential, INewPipelineOptions)
A static method used to create a new Pipeline object with Credential provided.
static function newPipeline(credential: Credential, pipelineOptions?: INewPipelineOptions)
Parameters
- credential
- Credential
Such as AnonymousCredential, SharedKeyCredential or TokenCredential.
- pipelineOptions
- INewPipelineOptions
Returns
A new Pipeline object.
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.
function releaseLease(aborter: Aborter, leaseId: string, options?: IContainerReleaseLeaseOptions)
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
- options
- IContainerReleaseLeaseOptions
Returns
Promise<Models.ContainerReleaseLeaseResponse>
renewLease(Aborter, string, IContainerRenewLeaseOptions)
To renew an existing lease.
function renewLease(aborter: Aborter, leaseId: string, options?: IContainerRenewLeaseOptions)
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
- options
- IContainerRenewLeaseOptions
Returns
Promise<Models.ContainerRenewLeaseResponse>
setAccessPolicy(Aborter, Models.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.
function setAccessPolicy(aborter: Aborter, access?: Models.PublicAccessType, containerAcl?: ISignedIdentifier[], options?: IContainerSetAccessPolicyOptions)
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- access
- Models.PublicAccessType
- containerAcl
- options
- IContainerSetAccessPolicyOptions
Returns
Promise<Models.ContainerSetAccessPolicyResponse>
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.
function setMetadata(aborter: Aborter, metadata?: IMetadata, options?: IContainerSetMetadataOptions)
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
- options
- IContainerSetMetadataOptions
Returns
Promise<Models.ContainerSetMetadataResponse>
withPipeline(Pipeline)
Creates a new ContainerURL object identical to the source but with the specified request policy pipeline.
function withPipeline(pipeline: Pipeline)
Parameters
- pipeline
- Pipeline
Returns
Azure SDK for JavaScript
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for