private IHDInsightAccessTokenCredential Create(IHDInsightAccessTokenCredential credentials) { return(new HDInsightAccessTokenCredential() { AccessToken = this.creds.AccessToken, Endpoint = new Uri(this.creds.Endpoint), DeploymentNamespace = this.creds.CloudServiceName, SubscriptionId = this.creds.SubscriptionId }); }
private IHDInsightAccessTokenCredential Create(IHDInsightAccessTokenCredential credentials) { return new HDInsightAccessTokenCredential() { AccessToken = this.creds.AccessToken, Endpoint = new Uri(this.creds.Endpoint), DeploymentNamespace = this.creds.CloudServiceName, SubscriptionId = this.creds.SubscriptionId }; }
private IHDInsightAccessTokenCredential Create(IHDInsightAccessTokenCredential credentials) { credentials.ArgumentNotNull("credentials"); return(new HDInsightAccessTokenCredential() { AccessToken = credentials.AccessToken, DeploymentNamespace = credentials.DeploymentNamespace, Endpoint = credentials.Endpoint, SubscriptionId = credentials.SubscriptionId }); }
private IHDInsightAccessTokenCredential Create(IHDInsightAccessTokenCredential credentials) { credentials.ArgumentNotNull("credentials"); return new HDInsightAccessTokenCredential() { AccessToken = credentials.AccessToken, DeploymentNamespace = credentials.DeploymentNamespace, Endpoint = credentials.Endpoint, SubscriptionId = credentials.SubscriptionId }; }
public IHDInsightSubscriptionCredentials Create(IHDInsightSubscriptionCredentials credentials) { IHDInsightCertificateCredential certCreds = credentials as IHDInsightCertificateCredential; IHDInsightAccessTokenCredential tokenCreds = credentials as IHDInsightAccessTokenCredential; if (certCreds != null) { return(Create(certCreds)); } else if (tokenCreds != null) { return(Create(tokenCreds)); } else { throw new NotSupportedException("Credential Type is not supported"); } }
/// <inheritdoc /> public IHttpClientAbstraction Create(IHDInsightSubscriptionCredentials credentials, bool ignoreSslErrors) { IHDInsightCertificateCredential certCreds = credentials as IHDInsightCertificateCredential; IHDInsightAccessTokenCredential tokenCreds = credentials as IHDInsightAccessTokenCredential; if (certCreds != null) { return (ServiceLocator.Instance.Locate <IHttpClientAbstractionFactory>() .Create(certCreds.Certificate, ignoreSslErrors)); } if (tokenCreds != null) { return (ServiceLocator.Instance.Locate <IHttpClientAbstractionFactory>() .Create(tokenCreds.AccessToken, ignoreSslErrors)); } throw new NotSupportedException("Credential Type is not supported"); }
[Timeout(5 * 60 * 1000)] // ms public async Task ICanPerformA_CreateDeleteContainers_Using_RestClient_ManualEnvironment() { var creds = IntegrationTestBase.GetCredentialsForEnvironmentType(EnvironmentType.Current); if (creds == null) { Assert.Inconclusive("Alternative Azure Endpoint wasn't set up"); } IHDInsightCertificateCredential certCreds = IntegrationTestBase.GetValidCredentials() as IHDInsightCertificateCredential; IHDInsightAccessTokenCredential tokenCreds = IntegrationTestBase.GetValidCredentials() as IHDInsightAccessTokenCredential; IHDInsightSubscriptionCredentials tempCredentials = null; if (certCreds != null) { tempCredentials = new HDInsightCertificateCredential() { SubscriptionId = creds.SubscriptionId, Certificate = certCreds.Certificate }; } else if (tokenCreds != null) { tempCredentials = new HDInsightAccessTokenCredential() { SubscriptionId = creds.SubscriptionId, AccessToken = tokenCreds.AccessToken }; } IHDInsightSubscriptionCredentials credentials = new AlternativeEnvironmentIHDInsightSubscriptionCertificateCredentialsFactory().Create(tempCredentials); var client = new HDInsightManagementRestClient(credentials, GetAbstractionContext(), false); var dnsName = GetRandomClusterName(); var location = "East US"; var subscriptionId = credentials.SubscriptionId; var createPayload = String.Format(CreateContainerGenericRequest, dnsName, location, subscriptionId, Guid.NewGuid()); var xmlReader = new XmlTextReader(new StringReader(createPayload)); var resource = new Resource() { IntrinsicSettings = new[] { new XmlDocument().ReadNode(xmlReader) } }; var result = await client.ListCloudServices(); Assert.IsTrue(!this.ContainsContainer(dnsName, result.Content)); await client.CreateContainer(dnsName, location, resource.SerializeToXml()); result = await client.ListCloudServices(); bool containsContiner = false; while (!containsContiner) { result = await client.ListCloudServices(); containsContiner = this.ContainsContainer(dnsName, result.Content); await Task.Delay(100); } await client.DeleteContainer(dnsName, location); containsContiner = true; while (containsContiner) { result = await client.ListCloudServices(); containsContiner = this.ContainsContainer(dnsName, result.Content); await Task.Delay(100); } }
public RdfeServiceRestSimulatorClient(IHDInsightAccessTokenCredential credentials, IAbstractionContext context) { this.context = context; this.credentials = IntegrationTestBase.GetValidCredentials() as IHDInsightCertificateCredential; this.PollInterval = TimeSpan.FromMilliseconds(10); }
public RdfeServiceRestSimulatorClient(IHDInsightAccessTokenCredential credentials, IAbstractionContext context) { this.context = context; this.credentials = IntegrationTestBase.GetValidCredentials() as IHDInsightCertificateCredential; this.PollInterval = TimeSpan.FromMilliseconds(10); }