Search in sources :

Example 1 with Job

use of com.microsoft.azure.hdinsight.sdk.rest.spark.job.Job in project azure-tools-for-java by Microsoft.

the class Executor method main.

public static void main(String[] args) throws Exception {
    CredentialsProvider provider = new BasicCredentialsProvider();
    provider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("admin", "Pa$$w0rd1234"));
    HttpClient client = HttpClients.custom().setDefaultCredentialsProvider(provider).build();
    String id = "application_1491222722583_0007";
    HttpResponse response = client.execute(new HttpGet("https://spark2withblob.azurehdinsight.net/sparkhistory/api/v1/applications/application_1491222722583_0008/1/jobs"));
    String res = EntityUtils.toString(response.getEntity());
    //List<Executor> response1 = ObjectConvertUtils.convertJsonToList(res, Executor.class).get();
    List<Job> stages = ObjectConvertUtils.convertJsonToList(res, Job.class).get();
    //Optional<Executor[]> v = ObjectConvertUtils.convertJsonToObject(res, Executor[].class);
    int a = 1;
}
Also used : BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) HttpClient(org.apache.http.client.HttpClient) HttpGet(org.apache.http.client.methods.HttpGet) HttpResponse(org.apache.http.HttpResponse) BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) CredentialsProvider(org.apache.http.client.CredentialsProvider) Job(com.microsoft.azure.hdinsight.sdk.rest.spark.job.Job) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials)

Aggregations

Job (com.microsoft.azure.hdinsight.sdk.rest.spark.job.Job)1 HttpResponse (org.apache.http.HttpResponse)1 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)1 CredentialsProvider (org.apache.http.client.CredentialsProvider)1 HttpClient (org.apache.http.client.HttpClient)1 HttpGet (org.apache.http.client.methods.HttpGet)1 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)1