本文整理汇总了Java中com.microsoft.azure.management.storage.StorageAccount类的典型用法代码示例。如果您正苦于以下问题:Java StorageAccount类的具体用法?Java StorageAccount怎么用?Java StorageAccount使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StorageAccount类属于com.microsoft.azure.management.storage包,在下文中一共展示了StorageAccount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withNewAzureFileShareVolume
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public ContainerGroupImpl withNewAzureFileShareVolume(String volumeName, String shareName) {
if (this.newFileShares == null || this.creatableStorageAccountKey == null) {
StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager
.storageAccounts()
.define(SdkContext.randomResourceName("fs", 24))
.withRegion(this.regionName());
Creatable<StorageAccount> creatable;
if (this.creatableGroup != null) {
creatable = definitionWithGroup.withNewResourceGroup(this.creatableGroup);
} else {
creatable = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName());
}
this.creatableStorageAccountKey = this.addDependency(creatable);
this.newFileShares = new HashMap<>();
}
this.newFileShares.put(volumeName, shareName);
return this;
}
示例2: createResourceAsync
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public Observable<StorageAccount> createResourceAsync() {
this.networkRulesHelper.setDefaultActionIfRequired();
createParameters.withLocation(this.regionName());
createParameters.withTags(this.inner().getTags());
final StorageAccountsInner client = this.manager().inner().storageAccounts();
return this.manager().inner().storageAccounts().createAsync(
this.resourceGroupName(), this.name(), createParameters)
.flatMap(new Func1<StorageAccountInner, Observable<StorageAccountInner>>() {
@Override
public Observable<StorageAccountInner> call(StorageAccountInner storageAccountInner) {
return client.getByResourceGroupAsync(resourceGroupName(), name());
}
})
.map(innerToFluentMap(this))
.doOnNext(new Action1<StorageAccount>() {
@Override
public void call(StorageAccount storageAccount) {
clearWrapperProperties();
}
});
}
示例3: createResourceAsync
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public Observable<Registry> createResourceAsync() {
final RegistryImpl self = this;
if (isInCreateMode()) {
if (self.creatableStorageAccountKey != null) {
StorageAccount storageAccount = self.<StorageAccount>taskResult(this.creatableStorageAccountKey);
self.inner().storageAccount().withId(storageAccount.id());
} else if (storageAccountId != null) {
self.inner().storageAccount().withId(storageAccountId);
}
return manager().inner().registries().createAsync(self.resourceGroupName(), self.name(), self.inner())
.map(innerToFluentMap(this));
} else {
updateParameters.withTags(inner().getTags());
return manager().inner().registries().updateAsync(self.resourceGroupName(), self.name(), self.updateParameters)
.map(innerToFluentMap(this));
}
}
示例4: withNewStorageAccount
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public RegistryImpl withNewStorageAccount(String storageAccountName) {
this.storageAccountId = null;
StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager
.storageAccounts()
.define(storageAccountName)
.withRegion(this.regionName());
Creatable<StorageAccount> definitionAfterGroup;
if (this.creatableGroup != null) {
definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup);
} else {
definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName());
}
return withNewStorageAccount(definitionAfterGroup);
}
示例5: handleStorageSettings
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
private void handleStorageSettings() {
StorageAccount storageAccount;
if (this.creatableStorageAccountKey != null) {
storageAccount = this.<StorageAccount>taskResult(this.creatableStorageAccountKey);
existingStorageAccountToAssociate = storageAccount;
} else if (this.existingStorageAccountToAssociate != null) {
storageAccount = this.existingStorageAccountToAssociate;
} else {
return;
}
if (autoStorage == null) {
autoStorage = new AutoStorageProperties();
}
autoStorage.withStorageAccountId(storageAccount.id());
}
示例6: beforeGroupCreateOrUpdate
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public void beforeGroupCreateOrUpdate() {
// [1]. StorageProfile: If implicit storage account creation is required then add Creatable<StorageAccount>.
//
if (creatableStorageAccountKey == null && existingStorageAccountToAssociate == null) {
if (osDiskRequiresImplicitStorageAccountCreation()
|| dataDisksRequiresImplicitStorageAccountCreation()) {
Creatable<StorageAccount> storageAccountCreatable = null;
if (this.creatableGroup != null) {
storageAccountCreatable = this.storageManager.storageAccounts()
.define(this.namer.randomName("stg", 24).replace("-", ""))
.withRegion(this.regionName())
.withNewResourceGroup(this.creatableGroup);
} else {
storageAccountCreatable = this.storageManager.storageAccounts()
.define(this.namer.randomName("stg", 24).replace("-", ""))
.withRegion(this.regionName())
.withExistingResourceGroup(this.resourceGroupName());
}
this.creatableStorageAccountKey = this.addDependency(storageAccountCreatable);
}
}
// [2]. BootDiagnosticsProfile: If any implicit resource creation is required then add Creatable<?>.
//
this.bootDiagnosticsHandler.prepare();
}
示例7: canEnableBootDiagnosticsWithCreatableStorageOnManagedVMCreation
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Test
public void canEnableBootDiagnosticsWithCreatableStorageOnManagedVMCreation() {
final String storageName = SdkContext.randomResourceName("st", 14);
Creatable<StorageAccount> creatableStorageAccount = storageManager.storageAccounts()
.define(storageName)
.withRegion(REGION)
.withNewResourceGroup(RG_NAME);
VirtualMachine virtualMachine = computeManager.virtualMachines()
.define(VMNAME)
.withRegion(REGION)
.withNewResourceGroup(RG_NAME)
.withNewPrimaryNetwork("10.0.0.0/28")
.withPrimaryPrivateIPAddressDynamic()
.withoutPrimaryPublicIPAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
.withRootUsername("Foo12")
.withRootPassword("[email protected]#F0orL")
.withBootDiagnostics(creatableStorageAccount)
.create();
Assert.assertNotNull(virtualMachine);
Assert.assertTrue(virtualMachine.isBootDiagnosticsEnabled());
Assert.assertNotNull(virtualMachine.bootDiagnosticsStorageUri());
Assert.assertTrue(virtualMachine.bootDiagnosticsStorageUri().contains(storageName));
}
示例8: withNewStorageAccount
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public FunctionAppImpl withNewStorageAccount(String name, SkuName sku) {
StorageAccount.DefinitionStages.WithGroup storageDefine = manager().storageManager().storageAccounts()
.define(name)
.withRegion(regionName());
if (super.creatableGroup != null && isInCreateMode()) {
storageAccountCreatable = storageDefine.withNewResourceGroup(super.creatableGroup)
.withGeneralPurposeAccountKind()
.withSku(sku);
} else {
storageAccountCreatable = storageDefine.withExistingResourceGroup(resourceGroupName())
.withGeneralPurposeAccountKind()
.withSku(sku);
}
this.addDependency(storageAccountCreatable);
return this;
}
示例9: createStorageAccount
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
public StorageAccount createStorageAccount(String resourceGroup, String storageName, String storageLocation, SkuName accType, Boolean encryted,
Map<String, String> tags, Map<String, String> costFollowerTags) {
Map<String, String> resultTags = new HashMap<>();
for (Map.Entry<String, String> entry : costFollowerTags.entrySet()) {
resultTags.put(entry.getKey(), entry.getValue());
}
resultTags.putAll(tags);
return handleAuthException(() -> {
StorageAccount.DefinitionStages.WithCreate withCreate = azure.storageAccounts()
.define(storageName)
.withRegion(storageLocation)
.withExistingResourceGroup(resourceGroup)
.withTags(resultTags)
.withSku(accType);
if (encryted) {
withCreate.withEncryption();
}
return withCreate.create();
});
}
示例10: createInner
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
protected Observable<ContainerGroupInner> createInner() {
final ContainerGroupImpl self = this;
if (!isInCreateMode()) {
throw new UnsupportedOperationException("Update on an existing container group resource is not supported");
} else if (newFileShares == null || creatableStorageAccountKey == null) {
return this.manager().inner().containerGroups().createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner());
} else {
final StorageAccount storageAccount = this.<StorageAccount>taskResult(this.creatableStorageAccountKey);
return createFileShareAsync(storageAccount)
.collect(new Func0<List<Triple<String, String, String>>>() {
@Override
public List<Triple<String, String, String>> call() {
return new ArrayList<>();
}
}, new Action2<List<Triple<String, String, String>>, Triple<String, String, String>>() {
@Override
public void call(List<Triple<String, String, String>> cloudFileShares, Triple<String, String, String> fileShare) {
cloudFileShares.add(fileShare);
}
})
.flatMap(new Func1<List<Triple<String, String, String>>, Observable<? extends ContainerGroupInner>>() {
@Override
public Observable<? extends ContainerGroupInner> call(List<Triple<String, String, String>> fileShares) {
for (Triple<String, String, String> fileShareEntry : fileShares) {
self.defineVolume(fileShareEntry.getLeft())
.withExistingReadWriteAzureFileShare(fileShareEntry.getMiddle())
.withStorageAccountName(storageAccount.name())
.withStorageAccountKey(fileShareEntry.getRight())
.attach();
}
return self.manager().inner().containerGroups().createOrUpdateAsync(self.resourceGroupName(), self.name(), self.inner());
}
});
}
}
示例11: createFileShareAsync
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
private Observable<Triple<String, String, String>> createFileShareAsync(final StorageAccount storageAccount) {
return storageAccount.getKeysAsync()
.map(new Func1<List<StorageAccountKey>, String>() {
@Override
public String call(List<StorageAccountKey> storageAccountKeys) {
return storageAccountKeys.get(0).value();
}
})
.flatMap(new Func1<String, Observable<Triple<String, String, String>>>() {
CloudFileClient cloudFileClient;
@Override
public Observable<Triple<String, String, String>> call(final String storageAccountKey) {
try {
cloudFileClient = CloudStorageAccount.parse(String.format("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=core.windows.net",
storageAccount.name(),
storageAccountKey))
.createCloudFileClient();
} catch (URISyntaxException syntaxException) {
throw Exceptions.propagate(syntaxException);
} catch (InvalidKeyException keyException) {
throw Exceptions.propagate(keyException);
}
return Observable.from(newFileShares.entrySet())
.flatMap(new Func1<Map.Entry<String, String>, Observable<Triple<String, String, String>>>() {
@Override
public Observable<Triple<String, String, String>> call(Map.Entry<String, String> fileShareEntry) {
return createSingleFileShareAsync(cloudFileClient, fileShareEntry.getKey(), fileShareEntry.getValue(), storageAccountKey);
}
});
}
});
}
示例12: refreshAsync
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public Observable<StorageAccount> refreshAsync() {
return super.refreshAsync().map(new Func1<StorageAccount, StorageAccount>() {
@Override
public StorageAccount call(StorageAccount storageAccount) {
StorageAccountImpl impl = (StorageAccountImpl) storageAccount;
impl.clearWrapperProperties();
return impl;
}
});
}
示例13: updateResourceAsync
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public Observable<StorageAccount> updateResourceAsync() {
this.networkRulesHelper.setDefaultActionIfRequired();
updateParameters.withTags(this.inner().getTags());
return this.manager().inner().storageAccounts().updateAsync(
resourceGroupName(), name(), updateParameters)
.map(innerToFluentMap(this))
.doOnNext(new Action1<StorageAccount>() {
@Override
public void call(StorageAccount storageAccount) {
clearWrapperProperties();
}
});
}
示例14: withNewStorageAccount
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public BatchAccountImpl withNewStorageAccount(Creatable<StorageAccount> creatable) {
// This method's effect is NOT additive.
if (this.creatableStorageAccountKey == null) {
this.creatableStorageAccountKey = this.addDependency(creatable);
}
this.existingStorageAccountToAssociate = null;
return this;
}
示例15: withNewStorageAccount
import com.microsoft.azure.management.storage.StorageAccount; //导入依赖的package包/类
@Override
public VirtualMachineScaleSetImpl withNewStorageAccount(String name) {
StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager
.storageAccounts()
.define(name)
.withRegion(this.regionName());
Creatable<StorageAccount> definitionAfterGroup;
if (this.creatableGroup != null) {
definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup);
} else {
definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName());
}
return withNewStorageAccount(definitionAfterGroup);
}