com.microsoft.azure.storage.blob.BlobContainerPermissions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-storage Show documentation
Show all versions of azure-storage Show documentation
SDK for Microsoft Azure Storage Clients
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.azure.storage.blob;
import com.microsoft.azure.storage.Permissions;
/**
* Represents the permissions for a container.
*
* The container's permissions encompass two types of access settings for the container:
*
* - The container's public access setting, represented by the {@link #publicAccess} property. The public access
* setting indicates whether the container and its blobs can be read via an anonymous request.
* - The container's access policies, represented by the {@link #getSharedAccessPolicies} method. This setting
* references a collection of shared access policies for the container. A shared access policy may be used to control
* the start time, expiry time, and permissions for one or more shared access signatures. A shared access signature
* provides delegated access to the container's resources.
*
* For more information on managing container permissions, see Managing Access to Containers and Blobs.
*/
public final class BlobContainerPermissions extends Permissions {
/**
* Represents the public access setting for the container.
*/
private BlobContainerPublicAccessType publicAccess;
/**
* Creates an instance of the BlobContainerPermissions
class.
*/
public BlobContainerPermissions() {
super();
this.setPublicAccess(BlobContainerPublicAccessType.OFF);
}
/**
* Gets the public access setting for the container.
*
* The public access setting indicates whether the container and its blobs can be read via an anonymous request.
*
* The {@link BlobContainerPublicAccessType} enumeration provides three levels of anonymous read access:
*
* - {@link BlobContainerPublicAccessType#OFF}, which prevents anonymous access.
* - {@link BlobContainerPublicAccessType#BLOB}, which permits anonymous read access to blob resources, but not to
* container metadata or to the list of blobs in the container.
* - {@link BlobContainerPublicAccessType#CONTAINER}, which permits anonymous read access to blob resources,
* container metadata, and the list of blobs in the container.
*
* For more information on managing anonymous access to Blob service resources, see Setting Access Control for Containers.
*/
public BlobContainerPublicAccessType getPublicAccess() {
return this.publicAccess;
}
/**
* Sets the public access setting for the container.
*
* The public access setting indicates whether the container and its blobs can be read via an anonymous request.
*
* The {@link BlobContainerPublicAccessType} enumeration provides three levels of anonymous read access:
*
* - {@link BlobContainerPublicAccessType#OFF}, which prevents anonymous access.
* - {@link BlobContainerPublicAccessType#BLOB}, which permits anonymous read access to blob resources, but not to
* container metadata or to the list of blobs in the container.
* - {@link BlobContainerPublicAccessType#CONTAINER}, which permits anonymous read access to blob resources,
* container metadata, and the list of blobs in the container.
*
* For more information on managing anonymous access to Blob service resources, see Setting Access Control for Containers.
*/
public void setPublicAccess(final BlobContainerPublicAccessType publicAccess) {
this.publicAccess = publicAccess;
}
}