本文整理汇总了C#中WindowsAzureSubscription类的典型用法代码示例。如果您正苦于以下问题:C# WindowsAzureSubscription类的具体用法?C# WindowsAzureSubscription怎么用?C# WindowsAzureSubscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WindowsAzureSubscription类属于命名空间,在下文中一共展示了WindowsAzureSubscription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AdalConfiguration
public AdalConfiguration(WindowsAzureSubscription subscription)
: this()
{
AdEndpoint = subscription.ActiveDirectoryEndpoint != null ? subscription.ActiveDirectoryEndpoint.TrimEnd('/') + '/' : null;
AdDomain = subscription.ActiveDirectoryTenantId;
ResourceClientUri = subscription.ActiveDirectoryServiceEndpointResourceId;
}
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:7,代码来源:AdalConfiguration.cs
示例2: GetJobSubmissionClientCredentials
public static IJobSubmissionClientCredential GetJobSubmissionClientCredentials(this IAzureHDInsightJobCommandCredentialsBase command, WindowsAzureSubscription currentSubscription, string cluster)
{
IJobSubmissionClientCredential clientCredential = null;
if (command.Credential != null)
{
clientCredential = new BasicAuthCredential
{
Server = GatewayUriResolver.GetGatewayUri(cluster),
UserName = command.Credential.UserName,
Password = command.Credential.GetCleartextPassword()
};
}
else if (currentSubscription.IsNotNull())
{
var subscriptionCredentials = GetSubscriptionCredentials(command, currentSubscription);
var asCertificateCredentials = subscriptionCredentials as HDInsightCertificateCredential;
var asTokenCredentials = subscriptionCredentials as HDInsightAccessTokenCredential;
if (asCertificateCredentials.IsNotNull())
{
clientCredential = new JobSubmissionCertificateCredential(asCertificateCredentials, cluster);
}
else if (asTokenCredentials.IsNotNull())
{
clientCredential = new JobSubmissionAccessTokenCredential(asTokenCredentials, cluster);
}
}
return clientCredential;
}
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:29,代码来源:AzureHDInsightCommandExtensions.cs
示例3: Initialize
public void Initialize()
{
var azureSub = new WindowsAzureSubscription();
azureSub.ServiceEndpoint = new Uri("https://localhost:8090/");
azureSub.SubscriptionId = Guid.NewGuid().ToString();
this.subscription = new Subscription(azureSub);
}
开发者ID:khaled-ibrahim,项目名称:azure-sdk-tools,代码行数:7,代码来源:GetAbsoluteUriTests.cs
示例4: WebsitesClient
/// <summary>
/// Creates new WebsitesClient
/// </summary>
/// <param name="subscription">Subscription containing websites to manipulate</param>
/// <param name="logger">The logger action</param>
public WebsitesClient(WindowsAzureSubscription subscription, Action<string> logger)
{
Logger = logger;
cloudServiceClient = new CloudServiceClient(subscription, debugStream: logger);
WebsiteManagementClient = subscription.CreateClient<WebSiteManagementClient>();
this.subscription = subscription;
}
开发者ID:kenazk,项目名称:azure-sdk-tools,代码行数:12,代码来源:WebsitesClient.cs
示例5: IsStorageServiceAvailable
public bool IsStorageServiceAvailable(WindowsAzureSubscription subscription, string name)
{
EnsureCloudServiceClientInitialized(subscription);
bool available = this.CloudServiceClient.CheckStorageServiceAvailability(name);
WriteObject(!available);
return available;
}
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:7,代码来源:TestAzureName.cs
示例6: ServerDataServiceCertAuth
/// <summary>
/// Initializes a new instance of the <see cref="ServerDataServicesCertAuth"/> class
/// </summary>
/// <param name="subscription">The subscription used to connect and authenticate.</param>
/// <param name="serverName">The name of the server to connect to.</param>
private ServerDataServiceCertAuth(
WindowsAzureSubscription subscription,
string serverName)
{
this.serverName = serverName;
this.subscription = subscription;
}
开发者ID:ranjitk9,项目名称:azure-sdk-tools,代码行数:12,代码来源:ServerDataServiceCertAuth.cs
示例7: GetSubscriptionCertificateCredentials
public static IHDInsightSubscriptionCredentials GetSubscriptionCertificateCredentials(this IAzureHDInsightCommonCommandBase command, WindowsAzureSubscription currentSubscription)
{
return new HDInsightCertificateCredential
{
SubscriptionId = ResolveSubscriptionId(currentSubscription.SubscriptionId),
Certificate = currentSubscription.Certificate,
Endpoint = currentSubscription.ServiceEndpoint,
};
}
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:9,代码来源:AzureHDInsightCommandExtensions.cs
示例8: AutomationClient
public AutomationClient(
WindowsAzureSubscription subscription,
IAutomationManagementClient automationManagementClient)
{
Requires.Argument("automationManagementClient", automationManagementClient).NotNull();
this.Subscription = subscription;
this.automationManagementClient = automationManagementClient;
}
开发者ID:NordPool,项目名称:azure-sdk-tools,代码行数:9,代码来源:AutomationClient.cs
示例9: ResourcesClient
/// <summary>
/// Creates new ResourceManagementClient
/// </summary>
/// <param name="subscription">Subscription containing resources to manipulate</param>
public ResourcesClient(WindowsAzureSubscription subscription)
: this(
subscription.CreateClientFromResourceManagerEndpoint<ResourceManagementClient>(),
new StorageClientWrapper(subscription.CreateClient<StorageManagementClient>()),
new GalleryTemplatesClient(subscription),
subscription.CreateClientFromResourceManagerEndpoint<EventsClient>())
{
}
开发者ID:kangyangthu,项目名称:azure-sdk-tools,代码行数:13,代码来源:ResourceClient.cs
示例10: EnsureCloudServiceClientInitialized
private void EnsureCloudServiceClientInitialized(WindowsAzureSubscription subscription)
{
this.CloudServiceClient = this.CloudServiceClient ?? new CloudServiceClient(
subscription,
SessionState.Path.CurrentLocation.Path,
WriteDebug,
WriteVerbose,
WriteWarning);
}
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:9,代码来源:TestAzureName.cs
示例11: GetAccessTokenCredentials
public static IHDInsightSubscriptionCredentials GetAccessTokenCredentials(this IAzureHDInsightCommonCommandBase command, WindowsAzureSubscription currentSubscription)
{
var accessToken = currentSubscription.TokenProvider.GetCachedToken(currentSubscription,
currentSubscription.ActiveDirectoryUserId);
return new HDInsightAccessTokenCredential()
{
SubscriptionId = ResolveSubscriptionId(currentSubscription.SubscriptionId),
AccessToken = accessToken.AccessToken
};
}
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:10,代码来源:AzureHDInsightCommandExtensions.cs
示例12: GetCachedToken
public IAccessToken GetCachedToken(WindowsAzureSubscription subscription, string userId)
{
var key = tokenCache.Keys.FirstOrDefault(k => k.UserId == userId && k.TenantId == subscription.ActiveDirectoryTenantId);
if (key == null)
{
throw new AadAuthenticationFailedException(string.Format(Resources.NoCachedToken,
subscription.SubscriptionName, userId));
}
return new AdalAccessToken(DecodeCachedAuthResult(key), this, new AdalConfiguration(subscription));
}
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:11,代码来源:AdalTokenProvider.cs
示例13: Subscription
internal Subscription(WindowsAzureSubscription azureSubscription)
{
if (azureSubscription == null)
{
throw new ArgumentNullException();
}
this.SubscriptionName = azureSubscription.SubscriptionName;
this.SubscriptionId = azureSubscription.SubscriptionId;
this.ServiceEndpoint = new Uri(String.Format("{0}/{1}/services/systemcenter/vmm", azureSubscription.ServiceEndpoint.ToString().TrimEnd(new[]{'/'}), SubscriptionId));
this.Certificate = azureSubscription.Certificate;
this.CredentialType = CredentialType.UseCertificate;
}
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:13,代码来源:Subscription.cs
示例14: GetSubscriptionCredentials
public static IHDInsightSubscriptionCredentials GetSubscriptionCredentials(this IAzureHDInsightCommonCommandBase command, WindowsAzureSubscription currentSubscription)
{
if (currentSubscription.Certificate.IsNotNull())
{
return GetSubscriptionCertificateCredentials(command, currentSubscription);
}
else if (currentSubscription.ActiveDirectoryUserId.IsNotNull())
{
return GetAccessTokenCredentials(command, currentSubscription);
}
throw new NotSupportedException();
}
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:13,代码来源:AzureHDInsightCommandExtensions.cs
示例15: ValidateSubscription
/// <summary>
/// Validates that the given subscription is valid.
/// </summary>
/// <param name="subscription">The <see cref="WindowsAzureSubscription"/> to validate.</param>
public static void ValidateSubscription(WindowsAzureSubscription subscription)
{
if (subscription == null)
{
throw new ArgumentException(
Common.Properties.Resources.InvalidCurrentSubscription);
}
if (string.IsNullOrEmpty(subscription.SubscriptionId))
{
throw new ArgumentException(
Common.Properties.Resources.InvalidCurrentSubscriptionId);
}
}
开发者ID:kangyangthu,项目名称:azure-sdk-tools,代码行数:18,代码来源:SqlDatabaseCmdletBase.cs
示例16: CreateNewSubscription
private void CreateNewSubscription()
{
var subscription = new WindowsAzureSubscription
{
SubscriptionName = SubscriptionName,
SubscriptionId = SubscriptionId,
Certificate = Certificate,
CurrentStorageAccountName = CurrentStorageAccountName
};
if (string.IsNullOrEmpty(ServiceEndpoint))
{
subscription.ServiceEndpoint = new Uri(Profile.CurrentEnvironment.ServiceEndpoint);
}
else
{
subscription.ServiceEndpoint = new Uri(ServiceEndpoint);
}
Profile.AddSubscription(subscription);
}
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:21,代码来源:SetAzureSubscription.cs
示例17: SchedulerMgmntClient
/// <summary>
/// Creates new Scheduler Management Convenience Client
/// </summary>
/// <param name="subscription">Subscription containing websites to manipulate</param>
public SchedulerMgmntClient(WindowsAzureSubscription subscription)
{
currentSubscription = subscription;
csmClient = subscription.CreateClient<CloudServiceManagementClient>();
schedulerManagementClient = subscription.CreateClient<SchedulerManagementClient>();
//Get RP properties
IDictionary<string, string> dict = schedulerManagementClient.GetResourceProviderProperties().Properties;
//Get available regions
string val = string.Empty;
if(dict.TryGetValue(SupportedRegionsKey, out val))
{
AvailableRegions = new List<string>();
val.Split(',').ToList().ForEach(s => AvailableRegions.Add(s));
}
//Store global counts for max jobs and min recurrence for each plan
if(dict.TryGetValue(FreeMaxJobCountKey, out val))
FreeMaxJobCountValue = Convert.ToInt32(dict[FreeMaxJobCountKey]);
if (dict.TryGetValue(FreeMinRecurrenceKey, out val))
FreeMinRecurrenceValue = TimeSpan.Parse(dict[FreeMinRecurrenceKey]);
if (dict.TryGetValue(StandardMaxJobCountKey, out val))
StandardMaxJobCountValue = Convert.ToInt32(dict[StandardMaxJobCountKey]);
if (dict.TryGetValue(StandardMinRecurrenceKey, out val))
StandardMinRecurrenceValue = TimeSpan.Parse(dict[StandardMinRecurrenceKey]);
if (dict.TryGetValue(PremiumMaxJobCountKey, out val))
PremiumMaxJobCountValue = Convert.ToInt32(dict[PremiumMaxJobCountKey]);
if (dict.TryGetValue(PremiumMinRecurrenceKey, out val))
PremiumMinRecurrenceValue = TimeSpan.Parse(dict[PremiumMinRecurrenceKey]);
}
开发者ID:NordPool,项目名称:azure-sdk-tools,代码行数:40,代码来源:SchedulerMgmntClient.cs
示例18: PSCacheClient
public PSCacheClient(WindowsAzureSubscription currentSubscription)
{
client = currentSubscription.CreateClient<ManagedCacheClient>();
}
开发者ID:NordPool,项目名称:azure-sdk-tools,代码行数:4,代码来源:PSCacheClient.cs
示例19: SetupAzureEnvironmentFromEnvironmentVariables
private void SetupAzureEnvironmentFromEnvironmentVariables()
{
ServiceManagementTestEnvironmentFactory serviceManagementTestEnvironmentFactory = new ServiceManagementTestEnvironmentFactory();
TestEnvironment rdfeEnvironment = serviceManagementTestEnvironmentFactory.GetTestEnvironment();
ResourceManagerTestEnvironmentFactory resourceManagerTestEnvironmentFactory = new ResourceManagerTestEnvironmentFactory();
TestEnvironment csmEnvironment = resourceManagerTestEnvironmentFactory.GetTestEnvironment();
string jwtToken = csmEnvironment.Credentials != null ?
((TokenCloudCredentials)csmEnvironment.Credentials).Token : null;
WindowsAzureProfile.Instance.TokenProvider = new FakeAccessTokenProvider(jwtToken, csmEnvironment.UserName);
WindowsAzureProfile.Instance.CurrentEnvironment = WindowsAzureProfile.Instance.Environments[testEnvironmentName];
WindowsAzureProfile.Instance.CurrentEnvironment.ActiveDirectoryEndpoint =
csmEnvironment.ActiveDirectoryEndpoint.AbsoluteUri;
WindowsAzureProfile.Instance.CurrentEnvironment.GalleryEndpoint =
csmEnvironment.GalleryUri.AbsoluteUri;
WindowsAzureProfile.Instance.CurrentEnvironment.ResourceManagerEndpoint =
csmEnvironment.BaseUri.AbsoluteUri;
WindowsAzureProfile.Instance.CurrentEnvironment.ServiceEndpoint =
rdfeEnvironment.BaseUri.AbsoluteUri;
var newSubscription = new WindowsAzureSubscription(false, false)
{
SubscriptionId = csmEnvironment.SubscriptionId,
ActiveDirectoryEndpoint =
WindowsAzureProfile.Instance.CurrentEnvironment.ActiveDirectoryEndpoint,
ActiveDirectoryUserId = csmEnvironment.UserName,
SubscriptionName = csmEnvironment.SubscriptionId,
ServiceEndpoint = new Uri(WindowsAzureProfile.Instance.CurrentEnvironment.ServiceEndpoint),
ResourceManagerEndpoint = new Uri(WindowsAzureProfile.Instance.CurrentEnvironment.ResourceManagerEndpoint),
TokenProvider = WindowsAzureProfile.Instance.TokenProvider,
GalleryEndpoint = new Uri(WindowsAzureProfile.Instance.CurrentEnvironment.GalleryEndpoint),
SqlDatabaseDnsSuffix = WindowsAzureProfile.Instance.CurrentEnvironment.SqlDatabaseDnsSuffix,
CurrentStorageAccountName = csmEnvironment.StorageAccount,
IsDefault = true
};
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
{
newSubscription.SetAccessToken(new FakeAccessToken
{
AccessToken = "123",
UserId = csmEnvironment.UserName
});
}
else
{
newSubscription.SetAccessToken(WindowsAzureProfile.Instance.TokenProvider.GetNewToken(WindowsAzureProfile.Instance.CurrentEnvironment));
}
WindowsAzureProfile.Instance.AddSubscription(newSubscription);
WindowsAzureProfile.Instance.Save();
}
开发者ID:jianghaolu,项目名称:azure-sdk-tools,代码行数:53,代码来源:WindowsAzurePowerShellTokenTest.cs
示例20: GetWindowsAzureSubscription
private static WindowsAzureSubscription GetWindowsAzureSubscription()
{
WindowsAzureSubscription windowsAzureSubscription = new WindowsAzureSubscription
{
SubscriptionId = SubscriptionId,
Certificate = new X509Certificate2(new byte[] {}),
ServiceEndpoint = new Uri("http://someValue")
};
return windowsAzureSubscription;
}
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:10,代码来源:MediaServicesClientTests.cs
注:本文中的WindowsAzureSubscription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论