Search in sources :

Example 1 with AutoStorageBaseProperties

use of com.microsoft.azure.management.batch.AutoStorageBaseProperties in project azure-sdk-for-java by Azure.

the class BatchAccountImpl method createResourceAsync.

@Override
public Observable<BatchAccount> createResourceAsync() {
    final BatchAccountImpl self = this;
    handleStorageSettings();
    BatchAccountCreateParametersInner batchAccountCreateParametersInner = new BatchAccountCreateParametersInner();
    if (autoStorage != null) {
        batchAccountCreateParametersInner.withAutoStorage(new AutoStorageBaseProperties());
        batchAccountCreateParametersInner.autoStorage().withStorageAccountId(autoStorage.storageAccountId());
    } else {
        batchAccountCreateParametersInner.withAutoStorage(null);
    }
    batchAccountCreateParametersInner.withLocation(this.inner().location());
    batchAccountCreateParametersInner.withTags(this.inner().getTags());
    return this.manager().inner().batchAccounts().createAsync(this.resourceGroupName(), this.name(), batchAccountCreateParametersInner).map(new Func1<BatchAccountInner, BatchAccount>() {

        @Override
        public BatchAccount call(BatchAccountInner batchAccountInner) {
            self.creatableStorageAccountKey = null;
            setInner(batchAccountInner);
            return self;
        }
    }).flatMap(new Func1<BatchAccount, Observable<? extends BatchAccount>>() {

        @Override
        public Observable<? extends BatchAccount> call(BatchAccount batchAccount) {
            return self.applicationsImpl.commitAndGetAllAsync().map(new Func1<List<ApplicationImpl>, BatchAccount>() {

                @Override
                public BatchAccount call(List<ApplicationImpl> applications) {
                    return self;
                }
            });
        }
    });
}
Also used : List(java.util.List) AutoStorageBaseProperties(com.microsoft.azure.management.batch.AutoStorageBaseProperties) BatchAccount(com.microsoft.azure.management.batch.BatchAccount) Func1(rx.functions.Func1) Observable(rx.Observable)

Aggregations

AutoStorageBaseProperties (com.microsoft.azure.management.batch.AutoStorageBaseProperties)1 BatchAccount (com.microsoft.azure.management.batch.BatchAccount)1 List (java.util.List)1 Observable (rx.Observable)1 Func1 (rx.functions.Func1)1