サンプルコード
@Grab(group='org.apache.httpcomponents', module='httpclient', version='4.3.5') import org.apache.http.client.methods.* import org.apache.http.impl.client.* import org.apache.http.auth.* import org.apache.http.entity.* import groovy.json.* def host = "localhost" def port = 12000 def httpclient = new DefaultHttpClient() def jobid = "1" def method = new HttpPost( "http://${host}:${port}/sqoop/v1/submission/action/${jobid}" ) response = httpclient.execute(method) println response.getStatusLine().getStatusCode()動作環境
groovy 2.3.6, JDK7 update67, Cloudera CDH 5.1.2
0 件のコメント:
コメントを投稿