本文整理汇总了Java中com.microsoft.windowsazure.Configuration类的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Configuration类属于com.microsoft.windowsazure包,在下文中一共展示了Configuration类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: waitForStatus
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
private OperationStatus waitForStatus(Configuration configuration, WindowsAzureServiceManagement service, String requestId)
throws Exception {
OperationStatusResponse op;
OperationStatus status = null;
do {
op = service.getOperationStatus(configuration, requestId);
status = op.getStatus();
log(message("deplId") + op.getId());
log(message("deplStatus") + op.getStatus());
log(message("deplHttpStatus") + op.getHttpStatusCode());
if (op.getError() != null) {
log(message("deplErrorMessage") + op.getError().getMessage());
throw new RestAPIException(op.getError().getMessage());
}
Thread.sleep(5000);
} while (status == OperationStatus.InProgress);
return status;
}
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:23,代码来源:DeploymentManager.java
示例2: getConfiguration
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public static Configuration getConfiguration(File file, String subscriptionId) throws IOException {
try {
// Get current context class loader
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
// Change context classloader to class context loader
Thread.currentThread().setContextClassLoader(WindowsAzureRestUtils.class.getClassLoader());
Configuration configuration = PublishSettingsLoader.createManagementConfiguration(file.getPath(), subscriptionId);
// Call Azure API and reset back the context loader
Thread.currentThread().setContextClassLoader(contextLoader);
log("Created configuration for subscriptionId: " + subscriptionId);
return configuration;
} catch (IOException ex) {
log(message("error"), ex);
throw ex;
}
}
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:17,代码来源:WindowsAzureRestUtils.java
示例3: get
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
@Override
public DnsManagementClient get()
{
try
{
final Configuration config = ManagementConfiguration.configure(null,
URI.create("https://management.core.windows.net/"),
subscriptionId,
azureCredentials.get().getToken());
return config.create(DnsManagementClient.class);
}
catch (IOException e)
{
throw new RuntimeException("Error building Azure DNS Client", e);
}
}
开发者ID:petergeneric,项目名称:stdlib,代码行数:18,代码来源:AzureDNSClientProvider.java
示例4: AzureComputeServiceImpl
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public AzureComputeServiceImpl(Settings settings) {
super(settings);
String subscriptionId = getRequiredSetting(settings, Management.SUBSCRIPTION_ID_SETTING);
serviceName = getRequiredSetting(settings, Management.SERVICE_NAME_SETTING);
String keystorePath = getRequiredSetting(settings, Management.KEYSTORE_PATH_SETTING);
String keystorePassword = getRequiredSetting(settings, Management.KEYSTORE_PASSWORD_SETTING);
KeyStoreType keystoreType = Management.KEYSTORE_TYPE_SETTING.get(settings);
logger.trace("creating new Azure client for [{}], [{}]", subscriptionId, serviceName);
try {
// Azure SDK configuration uses DefaultBuilder which uses java.util.ServiceLoader to load the
// various Azure services. By default, this will use the current thread's context classloader
// to load services. Since the current thread refers to the main application classloader it
// won't find any Azure service implementation.
// Here we basically create a new DefaultBuilder that uses the current class classloader to load services.
DefaultBuilder builder = new DefaultBuilder();
for (Builder.Exports exports : ServiceLoader.load(Builder.Exports.class, getClass().getClassLoader())) {
exports.register(builder);
}
// And create a new blank configuration based on the previous DefaultBuilder
Configuration configuration = new Configuration(builder);
configuration.setProperty(Configuration.PROPERTY_LOG_HTTP_REQUESTS, logger.isTraceEnabled());
Configuration managementConfig = ManagementConfiguration.configure(null, configuration,
Management.ENDPOINT_SETTING.get(settings), subscriptionId, keystorePath, keystorePassword, keystoreType);
logger.debug("creating new Azure client for [{}], [{}]", subscriptionId, serviceName);
client = ComputeManagementService.create(managementConfig);
} catch (IOException e) {
throw new ElasticsearchException("Unable to configure Azure compute service", e);
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:36,代码来源:AzureComputeServiceImpl.java
示例5: unPublish
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
/**
* Unpublish deployment without notifying user.
*
* @param configuration
* @param serviceName
* @param deplymentName
*/
public void unPublish(
Configuration configuration,
String serviceName,
String deplymentName,
int[] progressArr) {
String requestId = null;
int retryCount = 0;
boolean successfull = false;
Date startDate = new Date();
while (!successfull) {
try {
retryCount++;
WindowsAzureServiceManagement service = WizardCacheManager.createServiceManagementHelper();
// Commenting suspend deployment call since it is giving issues in china cloud.
// notifyProgress(deplymentName, null, progressArr[0], OperationStatus.InProgress,
// Messages.stoppingMsg, serviceName);
// requestId = service.updateDeploymentStatus(configuration,
// serviceName,
// deplymentName,
// UpdatedDeploymentStatus.Suspended
// );
// waitForStatus(configuration, service, requestId);
notifyProgress(deplymentName, startDate, null, progressArr[0], OperationStatus.InProgress, message("undeployProgressMsg"), deplymentName);
requestId = service.deleteDeployment(configuration, serviceName, deplymentName);
waitForStatus(configuration, service, requestId);
notifyProgress(deplymentName, startDate, null, progressArr[1], OperationStatus.Succeeded, message("undeployCompletedMsg"), serviceName);
successfull = true;
} catch (Exception e) {
// Retry 5 times
if (retryCount > AzurePlugin.REST_SERVICE_MAX_RETRY_COUNT) {
log(message("deplError"), e);
notifyProgress(deplymentName, startDate, null, 100, OperationStatus.Failed, e.getMessage(), serviceName);
}
notifyProgress(deplymentName, startDate, null, -progressArr[0], OperationStatus.InProgress, message("undeployProgressMsg"), deplymentName);
}
}
}
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:46,代码来源:DeploymentManager.java
示例6: loadConfiguration
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public static Configuration loadConfiguration(String subscriptionId, String url) throws IOException {
String keystore = System.getProperty("user.home") + File.separator + ".azure" + File.separator + subscriptionId + ".out";
URI mngUri = URI.create(url);
// Get current context class loader
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
// Change context classloader to class context loader
Thread.currentThread().setContextClassLoader(WindowsAzureRestUtils.class.getClassLoader());
Configuration configuration = ManagementConfiguration.configure(null, Configuration.load(), mngUri, subscriptionId, keystore, "", KeyStoreType.pkcs12);
// Call Azure API and reset back the context loader
Thread.currentThread().setContextClassLoader(contextLoader);
return configuration;
}
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:13,代码来源:WindowsAzureRestUtils.java
示例7: AzureConnector
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public AzureConnector(String endpoint, String provider,String login,String secretKey){
journal.log(Level.INFO, ">> Connecting to "+provider+" ...");
Configuration config = null;
try {
config = createConfiguration(endpoint,provider,login,secretKey);
} catch (Exception e) {
e.printStackTrace();
}
journal.log(Level.INFO, ">> Authenticating ...");
computeManagementClient = ComputeManagementService.create(config);
hostedServicesOperations = computeManagementClient.getHostedServicesOperations();
}
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:13,代码来源:AzureConnector.java
示例8: createConfiguration
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
private Configuration createConfiguration(String endpoint, String provider,String login,String secretKey) throws Exception {
return ManagementConfiguration.configure(
new URI("https://management.core.windows.net"),
endpoint,
login,
secretKey,
KeyStoreType.pkcs12
);
}
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:10,代码来源:AzureConnector.java
示例9: createConfiguration
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public Configuration createConfiguration(VertxContext<Server> vertxContext) throws Exception {
return configure(null, createCredentials(vertxContext));
}
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:4,代码来源:AzureKms.java
示例10: createKeyVaultClient
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
protected KeyVaultClient createKeyVaultClient(VertxContext<Server> vertxContext) throws Exception {
Configuration config = createConfiguration(vertxContext);
return create(config);
}
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:6,代码来源:AzureKms.java
示例11: main
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public static void main(String[] args)
{
try
{
//Load SubscriptionID, TenantID, Application ID and Password from the config file
LoadConfiguration();
//Fetch the Auth Headers for our requests
String token = GetAuthorizationHeader();
//Create Configuration Object
Configuration config = ManagementConfiguration.configure(
null,
new URI("https://management.azure.com/"),
subscriptionId,
token);
//Create the Resource Management Client, we will use this for creating a Resource Group later
ResourceManagementClient resourcesClient = ResourceManagementService.create(config);
//Create the Resource Management Client, we will use this for managing storage accounts
StorageManagementClient storageMgmtClient = StorageManagementService.create(config);
//Create a new resource group
CreateResourceGroup(rgName, resourcesClient);
//Register our subscription with the Storage Resource Provider
resourcesClient.getProvidersOperations().register("Microsoft.Storage");
//Create a new account in a specific resource group with the specified account name
CreateStorageAccount(rgName, accountName, storageMgmtClient);
//Get all the account properties for a given resource group and account name
StorageAccount storAcct = storageMgmtClient.getStorageAccountsOperations().getProperties(rgName, accountName).getStorageAccount();
//Get a list of storage accounts within a specific resource group
ArrayList<StorageAccount> storAccts = storageMgmtClient.getStorageAccountsOperations().listByResourceGroup(rgName).getStorageAccounts();
//Get all the storage accounts for a given subscription
ArrayList<StorageAccount> storAcctsSub = storageMgmtClient.getStorageAccountsOperations().list().getStorageAccounts();
//Get the storage account keys for a given account and resource group
StorageAccountKeys acctKeys = storageMgmtClient.getStorageAccountsOperations().listKeys(rgName, accountName).getStorageAccountKeys();
//Regenerate the account key for a given account in a specific resource group
StorageAccountKeys regenAcctKeys = storageMgmtClient.getStorageAccountsOperations().regenerateKey(rgName, accountName, KeyName.KEY1).getStorageAccountKeys();
//Update the storage account for a given account name and resource group
UpdateStorageAccount(rgName, accountName, storageMgmtClient);
//Check if the account name is available
boolean nameAvailable = storageMgmtClient.getStorageAccountsOperations().checkNameAvailability(accountName).isNameAvailable();
//Delete a storage account with the given account name and a resource group
DeleteStorageAccount(rgName, accountName, storageMgmtClient);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
开发者ID:mjeelanimsft,项目名称:storage-java-resource-provider-getting-started,代码行数:62,代码来源:StorageResourceProviderSample.java
示例12: main
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(1);
try {
// Connect to Media Services API with service principal and client symmetric key
AzureAdTokenCredentials credentials = new AzureAdTokenCredentials(
tenant,
new AzureAdClientSymmetricKey(clientId, clientKey),
AzureEnvironments.AZURE_CLOUD_ENVIRONMENT);
TokenProvider provider = new AzureAdTokenProvider(credentials, executorService);
// create a new configuration with the new credentials
Configuration configuration = MediaConfiguration.configureWithAzureAdTokenProvider(
new URI(restApiEndpoint),
provider);
// create the media service provisioned with the new configuration
mediaService = MediaService.create(configuration);
System.out.println("Azure SDK for Java - Media Analytics Sample (Indexer)");
// Upload a local file to an Asset
AssetInfo sourceAsset = uploadFileAndCreateAsset(mediaFileName);
System.out.println("Uploaded Asset Id: " + sourceAsset.getId());
// Create indexing task configuration based on parameters
String indexerTaskPresetTemplate = new String(Files.readAllBytes(
Paths.get(new URL(Program.class.getClassLoader().getResource(""), indexerTaskPresetTemplateFileName).toURI())));
String taskConfiguration = String.format(indexerTaskPresetTemplate, title, description, language, captionFormats, generateAIB, generateKeywords);
// Run indexing job to generate output asset
AssetInfo outputAsset = runIndexingJob(sourceAsset, taskConfiguration);
System.out.println("Output Asset Id: " + outputAsset.getId());
// Download output asset files
downloadAssetFiles(outputAsset, destinationPath);
// Done
System.out.println("Sample completed!");
} catch (ServiceException se) {
System.out.println("ServiceException encountered.");
System.out.println(se.toString());
} catch (Exception e) {
System.out.println("Exception encountered.");
System.out.println(e.toString());
} finally {
executorService.shutdown();
}
}
开发者ID:southworkscom,项目名称:azure-sdk-for-media-services-java-samples,代码行数:52,代码来源:Program.java
示例13: main
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(1);
try {
String tenant = "tenant.domain.com";
String clientId = "%client_id%";
String clientKey = "%client_key%";
String restApiEndpoint = "https://account.restv2.region.media.azure.net/api/";
// Connect to Media Services API with service principal and client symmetric key
AzureAdTokenCredentials credentials = new AzureAdTokenCredentials(
tenant,
new AzureAdClientSymmetricKey(clientId, clientKey),
AzureEnvironments.AZURE_CLOUD_ENVIRONMENT);
TokenProvider provider = new AzureAdTokenProvider(credentials, executorService);
// create a new configuration with the new credentials
Configuration configuration = MediaConfiguration.configureWithAzureAdTokenProvider(
new URI(restApiEndpoint),
provider);
// create the media service provisioned with the new configuration
MediaContract mediaService = MediaService.create(configuration);
System.out.println("Listing assets");
ListResult<AssetInfo> assets = mediaService.list(Asset.list());
for (AssetInfo asset : assets) {
System.out.println(asset.getId());
}
} catch (ServiceException se) {
System.out.println("ServiceException encountered.");
System.out.println(se.toString());
} catch (Throwable e) {
System.out.println("Exception encountered.");
e.printStackTrace();
System.out.println(e.toString());
} finally {
executorService.shutdown();
}
}
开发者ID:southworkscom,项目名称:azure-sdk-for-media-services-java-samples,代码行数:45,代码来源:ServicePrincipalWithSymmetricKey.java
示例14: main
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(1);
try {
String tenant = "tenant.domain.com";
String username = "[email protected]";
String password = "thePass";
String restApiEndpoint = "https://account.restv2.region.media.azure.net/api/";
// Connect to Media Services API with user/password authentication
AzureAdTokenCredentials credentials = new AzureAdTokenCredentials(
tenant,
new AzureAdClientUsernamePassword(username, password),
AzureEnvironments.AZURE_CLOUD_ENVIRONMENT);
TokenProvider provider = new AzureAdTokenProvider(credentials, executorService);
// create a new configuration with the new credentials
Configuration configuration = MediaConfiguration.configureWithAzureAdTokenProvider(
new URI(restApiEndpoint),
provider);
// create the media service provisioned with the new configuration
MediaContract mediaService = MediaService.create(configuration);
System.out.println("Listing assets");
ListResult<AssetInfo> assets = mediaService.list(Asset.list());
for (AssetInfo asset : assets) {
System.out.println(asset.getId());
}
} catch (ServiceException se) {
System.out.println("ServiceException encountered.");
System.out.println(se.toString());
} catch (Throwable e) {
System.out.println("Exception encountered.");
e.printStackTrace();
System.out.println(e.toString());
} finally {
executorService.shutdown();
}
}
开发者ID:southworkscom,项目名称:azure-sdk-for-media-services-java-samples,代码行数:45,代码来源:UserPassAuth.java
示例15: main
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(1);
try {
String tenant = "tenant.domain.com";
String clientId = "%client_id%";
String restApiEndpoint = "https://account.restv2.region.media.azure.net/api/";
String pfxFilename = "%path_to_keystore.pfx%";
String pfxPassword = "%keystore_password%";
InputStream pfx = new FileInputStream(pfxFilename);
// Connect to Media Services API with service principal and client certificate
AzureAdTokenCredentials credentials = new AzureAdTokenCredentials(
tenant,
AsymmetricKeyCredential.create(clientId, pfx, pfxPassword),
AzureEnvironments.AZURE_CLOUD_ENVIRONMENT);
TokenProvider provider = new AzureAdTokenProvider(credentials, executorService);
// create a new configuration with the new credentials
Configuration configuration = MediaConfiguration.configureWithAzureAdTokenProvider(
new URI(restApiEndpoint),
provider);
// create the media service with the new configuration
MediaContract mediaService = MediaService.create(configuration);
System.out.println("Listing assets");
ListResult<AssetInfo> assets = mediaService.list(Asset.list());
for (AssetInfo asset : assets) {
System.out.println(asset.getId());
}
} catch (ServiceException se) {
System.out.println("ServiceException encountered.");
System.out.println(se.toString());
} catch (Throwable e) {
System.out.println("Exception encountered.");
e.printStackTrace();
System.out.println(e.toString());
} finally {
executorService.shutdown();
}
}
开发者ID:southworkscom,项目名称:azure-sdk-for-media-services-java-samples,代码行数:47,代码来源:ServicePrincipalWithClientCertificate.java
示例16: waitForDeployment
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
private DeploymentGetResponse waitForDeployment(Configuration configuration, String serviceName, String deployState)
throws Exception {
DeploymentGetResponse deployment = null;
String status = null;
DeploymentSlot deploymentSlot;
if (DeploymentSlot.Staging.toString().equalsIgnoreCase(deployState)) {
deploymentSlot = DeploymentSlot.Staging;
} else if (DeploymentSlot.Production.toString().equalsIgnoreCase(deployState)) {
deploymentSlot = DeploymentSlot.Production;
} else {
throw new Exception("Invalid deployment slot name");
}
do {
Thread.sleep(5000);
deployment = WindowsAzureRestUtils.getDeploymentBySlot(configuration, serviceName, deploymentSlot);
for (RoleInstance instance : deployment.getRoleInstances()) {
status = instance.getInstanceStatus();
if (InstanceStatus.ReadyRole.getInstanceStatus().equals(status)
|| InstanceStatus.CyclingRole.getInstanceStatus().equals(status)
|| InstanceStatus.FailedStartingVM.getInstanceStatus().equals(status)
|| InstanceStatus.UnresponsiveRole.getInstanceStatus().equals(status)) {
break;
}
}
} while (status != null && !(InstanceStatus.ReadyRole.getInstanceStatus().equals(status)
|| InstanceStatus.CyclingRole.getInstanceStatus().equals(status)
|| InstanceStatus.FailedStartingVM.getInstanceStatus().equals(status)
|| InstanceStatus.UnresponsiveRole.getInstanceStatus().equals(status)));
if (!InstanceStatus.ReadyRole.getInstanceStatus().equals(status)) {
throw new DeploymentException(status);
}
// check deployment status. And let Transitioning phase to finish
DeploymentStatus deploymentStatus = null;
do {
Thread.sleep(10000);
deployment = WindowsAzureRestUtils.getDeploymentBySlot(configuration, serviceName, deploymentSlot);
deploymentStatus = deployment.getStatus();
} while (deploymentStatus != null
&& (deploymentStatus.equals(DeploymentStatus.RunningTransitioning)
|| deploymentStatus.equals(DeploymentStatus.SuspendedTransitioning)));
return deployment;
}
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:45,代码来源:DeploymentManager.java
示例17: undeploy
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
public void undeploy(final String serviceName, final String deplymentName, final String deploymentState)
throws WACommonException, RestAPIException, InterruptedException {
Configuration configuration = WizardCacheManager.getCurrentPublishData().getCurrentConfiguration();
int[] progressArr = new int[]{50, 50};
unPublish(configuration, serviceName, deplymentName, progressArr);
}
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:7,代码来源:DeploymentManager.java
示例18: createComputeManagementClient
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
private ComputeManagementClient createComputeManagementClient(String subscriptionId, String keyStoreLocation, String keyStorePassword) throws ConnectorException {
Configuration config = createConfiguration(subscriptionId, keyStoreLocation, keyStorePassword);
return ComputeManagementService.create(config);
}
开发者ID:Appdynamics,项目名称:azure-connector-extension,代码行数:5,代码来源:ConnectorLocator.java
示例19: createStorageManagementClient
import com.microsoft.windowsazure.Configuration; //导入依赖的package包/类
private static StorageManagementClient createStorageManagementClient(String subscriptionId, String keyStoreLocation, String keyStorePassword) throws ConnectorException {
Configuration config = ConnectorLocator.getInstance().createConfiguration(subscriptionId, keyStoreLocation, keyStorePassword);
return StorageManagementService.create(config);
}
开发者ID:Appdynamics,项目名称:azure-connector-extension,代码行数:5,代码来源:AzureActions.java
注:本文中的com.microsoft.windowsazure.Configuration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论