本文整理汇总了Java中com.microsoft.azure.storage.ServiceClient类的典型用法代码示例。如果您正苦于以下问题:Java ServiceClient类的具体用法?Java ServiceClient怎么用?Java ServiceClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceClient类属于com.microsoft.azure.storage包,在下文中一共展示了ServiceClient类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: signBlobQueueAndFileRequest
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signBlobQueueAndFileRequest(HttpURLConnection request, ServiceClient client,
long contentLength, OperationContext context) throws InvalidKeyException, StorageException {
if (client.getAuthenticationScheme() == AuthenticationScheme.SHAREDKEYFULL) {
StorageCredentialsHelper.signBlobAndQueueRequest(client.getCredentials(), request, contentLength, context);
}
else {
StorageCredentialsHelper.signBlobAndQueueRequestLite(client.getCredentials(), request, contentLength,
context);
}
}
示例2: signTableRequest
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signTableRequest(HttpURLConnection request, ServiceClient client, long contentLength,
OperationContext context) throws InvalidKeyException, StorageException {
if (client.getAuthenticationScheme() == AuthenticationScheme.SHAREDKEYFULL) {
StorageCredentialsHelper.signTableRequest(client.getCredentials(), request, contentLength, context);
}
else {
StorageCredentialsHelper.signTableRequestLite(client.getCredentials(), request, contentLength, context);
}
}
示例3: generateSharedAccessSignatureHashForQueueAndTable
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
* Get the signature hash embedded inside the Shared Access Signature for queue and table service.
*
* @param permissions
* The permissions for a shared access signature.
* @param startTime
* The start time for a shared access signature.
* @param expiryTime
* The expiry time for a shared access signature.
* @param resourceName
* The canonical resource string, unescaped.
* @param accessPolicyIdentifier
* An optional identifier for the policy.
* @param client
* Reference to the ServiceClient.
* @param opContext
* An object used to track the execution of the operation.
* @return
* the signature hash embedded inside the Shared Access Signature.
* @throws InvalidKeyException
* @throws StorageException
*/
private static String generateSharedAccessSignatureHashForQueueAndTable(final SharedAccessPolicy policy,
final String resourceName, final String accessPolicyIdentifier, final boolean useTableSas,
final String startPartitionKey, final String startRowKey, final String endPartitionKey,
final String endRowKey, final ServiceClient client, final OperationContext opContext)
throws InvalidKeyException, StorageException {
Utility.assertNotNullOrEmpty("resourceName", resourceName);
Utility.assertNotNull("client", client);
String permissions = null;
Date startTime = null;
Date expiryTime = null;
if (policy != null) {
permissions = policy.permissionsToString();
startTime = policy.getSharedAccessStartTime();
expiryTime = policy.getSharedAccessExpiryTime();
}
String stringToSign = String.format("%s\n%s\n%s\n%s\n%s\n%s", permissions == null ? Constants.EMPTY_STRING
: permissions, Utility.getUTCTimeOrEmpty(startTime), Utility.getUTCTimeOrEmpty(expiryTime),
resourceName, accessPolicyIdentifier == null ? Constants.EMPTY_STRING : accessPolicyIdentifier,
Constants.HeaderConstants.TARGET_STORAGE_VERSION);
if (useTableSas) {
stringToSign = String.format("%s\n%s\n%s\n%s\n%s", stringToSign,
startPartitionKey == null ? Constants.EMPTY_STRING : startPartitionKey,
startRowKey == null ? Constants.EMPTY_STRING : startRowKey,
endPartitionKey == null ? Constants.EMPTY_STRING : endPartitionKey,
endRowKey == null ? Constants.EMPTY_STRING : endRowKey);
}
stringToSign = Utility.safeDecode(stringToSign);
final String signature = StorageCredentialsHelper.computeHmac256(client.getCredentials(), stringToSign,
opContext);
// add logging
return signature;
}
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:61,代码来源:SharedAccessSignatureHelper.java
示例4: generateSharedAccessSignatureHashForBlobAndFile
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
* Get the signature hash embedded inside the Shared Access Signature for the blob or file service.
*
* @param policy
* The shared access policy to hash.
* @param headers
* The optional header values to set for a blob or file accessed with this shared access signature.
* @param accessPolicyIdentifier
* An optional identifier for the policy.
* @param resourceName
* The resource name.
* @param ipRange
* The range of IP addresses to hash.
* @param protocols
* The Internet protocols to hash.
* @param client
* The ServiceClient associated with the object.
*
* @return The signature hash embedded inside the Shared Access Signature.
* @throws InvalidKeyException
* @throws StorageException
*/
public static String generateSharedAccessSignatureHashForBlobAndFile(final SharedAccessPolicy policy,
SharedAccessHeaders headers, final String accessPolicyIdentifier, final String resourceName,
final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client)
throws InvalidKeyException, StorageException {
String stringToSign = generateSharedAccessSignatureStringToSign(
policy, resourceName, ipRange, protocols, accessPolicyIdentifier);
String cacheControl = null;
String contentDisposition = null;
String contentEncoding = null;
String contentLanguage = null;
String contentType = null;
if (headers != null) {
cacheControl = headers.getCacheControl();
contentDisposition = headers.getContentDisposition();
contentEncoding = headers.getContentEncoding();
contentLanguage = headers.getContentLanguage();
contentType = headers.getContentType();
}
stringToSign = String.format("%s\n%s\n%s\n%s\n%s\n%s", stringToSign,
cacheControl == null ? Constants.EMPTY_STRING : cacheControl,
contentDisposition == null ? Constants.EMPTY_STRING : contentDisposition,
contentEncoding == null ? Constants.EMPTY_STRING : contentEncoding,
contentLanguage == null ? Constants.EMPTY_STRING : contentLanguage,
contentType == null ? Constants.EMPTY_STRING : contentType);
return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());
}
示例5: generateSharedAccessSignatureHashForBlob
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
* Get the signature hash embedded inside the Shared Access Signature for blob service.
*
* @param permissions
* The permissions for a shared access signature.
* @param startTime
* The start time for a shared access signature.
* @param expiryTime
* The expiry time for a shared access signature.
* @param resourceName
* The canonical resource string, unescaped.
* @param accessPolicyIdentifier
* An optional identifier for the policy.
* @param client
* Reference to the ServiceClient.
* @param opContext
* An object used to track the execution of the operation.
* @param headers
* The optional header values to set for a blob returned with this SAS.
* @return
* The signature hash embedded inside the Shared Access Signature.
* @throws InvalidKeyException
* @throws StorageException
*/
private static String generateSharedAccessSignatureHashForBlob(final SharedAccessPolicy policy,
final String resourceName, final String accessPolicyIdentifier, final ServiceClient client,
final OperationContext opContext, final SharedAccessBlobHeaders headers) throws InvalidKeyException,
StorageException {
Utility.assertNotNullOrEmpty("resourceName", resourceName);
Utility.assertNotNull("client", client);
String permissions = null;
Date startTime = null;
Date expiryTime = null;
if (policy != null) {
permissions = policy.permissionsToString();
startTime = policy.getSharedAccessStartTime();
expiryTime = policy.getSharedAccessExpiryTime();
}
String cacheControl = null;
String contentDisposition = null;
String contentEncoding = null;
String contentLanguage = null;
String contentType = null;
if (headers != null) {
cacheControl = headers.getCacheControl();
contentDisposition = headers.getContentDisposition();
contentEncoding = headers.getContentEncoding();
contentLanguage = headers.getContentLanguage();
contentType = headers.getContentType();
}
String stringToSign = String.format("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
permissions == null ? Constants.EMPTY_STRING : permissions, Utility.getUTCTimeOrEmpty(startTime),
Utility.getUTCTimeOrEmpty(expiryTime), resourceName,
accessPolicyIdentifier == null ? Constants.EMPTY_STRING : accessPolicyIdentifier,
Constants.HeaderConstants.TARGET_STORAGE_VERSION, cacheControl == null ? Constants.EMPTY_STRING
: cacheControl, contentDisposition == null ? Constants.EMPTY_STRING : contentDisposition,
contentEncoding == null ? Constants.EMPTY_STRING : contentEncoding,
contentLanguage == null ? Constants.EMPTY_STRING : contentLanguage,
contentType == null ? Constants.EMPTY_STRING : contentType);
stringToSign = Utility.safeDecode(stringToSign);
final String signature = StorageCredentialsHelper.computeHmac256(client.getCredentials(), stringToSign,
opContext);
// add logging
return signature;
}
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:73,代码来源:SharedAccessSignatureHelper.java
示例6: signBlobQueueAndFileRequest
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signBlobQueueAndFileRequest(HttpURLConnection request, ServiceClient client,
long contentLength, OperationContext context) throws InvalidKeyException, StorageException {
StorageCredentialsHelper.signBlobQueueAndFileRequest(client.getCredentials(), request, contentLength, context);
}
示例7: signTableRequest
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signTableRequest(HttpURLConnection request, ServiceClient client, long contentLength,
OperationContext context) throws InvalidKeyException, StorageException {
StorageCredentialsHelper.signTableRequest(client.getCredentials(), request, contentLength, context);
}
示例8: generateSharedAccessSignatureHashForTable
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
* Get the signature hash embedded inside the Shared Access Signature for the table service.
*
* @param policy
* The shared access policy to hash.
* @param accessPolicyIdentifier
* An optional identifier for the policy.
* @param resourceName
* The resource name.
* @param ipRange
* The range of IP addresses to hash.
* @param protocols
* The Internet protocols to hash.
* @param startPartitionKey
* An optional restriction of the beginning of the range of partition keys to hash.
* @param startRowKey
* An optional restriction of the beginning of the range of row keys to hash.
* @param endPartitionKey
* An optional restriction of the end of the range of partition keys to hash.
* @param endRowKey
* An optional restriction of the end of the range of row keys to hash.
* @param client
* The ServiceClient associated with the object.
*
* @return The signature hash embedded inside the Shared Access Signature.
* @throws InvalidKeyException
* @throws StorageException
*/
public static String generateSharedAccessSignatureHashForTable(
final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String resourceName,
final IPRange ipRange, final SharedAccessProtocols protocols, final String startPartitionKey,
final String startRowKey, final String endPartitionKey, final String endRowKey, final ServiceClient client)
throws InvalidKeyException, StorageException {
String stringToSign = generateSharedAccessSignatureStringToSign(
policy, resourceName, ipRange, protocols, accessPolicyIdentifier);
stringToSign = String.format("%s\n%s\n%s\n%s\n%s", stringToSign,
startPartitionKey == null ? Constants.EMPTY_STRING : startPartitionKey,
startRowKey == null ? Constants.EMPTY_STRING : startRowKey,
endPartitionKey == null ? Constants.EMPTY_STRING : endPartitionKey,
endRowKey == null ? Constants.EMPTY_STRING : endRowKey);
return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());
}
示例9: generateSharedAccessSignatureHashForQueue
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
* Get the signature hash embedded inside the Shared Access Signature for queue service.
*
* @param policy
* The shared access policy to hash.
* @param accessPolicyIdentifier
* An optional identifier for the policy.
* @param resourceName
* The resource name.
* @param client
* The ServiceClient associated with the object.
* @param opContext
* An object used to track the execution of the operation
* @return The signature hash embedded inside the Shared Access Signature.
* @throws InvalidKeyException
* @throws StorageException
*/
public static String generateSharedAccessSignatureHashForQueue(final SharedAccessQueuePolicy policy,
final String accessPolicyIdentifier, final String resourceName, final ServiceClient client,
final OperationContext opContext) throws InvalidKeyException, StorageException {
return generateSharedAccessSignatureHashForQueueAndTable(policy, resourceName, accessPolicyIdentifier, false,
null, null, null, null, client, opContext);
}
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:25,代码来源:SharedAccessSignatureHelper.java
示例10: generateSharedAccessSignatureHashForTable
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
* Get the signature hash embedded inside the Shared Access Signature for blob service.
*
* @param policy
* The shared access policy to hash.
* @param accessPolicyIdentifier
* An optional identifier for the policy.
* @param resourceName
* The resource name.
* @param client
* The ServiceClient associated with the object.
* @param opContext
* An object used to track the execution of the operation
* @return The signature hash embedded inside the Shared Access Signature.
* @throws InvalidKeyException
* @throws StorageException
*/
public static String generateSharedAccessSignatureHashForTable(final SharedAccessTablePolicy policy,
final String accessPolicyIdentifier, final String resourceName, final String startPartitionKey,
final String startRowKey, final String endPartitionKey, final String endRowKey, final ServiceClient client,
final OperationContext opContext) throws InvalidKeyException, StorageException {
return generateSharedAccessSignatureHashForQueueAndTable(policy, resourceName, accessPolicyIdentifier, true,
startPartitionKey, startRowKey, endPartitionKey, endRowKey, client, opContext);
}
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:26,代码来源:SharedAccessSignatureHelper.java
示例11: generateSharedAccessSignatureHashForQueue
import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
* Get the signature hash embedded inside the Shared Access Signature for queue service.
*
* @param policy
* The shared access policy to hash.
* @param accessPolicyIdentifier
* An optional identifier for the policy.
* @param resourceName
* The resource name.
* @param ipRange
* The range of IP addresses to hash.
* @param protocols
* The Internet protocols to hash.
* @param client
* The ServiceClient associated with the object.
*
* @return The signature hash embedded inside the Shared Access Signature.
* @throws InvalidKeyException
* @throws StorageException
*/
public static String generateSharedAccessSignatureHashForQueue(
final SharedAccessQueuePolicy policy, final String accessPolicyIdentifier, final String resourceName,
final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client)
throws InvalidKeyException, StorageException {
final String stringToSign = generateSharedAccessSignatureStringToSign(
policy, resourceName, ipRange, protocols, accessPolicyIdentifier);
return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());
}