All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.storage.SharedAccessAccountPolicy Maven / Gradle / Ivy

There is a newer version: 8.6.6
Show newest version
/**
 * 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;

import java.util.EnumSet;

/**
 * Represents a shared access policy, which specifies the start time, expiry time,
 * and permissions for a shared access signature.
 */
public final class SharedAccessAccountPolicy extends SharedAccessPolicy {
    /**
     *  The permissions for a shared access signature associated with this shared access policy.
     */
    private EnumSet permissions;

    /**
     * The services (blob, file, queue, table) for a shared access signature associated with this shared access policy.
     */
    private EnumSet services;

    /**
     * The resource type for a shared access signature associated with this shared access policy.
     */
    private EnumSet resourceTypes;
    
    /**
     * The allowed IP addresses for a shared access signature associated with this shared access policy.
     */
    private IPRange range;
    
    /**
     * The allowed protocols for a shared access signature associated with this shared access policy.
     */
    private SharedAccessProtocols protocols;
    
    /**
     * Gets the permissions for a shared access signature associated with this shared access policy.
     * 
     * @return the permissions
     */
    public EnumSet getPermissions() {
        return this.permissions;
    }

    /**
     * Gets the services (blob, file, queue, table) for a shared access signature associated with
     * this shared access policy.
     * 
     * @return the services
     */
    public EnumSet getServices() {
        return this.services;
    }

    /**
     * Gets the resource type for a shared access signature associated with this shared access policy.
     * 
     * @return the resourceTypes
     */
    public EnumSet getResourceTypes() {
        return this.resourceTypes;
    }

    /**
     * Gets the allowed IP addresses for a shared access signature associated with this shared access policy.
     * 
     * @return A {@link IPRange} object containing the range of IP addresses.
     */
    public IPRange getRange() {
        return range;
    }

    /**
     * Gets the allowed protocols for a shared access signature associated with this shared access policy.
     * 
     * @return A {@link SharedAccessProtocols} representing the chosen Internet protocols.
     */
    public SharedAccessProtocols getProtocols() {
        return protocols;
    }
    
    /**
     * Sets the permissions for a shared access signature associated with this shared access policy.
     * 
     * @param permissions
     *            the permissions to set
     */
    public void setPermissions(EnumSet permissions) {
        this.permissions = permissions;
    }

    /**
     * Sets the services (blob, file, queue, table) for a shared access signature associated with
     * this shared access policy.
     * 
     * @param services
     *            the services to set
     */
    public void setServices(EnumSet services) {
        this.services = services;
    }

    /**
     * Sets the resource type for a shared access signature associated with this shared access policy.
     * 
     * @param resourceTypes
     *            the resourceTypes to set
     */
    public void setResourceTypes(EnumSet resourceTypes) {
        this.resourceTypes = resourceTypes;
    }

    /**
     * Sets the allowed IP addresses for a shared access signature associated with this shared access policy.
     * 
     * @param range
     *        A {@link IPRange} object containing the range of IP addresses.
     */
    public void setRange(IPRange range) {
        this.range = range;
    }

    /**
     * Sets the allowed protocols for a shared access signature associated with this shared access policy.
     * 
     * @param protocols
     *        A {@link SharedAccessProtocols} representing the chosen Internet protocols.
     */
    public void setProtocols(SharedAccessProtocols protocols) {
        this.protocols = protocols;
    }

    /**
     * Converts this shared access policy's permissions to a String.
     * 
     * @return A String which represents the shared access permissions.
     */
    public String permissionsToString() {
        return SharedAccessAccountPermissions.permissionsToString(this.getPermissions());
    }

    /**
     * Converts this shared access policy's resource types to a String.
     * 
     * @return A String which represents the shared access permissions.
     */
    public String resourceTypesToString() {
        return SharedAccessAccountResourceType.resourceTypesToString(this.getResourceTypes());
    }

    /**
     * Converts this shared access policy's services to a String.
     * 
     * @return A String which represents the shared access permissions.
     */
    public String servicesToString() {
        return SharedAccessAccountService.servicesToString(this.getServices());
    }

    /**
     * Sets shared access permissions using the specified permissions String.
     * 
     * @param value
     *        A String which represents the shared access permissions.
     **/
    public void setPermissionsFromString(final String value) {
        this.setPermissions(SharedAccessAccountPermissions.permissionsFromString(value));
    }
    
    /**
     * Sets shared access resource types using the specified resource types String.
     * 
     * @param value
     *        A String which represents the shared access resource types.
     **/
    public void setResourceTypeFromString(final String value) {
        this.setResourceTypes(SharedAccessAccountResourceType.resourceTypesFromString(value));
    }

    /**
     * Sets shared access services using the specified services String.
     * 
     * @param value
     *        A String which represents the shared access services.
     **/
    public void setServiceFromString(final String value) {
        this.setServices(SharedAccessAccountService.servicesFromString(value));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy