Search in sources :

Example 1 with PostSessions

use of com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.api.PostSessions in project azure-tools-for-java by Microsoft.

the class Session method createSessionRequest.

private Observable<com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.Session> createSessionRequest() {
    final URI uri = baseUrl.resolve(REST_SEGMENT_SESSION);
    final PostSessions postBody = getCreateParameters().build();
    final String json = postBody.convertToJson().orElseThrow(() -> new IllegalArgumentException("Bad session arguments to post."));
    getCtrlSubject().onNext(new SparkLogLine(TOOL, Debug, "Create Livy Session by sending request to " + uri + " with body " + json));
    final StringEntity entity = new StringEntity(json, StandardCharsets.UTF_8);
    entity.setContentType("application/json");
    return getHttp().setUserAgent(getUserAgent()).post(uri.toString(), entity, null, null, com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.Session.class);
}
Also used : StringEntity(org.apache.http.entity.StringEntity) PostSessions(com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.api.PostSessions) URI(java.net.URI) SparkLogLine(com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine)

Aggregations

PostSessions (com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.api.PostSessions)1 SparkLogLine (com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine)1 URI (java.net.URI)1 StringEntity (org.apache.http.entity.StringEntity)1