當前位置: 首頁>>代碼示例>>Java>>正文


Java SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法代碼示例

本文整理匯總了Java中com.microsoft.azure.storage.core.SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法的典型用法代碼示例。如果您正苦於以下問題:Java SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法的具體用法?Java SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue怎麽用?Java SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.microsoft.azure.storage.core.SharedAccessSignatureHelper的用法示例。


在下文中一共展示了SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateSharedAccessSignature

import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的package包/類
/**
 * Returns a shared access signature for the queue.
 * 
 * @param policy
 *            The access policy for the shared access signature.
 * @param groupPolicyIdentifier
 *            A queue-level access policy.
 * @return A shared access signature for the queue.
 * @throws InvalidKeyException
 *             If an invalid key was passed.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws IllegalArgumentException
 *             If an unexpected value is passed.
 */
public String generateSharedAccessSignature(final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
        final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
        throw new IllegalArgumentException(errorMessage);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(policy,
            groupPolicyIdentifier, resourceName, this.queueServiceClient, null);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(policy,
            groupPolicyIdentifier, signature);

    return builder.toString();
}
 
開發者ID:horizon-institute,項目名稱:runspotrun-android-client,代碼行數:34,代碼來源:CloudQueue.java

示例2: generateSharedAccessSignature

import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的package包/類
/**
 * Returns a shared access signature for the queue.
 * 
 * @param policy
 *            The access policy for the shared access signature.
 * @param groupPolicyIdentifier
 *            A queue-level access policy.
 * @param ipRange
 *            A {@link IPRange} object containing the range of allowed IP addresses.
 * @param protocols
 *            A {@link SharedAccessProtocols} representing the allowed Internet protocols.
 *            
 * @return A shared access signature for the queue.
 * 
 * @throws InvalidKeyException
 *             If an invalid key was passed.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws IllegalArgumentException
 *             If an unexpected value is passed.
 */
public String generateSharedAccessSignature(
        final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
        final SharedAccessProtocols protocols)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
        final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
        throw new IllegalArgumentException(errorMessage);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(
            policy, groupPolicyIdentifier, resourceName, ipRange, protocols, this.queueServiceClient);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(
            policy, groupPolicyIdentifier, ipRange, protocols, signature);

    return builder.toString();
}
 
開發者ID:Azure,項目名稱:azure-storage-android,代碼行數:42,代碼來源:CloudQueue.java


注:本文中的com.microsoft.azure.storage.core.SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。