本文整理汇总了C#中WindowsAzureSubscription类的典型用法代码示例。如果您正苦于以下问题:C# WindowsAzureSubscription类的具体用法?C# WindowsAzureSubscription怎么用?C# WindowsAzureSubscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WindowsAzureSubscription类属于命名空间,在下文中一共展示了WindowsAzureSubscription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdalConfiguration
public AdalConfiguration(WindowsAzureSubscription subscription)
: this()
{
AdEndpoint = subscription.ActiveDirectoryEndpoint != null ? subscription.ActiveDirectoryEndpoint.TrimEnd('/') + '/' : null;
AdDomain = subscription.ActiveDirectoryTenantId;
ResourceClientUri = subscription.ActiveDirectoryServiceEndpointResourceId;
}
示例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;
}
示例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);
}
示例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;
}
示例5: IsStorageServiceAvailable
public bool IsStorageServiceAvailable(WindowsAzureSubscription subscription, string name)
{
EnsureCloudServiceClientInitialized(subscription);
bool available = this.CloudServiceClient.CheckStorageServiceAvailability(name);
WriteObject(!available);
return available;
}
示例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;
}
示例7: GetSubscriptionCertificateCredentials
public static IHDInsightSubscriptionCredentials GetSubscriptionCertificateCredentials(this IAzureHDInsightCommonCommandBase command, WindowsAzureSubscription currentSubscription)
{
return new HDInsightCertificateCredential
{
SubscriptionId = ResolveSubscriptionId(currentSubscription.SubscriptionId),
Certificate = currentSubscription.Certificate,
Endpoint = currentSubscription.ServiceEndpoint,
};
}
示例8: AutomationClient
public AutomationClient(
WindowsAzureSubscription subscription,
IAutomationManagementClient automationManagementClient)
{
Requires.Argument("automationManagementClient", automationManagementClient).NotNull();
this.Subscription = subscription;
this.automationManagementClient = automationManagementClient;
}
示例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>())
{
}
示例10: EnsureCloudServiceClientInitialized
private void EnsureCloudServiceClientInitialized(WindowsAzureSubscription subscription)
{
this.CloudServiceClient = this.CloudServiceClient ?? new CloudServiceClient(
subscription,
SessionState.Path.CurrentLocation.Path,
WriteDebug,
WriteVerbose,
WriteWarning);
}
示例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
};
}
示例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));
}
示例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;
}
示例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();
}
示例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);
}
}