Tabnine Logo
CloudStorageAccount.parse
Code IndexAdd Tabnine to your IDE (free)

How to use
parse
method
in
com.microsoft.azure.storage.CloudStorageAccount

Best Java code snippets using com.microsoft.azure.storage.CloudStorageAccount.parse (Showing top 20 results out of 315)

origin: apache/incubator-druid

@Provides
@LazySingleton
public CloudBlobClient getCloudBlobClient(final AzureAccountConfig config)
  throws URISyntaxException, InvalidKeyException
{
 CloudStorageAccount account = CloudStorageAccount.parse(
   StringUtils.format(
     STORAGE_CONNECTION_STRING,
     config.getProtocol(),
     config.getAccount(),
     config.getKey()
   )
 );
 return account.createCloudBlobClient();
}
origin: brianfrankcooper/YCSB

String storageConnectionString = getStorageConnectionString(protocol, account, key, tableEndPoint);
try {
 storageAccount = CloudStorageAccount.parse(storageConnectionString);
} catch (Exception e)  {
 throw new DBException("Could not connect to the account.\n", e);
origin: pinterest/secor

public AzureUploadManager(SecorConfig config) throws Exception {
  super(config);
  final String storageConnectionString =
      "DefaultEndpointsProtocol=" + mConfig.getAzureEndpointsProtocol() + ";" +
      "AccountName=" + mConfig.getAzureAccountName() + ";" +
      "AccountKey=" + mConfig.getAzureAccountKey() + ";";
  CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
  blobClient = storageAccount.createCloudBlobClient();
}
origin: google/data-transfer-project

public void init() {
 try {
  String endpoint = String.format(ENDPOINT_TEMPLATE, configuration.getAccountName());
  CloudStorageAccount cosmosAccount =
    CloudStorageAccount.parse(
      String.format(
        COSMOS_CONNECTION_TEMPLATE,
        configuration.getAccountName(),
        configuration.getAccountKey(),
        endpoint));
  tableClient = cosmosAccount.createCloudTableClient();
  // Create the tables if the do not exist
  tableClient.getTableReference(JOB_TABLE).createIfNotExists();
  tableClient.getTableReference(JOB_DATA_TABLE).createIfNotExists();
  CloudStorageAccount blobAccount =
    CloudStorageAccount.parse(
      String.format(
        BLOB_CONNECTION_TEMPLATE,
        configuration.getAccountName(),
        configuration.getBlobKey()));
  blobClient = blobAccount.createCloudBlobClient();
  blobClient.getContainerReference(BLOB_CONTAINER).createIfNotExists();
 } catch (StorageException | URISyntaxException | InvalidKeyException e) {
  throw new MicrosoftStorageException(e);
 }
}
origin: apache/nifi

} else {
  String blobConnString = String.format(AzureStorageUtils.FORMAT_BLOB_CONNECTION_STRING, accountName, accountKey);
  CloudStorageAccount storageAccount = CloudStorageAccount.parse(blobConnString);
  cloudBlobClient = storageAccount.createCloudBlobClient();
origin: apache/nifi

} else {
  connectionString = String.format(FORMAT_QUEUE_CONNECTION_STRING, storageAccountName, storageAccountKey);
  CloudStorageAccount storageAccount = CloudStorageAccount.parse(connectionString);
  cloudQueueClient = storageAccount.createCloudQueueClient();
origin: apache/jackrabbit-oak

/**
 * Create CloudBlobClient from properties.
 *
 * @param connectionString connectionString to configure @link {@link CloudBlobClient}
 * @return {@link CloudBlobClient}
 */
public static CloudBlobClient getBlobClient(final String connectionString) throws URISyntaxException, InvalidKeyException {
  CloudStorageAccount account = CloudStorageAccount.parse(connectionString);
  CloudBlobClient client = account.createCloudBlobClient();
  return client;
}
origin: com.microsoft.azure/azure-support

  /**
   * Helper function for creating CloudStorageAccount instance from storage connection string.
   *
   * @return CloudStorageAccount object
   */
  private CloudStorageAccount createCloudStorageAccount() throws URISyntaxException, InvalidKeyException {
    LOG.debug("createCloudStorageAccount called");
    return CloudStorageAccount.parse(properties.getConnectionString());
  }
}
origin: com.microsoft.azure/azure-storage-spring-boot-autoconfigure

  /**
   * Helper function for creating CloudStorageAccount instance from storage connection string.
   *
   * @return CloudStorageAccount object
   */
  private CloudStorageAccount createCloudStorageAccount() throws URISyntaxException, InvalidKeyException {
    LOG.debug("createCloudStorageAccount called");
    return CloudStorageAccount.parse(properties.getConnectionString());
  }
}
origin: opendedup/sdfs

@Override
public boolean checkAccess(String username, String password, Properties props) throws Exception {
  String storageConnectionString = "DefaultEndpointsProtocol=" + props.getProperty("protocol") + ";"
      + "AccountName=" + Main.cloudAccessKey + ";" + "AccountKey=" + Main.cloudSecretKey;
  account = CloudStorageAccount.parse(storageConnectionString);
  serviceClient = account.createCloudBlobClient();
  serviceClient.listContainers();
  return true;
}
origin: opendedup/sdfs

public BlobDataIO(String tableName,String accessKey,String secretKey,String connectionProtocol) throws InvalidKeyException, URISyntaxException, StorageException {
  storageConnectionString="DefaultEndpointsProtocol=" + connectionProtocol + ";" + "AccountName="
      + accessKey + ";" + "AccountKey=" + secretKey;
  CloudStorageAccount storageAccount =
      CloudStorageAccount.parse(storageConnectionString);
  tableClient = storageAccount.createCloudTableClient();
  cloudTable = tableClient.getTableReference(tableName);
  cloudTable.createIfNotExists();
}

origin: apache/jackrabbit-oak

public static CloudBlobDirectory cloudBlobDirectoryFrom(String connection, String containerName,
    String dir) throws InvalidKeyException, URISyntaxException, StorageException {
  CloudStorageAccount cloud = CloudStorageAccount.parse(connection);
  CloudBlobContainer container = cloud.createCloudBlobClient().getContainerReference(containerName);
  container.createIfNotExists();
  return container.getDirectoryReference(dir);
}
origin: org.apache.jackrabbit/oak-segment-azure

public static CloudBlobDirectory cloudBlobDirectoryFrom(String connection, String containerName,
    String dir) throws InvalidKeyException, URISyntaxException, StorageException {
  CloudStorageAccount cloud = CloudStorageAccount.parse(connection);
  CloudBlobContainer container = cloud.createCloudBlobClient().getContainerReference(containerName);
  container.createIfNotExists();
  return container.getDirectoryReference(dir);
}
origin: Azure/azure-storage-android

@Test
public void testCloudStorageAccountDevStoreFalsePlusEndpointFails()
    throws InvalidKeyException, URISyntaxException {
  try {
    CloudStorageAccount.parse("UseDevelopmentStorage=false;"
        + "BlobEndpoint=http://127.0.0.1:1000/devstoreaccount1");
    fail();
  }
  catch (IllegalArgumentException ex) {
    assertEquals(SR.INVALID_CONNECTION_STRING, ex.getMessage());
  }
}
origin: Azure/azure-storage-android

@Test
public void testCloudStorageAccountDevStoreFalseFails()
    throws InvalidKeyException, URISyntaxException {
  try {
    CloudStorageAccount.parse("UseDevelopmentStorage=false");
    fail();
  }
  catch (IllegalArgumentException ex) {
    assertEquals(SR.INVALID_CONNECTION_STRING_DEV_STORE_NOT_TRUE, ex.getMessage());
  }
}
origin: Azure/azure-storage-android

@Test
public void testCloudStorageAccountAnonymousRoundtrip()
    throws InvalidKeyException, URISyntaxException {
  String accountString = "BlobEndpoint=http://blobs/";
  assertEquals(accountString, CloudStorageAccount.parse(accountString).toString(true));
  CloudStorageAccount account = new CloudStorageAccount(
      null, new StorageUri(new URI("http://blobs/")), null, null, null);
  AccountsAreEqual(account, CloudStorageAccount.parse(account.toString(true)));
}
origin: Azure/azure-storage-android

@Test
public void testCloudStorageAccountEmptyValues() throws InvalidKeyException, URISyntaxException {
  String accountString = ";EndpointSuffix=a.b.c;;BlobEndpoint=http://blobs/;;"
      + "AccountName=test;;AccountKey=abc=;;;";
  String validAccountString = "EndpointSuffix=a.b.c;BlobEndpoint=http://blobs/;"
      + "DefaultEndpointsProtocol=http;AccountName=test;AccountKey=abc=";
  assertEquals(validAccountString, CloudStorageAccount.parse(accountString).toString(true));
}
origin: Azure/azure-storage-android

@Test
public void testCloudStorageAccountJustFileToString() throws InvalidKeyException, URISyntaxException {
  String accountString = "FileEndpoint=http://file/;DefaultEndpointsProtocol=https;AccountName=test;AccountKey=abc=";
  assertEquals(accountString, CloudStorageAccount.parse(accountString).toString(true));
}
origin: Azure/azure-storage-android

@Test
public void testCloudStorageAccountInvalidAnonymousRoundtrip()
    throws InvalidKeyException, URISyntaxException {
  String accountString = "AccountKey=abc=";
  try {
    assertNull(CloudStorageAccount.parse(accountString));
    fail();
  }
  catch (Exception ex) {
    assertEquals(SR.INVALID_CONNECTION_STRING, ex.getMessage());
  }
}
origin: Azure/azure-storage-android

@Test
public void testCloudStorageAccountExplicitCloudRoundtrip()
    throws InvalidKeyException, URISyntaxException {
  String accountString = "EndpointSuffix=a.b.c;BlobEndpoint=https://blobs/;DefaultEndpointsProtocol=https;"
      + "AccountName=test;AccountKey=abc=";
  assertEquals(accountString, CloudStorageAccount.parse(accountString).toString(true));
}
com.microsoft.azure.storageCloudStorageAccountparse

Javadoc

Parses a connection string and returns a cloud storage account created from the connection string.

The connection string should be in the Azure connection string format.

Note that while a connection string may include a SAS token, it is often easier to use the CloudBlobContainer#CloudBlobContainer(URI), CloudQueue#CloudQueue(URI), CloudTable#CloudTable(URI) constructors directly. To do this, create a StorageCredentialsSharedAccessSignature#StorageCredentialsSharedAccessSignature(String) object with your SAS token, use the StorageCredentialsSharedAccessSignature#transformUri(URI) method on the container, queue, or table URI, and then use that URI to construct the object.

Popular methods of CloudStorageAccount

  • createCloudBlobClient
    Creates a new Blob service client.
  • <init>
    Creates an instance of the CloudStorageAccount class using the specified account credentials. With t
  • createCloudTableClient
    Creates a new Table service client.
  • createCloudQueueClient
    Creates a new Queue service client.
  • getDevelopmentStorageAccount
    Returns a CloudStorageAccount object that represents the development storage credentials, using the
  • getBlobEndpoint
    Returns the endpoint for the Blob service for the storage account. This method is not supported when
  • createCloudFileClient
    Creates a new File service client.
  • getBlobStorageUri
    Returns the endpoint for the Blob service for the storage account. This method is not supported when
  • getCredentials
    Returns the credentials for the storage account.
  • getFileEndpoint
    Returns the endpoint for the File service for the storage account. This method is not supported when
  • getFileStorageUri
    Returns the endpoint for the File service for the storage account. This method is not supported when
  • getQueueEndpoint
    Returns the endpoint for the Queue service for the storage account.
  • getFileStorageUri,
  • getQueueEndpoint,
  • getQueueStorageUri,
  • getTableEndpoint,
  • getTableStorageUri,
  • toString,
  • allRequired,
  • atLeastOne,
  • generateSharedAccessSignature

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setScale (BigDecimal)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now