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); }
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; }