Search in sources :

Example 6 with StorageAccountKey

use of com.microsoft.azure.management.storage.StorageAccountKey in project azure-sdk-for-java by Azure.

the class Utils method print.

/**
     * Print storage account keys.
     * @param storageAccountKeys a list of storage account keys
     */
public static void print(List<StorageAccountKey> storageAccountKeys) {
    for (int i = 0; i < storageAccountKeys.size(); i++) {
        StorageAccountKey storageAccountKey = storageAccountKeys.get(i);
        System.out.println("Key (" + i + ") " + storageAccountKey.keyName() + "=" + storageAccountKey.value());
    }
}
Also used : StorageAccountKey(com.microsoft.azure.management.storage.StorageAccountKey) TrafficManagerExternalEndpoint(com.microsoft.azure.management.trafficmanager.TrafficManagerExternalEndpoint) TrafficManagerNestedProfileEndpoint(com.microsoft.azure.management.trafficmanager.TrafficManagerNestedProfileEndpoint) TrafficManagerAzureEndpoint(com.microsoft.azure.management.trafficmanager.TrafficManagerAzureEndpoint)

Example 7 with StorageAccountKey

use of com.microsoft.azure.management.storage.StorageAccountKey in project azure-sdk-for-java by Azure.

the class FunctionAppImpl method submitAppSettings.

@Override
Observable<SiteInner> submitAppSettings(final SiteInner site) {
    if (storageAccountCreatable != null && createdResource(storageAccountCreatable.key()) != null) {
        storageAccountToSet = (StorageAccount) createdResource(storageAccountCreatable.key());
    }
    if (storageAccountToSet == null) {
        return super.submitAppSettings(site);
    } else {
        return storageAccountToSet.getKeysAsync().flatMapIterable(new Func1<List<StorageAccountKey>, Iterable<StorageAccountKey>>() {

            @Override
            public Iterable<StorageAccountKey> call(List<StorageAccountKey> storageAccountKeys) {
                return storageAccountKeys;
            }
        }).first().flatMap(new Func1<StorageAccountKey, Observable<SiteInner>>() {

            @Override
            public Observable<SiteInner> call(StorageAccountKey storageAccountKey) {
                String connectionString = String.format("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s", storageAccountToSet.name(), storageAccountKey.value());
                withAppSetting("AzureWebJobsStorage", connectionString);
                withAppSetting("AzureWebJobsDashboard", connectionString);
                withAppSetting("WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", connectionString);
                withAppSetting("WEBSITE_CONTENTSHARE", SdkContext.randomResourceName(name(), 32));
                return FunctionAppImpl.super.submitAppSettings(site);
            }
        }).doOnCompleted(new Action0() {

            @Override
            public void call() {
                currentStorageAccount = storageAccountToSet;
                storageAccountToSet = null;
                storageAccountCreatable = null;
            }
        });
    }
}
Also used : Action0(rx.functions.Action0) StorageAccountKey(com.microsoft.azure.management.storage.StorageAccountKey) List(java.util.List) Func1(rx.functions.Func1)

Aggregations

StorageAccountKey (com.microsoft.azure.management.storage.StorageAccountKey)7 StorageAccount (com.microsoft.azure.management.storage.StorageAccount)5 Func1 (rx.functions.Func1)3 StorageAccounts (com.microsoft.azure.management.storage.StorageAccounts)2 List (java.util.List)2 Application (com.microsoft.azure.management.batch.Application)1 ApplicationPackage (com.microsoft.azure.management.batch.ApplicationPackage)1 BatchAccount (com.microsoft.azure.management.batch.BatchAccount)1 BatchAccountKeys (com.microsoft.azure.management.batch.BatchAccountKeys)1 StorageAccountParameters (com.microsoft.azure.management.containerregistry.StorageAccountParameters)1 ResourceGroup (com.microsoft.azure.management.resources.ResourceGroup)1 Region (com.microsoft.azure.management.resources.fluentcore.arm.Region)1 Indexable (com.microsoft.azure.management.resources.fluentcore.model.Indexable)1 TrafficManagerAzureEndpoint (com.microsoft.azure.management.trafficmanager.TrafficManagerAzureEndpoint)1 TrafficManagerExternalEndpoint (com.microsoft.azure.management.trafficmanager.TrafficManagerExternalEndpoint)1 TrafficManagerNestedProfileEndpoint (com.microsoft.azure.management.trafficmanager.TrafficManagerNestedProfileEndpoint)1 CloudStorageAccount (com.microsoft.azure.storage.CloudStorageAccount)1 CloudBlobClient (com.microsoft.azure.storage.blob.CloudBlobClient)1 CloudBlobContainer (com.microsoft.azure.storage.blob.CloudBlobContainer)1 CloudBlockBlob (com.microsoft.azure.storage.blob.CloudBlockBlob)1