• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StorageAccountKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.microsoft.azure.management.storage.StorageAccountKey的典型用法代码示例。如果您正苦于以下问题:Java StorageAccountKey类的具体用法?Java StorageAccountKey怎么用?Java StorageAccountKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StorageAccountKey类属于com.microsoft.azure.management.storage包,在下文中一共展示了StorageAccountKey类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: storeKeys

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
public static DeferredResult<AuthCredentialsServiceState> storeKeys(ServiceHost host,
        StorageAccountListKeysResultInner keys, String endpointLink, List<String> tenantLinks) {
    AuthCredentialsServiceState storageAuth = new AuthCredentialsServiceState();
    storageAuth.documentSelfLink = UUID.randomUUID().toString();
    storageAuth.customProperties = new HashMap<>();
    for (StorageAccountKey key : keys.keys()) {
        storageAuth.customProperties.put(getStorageAccountKeyName(storageAuth.customProperties), key.value());
    }
    storageAuth.tenantLinks = tenantLinks;
    if (endpointLink != null) {
        storageAuth.customProperties.put(CUSTOM_PROP_ENDPOINT_LINK,
                endpointLink);
    }

    Operation storageAuthOp = Operation
            .createPost(createInventoryUri(host, AuthCredentialsService.FACTORY_LINK))
            .setReferer(host.getPublicUri())
            .setBody(storageAuth);
    return host.sendWithDeferredResult(storageAuthOp, AuthCredentialsServiceState.class);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:21,代码来源:AzureUtils.java


示例2: print

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
/**
 * 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());
    }
}
 
开发者ID:Azure-Samples,项目名称:acr-java-manage-azure-container-registry,代码行数:13,代码来源:Utils.java


示例3: createFileShareAsync

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的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);
                    }
                });
        }
    });
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:33,代码来源:ContainerGroupImpl.java


示例4: getKeysAsync

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
@Override
public Observable<List<StorageAccountKey>> getKeysAsync() {
    return this.manager().inner().storageAccounts().listKeysAsync(
            this.resourceGroupName(), this.name()).map(new Func1<StorageAccountListKeysResultInner, List<StorageAccountKey>>() {
        @Override
        public List<StorageAccountKey> call(StorageAccountListKeysResultInner storageAccountListKeysResultInner) {
            return storageAccountListKeysResultInner.keys();
        }
    });
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:StorageAccountImpl.java


示例5: regenerateKeyAsync

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
@Override
public Observable<List<StorageAccountKey>> regenerateKeyAsync(String keyName) {
    return this.manager().inner().storageAccounts().regenerateKeyAsync(
            this.resourceGroupName(), this.name(), keyName).map(new Func1<StorageAccountListKeysResultInner, List<StorageAccountKey>>() {
        @Override
        public List<StorageAccountKey> call(StorageAccountListKeysResultInner storageAccountListKeysResultInner) {
            return storageAccountListKeysResultInner.keys();
        }
    });
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:StorageAccountImpl.java


示例6: submitAppSettings

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
@Override
Observable<Indexable> submitAppSettings() {
    if (storageAccountCreatable != null && this.taskResult(storageAccountCreatable.key()) != null) {
        storageAccountToSet = this.<StorageAccount>taskResult(storageAccountCreatable.key());
    }
    if (storageAccountToSet == null) {
        return super.submitAppSettings();
    } 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<Indexable>>() {
            @Override
            public Observable<Indexable> 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();
            }
        }).doOnCompleted(new Action0() {
                @Override
                public void call() {
                    currentStorageAccount = storageAccountToSet;
                    storageAccountToSet = null;
                    storageAccountCreatable = null;
                }
            });
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:37,代码来源:FunctionAppImpl.java


示例7: deleteUnmanagedOsDisk

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
private void deleteUnmanagedOsDisk(Azure api) {
    LOG.debug("deleting unmanaged OS disk for VM {} ...", this.vm.name());

    String osDiskUrl = this.vm.osUnmanagedDiskVhdUri();
    if (osDiskUrl == null) {
        LOG.warn("no unmanaged OS disk to delete found for VM {}.", this.vm.name());
        return;
    }

    LOG.debug("deleting unmanaged OS disk {}", osDiskUrl);
    URI osDiskUri = URI.create(osDiskUrl);
    String storageAccountName = extractStorageAccountName(osDiskUri);
    StorageAccount storageAccount = api.storageAccounts().getByResourceGroup(this.vm.resourceGroupName(),
            storageAccountName);

    // extract API access key to allow us to access the blob container
    StorageAccountKey accessKey = storageAccount.getKeys().get(0);
    StorageCredentialsAccountAndKey storageCredentials = new StorageCredentialsAccountAndKey(storageAccountName,
            accessKey.value());

    try {
        LOG.debug("deleting disk blob {} ...", osDiskUri);
        new CloudBlockBlob(osDiskUri, storageCredentials).delete();
    } catch (StorageException e) {
        throw new RuntimeException(String.format("failed to delete storage account blobs for VM %s: %s",
                this.vm.name(), e.getMessage()), e);
    }
}
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:29,代码来源:DeleteVmOsDiskRequest.java


示例8: getKeys

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
@Override
public List<StorageAccountKey> getKeys() {
    return this.getKeysAsync().toBlocking().last();
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:5,代码来源:StorageAccountImpl.java


示例9: regenerateKey

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
@Override
public List<StorageAccountKey> regenerateKey(String keyName) {
    return this.regenerateKeyAsync(keyName).toBlocking().last();
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:5,代码来源:StorageAccountImpl.java


示例10: getStorageKeys

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
/**
 * Gets the storage keys from azure and patches the credential state.
 */
private void getStorageKeys(AzureInstanceContext ctx, AzureInstanceStage nextStage) {

    if (ctx.reuseExistingStorageAccount() || ctx.useManagedDisks()) {
          // no need to get keys as no new storage description was created
        handleAllocation(ctx, nextStage);
        return;
    }

    StorageManagementClientImpl client = getStorageManagementClientImpl(ctx);

    client.storageAccounts().listKeysAsync(ctx.storageAccountRGName,
            ctx.storageAccountName,
            new AzureAsyncCallback<StorageAccountListKeysResultInner>() {
                @Override
                public void onError(Throwable e) {
                    handleError(ctx, e);
                }

                @Override
                public void onSuccess(StorageAccountListKeysResultInner result) {
                    logFine(() -> String.format("Retrieved the storage account keys for storage"
                            + " account [%s]", ctx.storageAccountName));

                    AuthCredentialsServiceState storageAuth = new AuthCredentialsServiceState();
                    storageAuth.customProperties = new HashMap<>();
                    for (StorageAccountKey key : result.keys()) {
                        storageAuth.customProperties.put(
                                getStorageAccountKeyName(storageAuth.customProperties),
                                key.value());
                    }
                    Operation patchStorageDescriptionWithKeys = Operation
                            .createPost(createInventoryUri(getHost(),
                                    AuthCredentialsService.FACTORY_LINK))
                            .setBody(storageAuth).setCompletion((o, e) -> {
                                if (e != null) {
                                    handleError(ctx, e);
                                    return;
                                }
                                AuthCredentialsServiceState resultAuth = o.getBody(
                                        AuthCredentialsServiceState.class);
                                ctx.storageDescription.authCredentialsLink = resultAuth.documentSelfLink;
                                Operation patch = Operation
                                        .createPatch(UriUtils.buildUri(getHost(),
                                                ctx.storageDescription.documentSelfLink))
                                        .setBody(ctx.storageDescription)
                                        .setCompletion(((completedOp, failure) -> {
                                            if (failure != null) {
                                                handleError(ctx, failure);
                                                return;
                                            }
                                            logFine(() -> "Patched storage description.");
                                            handleAllocation(ctx, nextStage);
                                        }));
                                sendRequest(patch);
                            });
                    sendRequest(patchStorageDescriptionWithKeys);
                }
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:63,代码来源:AzureInstanceService.java


示例11: constructStorageDescription

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
private static StorageDescription constructStorageDescription(StorageAccountInner sa, ServiceHost host,
        String serviceSelfLink, ComputeStateWithDescription parent,
        StorageAccountInner contextStorage,
        StorageAccountListKeysResultInner keys) {
    AuthCredentialsServiceState storageAuth = new AuthCredentialsServiceState();
    storageAuth.documentSelfLink = UUID.randomUUID().toString();
    storageAuth.customProperties = new HashMap<>();
    for (StorageAccountKey key : keys.keys()) {
        storageAuth.customProperties.put(getStorageAccountKeyName(storageAuth.customProperties), key.value());
    }
    storageAuth.tenantLinks = parent.tenantLinks;
    if (parent.endpointLink != null) {
        storageAuth.customProperties.put(CUSTOM_PROP_ENDPOINT_LINK,
                parent.endpointLink);
    }

    Operation storageAuthOp = Operation
            .createPost(createInventoryUri(host, AuthCredentialsService.FACTORY_LINK))
            .setBody(storageAuth);
    storageAuthOp.setReferer(UriUtils.buildUri(host.getPublicUri(), serviceSelfLink));
    host.sendRequest(storageAuthOp);

    String storageAuthLink = UriUtils.buildUriPath(AuthCredentialsService.FACTORY_LINK,
            storageAuth.documentSelfLink);
    StorageDescription storageDescription = new StorageDescription();
    storageDescription.id = contextStorage.id();
    storageDescription.regionId = contextStorage.location();
    storageDescription.name = contextStorage.name();
    storageDescription.authCredentialsLink = storageAuthLink;
    storageDescription.resourcePoolLink = parent.resourcePoolLink;
    storageDescription.documentSelfLink = UUID.randomUUID().toString();
    storageDescription.endpointLink = parent.endpointLink;
    AdapterUtils.addToEndpointLinks(storageDescription, parent.endpointLink);
    storageDescription.computeHostLink = parent.documentSelfLink;
    storageDescription.customProperties = new HashMap<>();
    storageDescription.customProperties.put(AZURE_STORAGE_TYPE, AZURE_STORAGE_ACCOUNTS);
    storageDescription.customProperties.put(AZURE_STORAGE_ACCOUNT_URI, null);
    storageDescription.tenantLinks = parent.tenantLinks;
    storageDescription.type = contextStorage.sku().name().toString();
    if (sa != null && sa.creationTime() != null) {
        storageDescription.creationTimeMicros = TimeUnit.MILLISECONDS
                .toMicros(sa.creationTime().getMillis());
    }
    return storageDescription;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:46,代码来源:AzureUtils.java


示例12: getStorageAccountKeys

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
public List<StorageAccountKey> getStorageAccountKeys(String resourceGroup, String storageName) {
    return getStorageAccountByGroup(resourceGroup, storageName).getKeys();
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:4,代码来源:AzureClient.java


示例13: keys

import com.microsoft.azure.management.storage.StorageAccountKey; //导入依赖的package包/类
/**
 * Get the keys value.
 *
 * @return the keys value
 */
public List<StorageAccountKey> keys() {
    return this.keys;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:9,代码来源:StorageAccountListKeysResultInner.java



注:本文中的com.microsoft.azure.management.storage.StorageAccountKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JTypeVar类代码示例发布时间:2022-05-23
下一篇:
Java Speaker类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap