List of usage examples for com.amazonaws.http HttpMethodName GET
HttpMethodName GET
To view the source code for com.amazonaws.http HttpMethodName GET.
Click Source Link
From source file:com.emc.vipr.services.s3.ViPRS3Client.java
License:Open Source License
public BucketFileAccessModeResult getBucketFileAccessMode(String bucketName) throws AmazonClientException { assertParameterNotNull(bucketName, "The bucket name parameter must be specified when querying access mode"); Request<GenericBucketRequest> request = createRequest(bucketName, null, new GenericBucketRequest(bucketName), HttpMethodName.GET); request.addParameter(ViPRConstants.ACCESS_MODE_PARAMETER, null); return invoke(request, new AbstractS3ResponseHandler<BucketFileAccessModeResult>() { public AmazonWebServiceResponse<BucketFileAccessModeResult> handle(HttpResponse response) throws Exception { BucketFileAccessModeResult result = new BucketFileAccessModeResult(); Map<String, String> headers = response.getHeaders(); if (headers.containsKey(ViPRConstants.FILE_ACCESS_MODE_HEADER)) result.setAccessMode(ViPRConstants.FileAccessMode .valueOf(headers.get(ViPRConstants.FILE_ACCESS_MODE_HEADER))); if (headers.containsKey(ViPRConstants.FILE_ACCESS_DURATION_HEADER)) result.setDuration(Long.parseLong(headers.get(ViPRConstants.FILE_ACCESS_DURATION_HEADER))); if (headers.containsKey(ViPRConstants.FILE_ACCESS_HOST_LIST_HEADER)) result.setHostList(// ww w . ja v a 2s . c o m Arrays.asList(headers.get(ViPRConstants.FILE_ACCESS_HOST_LIST_HEADER).split(","))); if (headers.containsKey(ViPRConstants.FILE_ACCESS_UID_HEADER)) result.setUid(headers.get(ViPRConstants.FILE_ACCESS_UID_HEADER)); if (headers.containsKey(ViPRConstants.FILE_ACCESS_START_TOKEN_HEADER)) result.setStartToken(headers.get(ViPRConstants.FILE_ACCESS_START_TOKEN_HEADER)); if (headers.containsKey(ViPRConstants.FILE_ACCESS_END_TOKEN_HEADER)) result.setEndToken(headers.get(ViPRConstants.FILE_ACCESS_END_TOKEN_HEADER)); if (headers.containsKey(ViPRConstants.FILE_ACCESS_PRESERVE_INGEST_PATHS)) result.setPreserveIngestPaths( Boolean.parseBoolean(headers.get(ViPRConstants.FILE_ACCESS_PRESERVE_INGEST_PATHS))); AmazonWebServiceResponse<BucketFileAccessModeResult> awsResponse = parseResponseMetadata(response); awsResponse.setResult(result); return awsResponse; } }, bucketName, null); }
From source file:com.emc.vipr.services.s3.ViPRS3Client.java
License:Open Source License
public GetFileAccessResult getFileAccess(GetFileAccessRequest getFileAccessRequest) throws AmazonClientException { assertParameterNotNull(getFileAccessRequest, "The GetFileAccessRequest parameter must be specified"); String bucketName = getFileAccessRequest.getBucketName(); assertParameterNotNull(bucketName, "The bucket name parameter must be specified when querying file access"); Request<GetFileAccessRequest> request = createRequest(bucketName, null, getFileAccessRequest, HttpMethodName.GET); request.addParameter(ViPRConstants.FILE_ACCESS_PARAMETER, null); if (getFileAccessRequest.getMarker() != null) { request.addParameter(ViPRConstants.MARKER_PARAMETER, getFileAccessRequest.getMarker()); }/*from w ww. ja va 2s . c o m*/ if (getFileAccessRequest.getMaxKeys() > 0) { // TODO: is this an appropriate indicator? request.addParameter(ViPRConstants.MAX_KEYS_PARAMETER, Long.toString(getFileAccessRequest.getMaxKeys())); } return invoke(request, new AbstractS3ResponseHandler<GetFileAccessResult>() { public AmazonWebServiceResponse<GetFileAccessResult> handle(HttpResponse response) throws Exception { log.trace("Beginning to parse fileaccess response XML"); GetFileAccessResult result = new GetFileAccessResultUnmarshaller() .unmarshall(response.getContent()); log.trace("Done parsing fileaccess response XML"); AmazonWebServiceResponse<GetFileAccessResult> awsResponse = parseResponseMetadata(response); awsResponse.setResult(result); return awsResponse; } }, bucketName, null); }
From source file:com.emc.vipr.services.s3.ViPRS3Client.java
License:Open Source License
public ListDataNodesResult listDataNodes(ListDataNodesRequest listDataNodesRequest) throws AmazonClientException { Request<ListDataNodesRequest> request = createRequest(null, null, listDataNodesRequest, HttpMethodName.GET); request.addParameter(ViPRConstants.ENDPOINT_PARAMETER, null); return invoke(request, new AbstractS3ResponseHandler<ListDataNodesResult>() { public AmazonWebServiceResponse<ListDataNodesResult> handle(HttpResponse response) throws Exception { log.trace("Beginning to parse endpoint response XML"); ListDataNodesResult result = new ListDataNodesResultUnmarshaller() .unmarshall(response.getContent()); log.trace("Done parsing endpoint response XML"); AmazonWebServiceResponse<ListDataNodesResult> awsResponse = parseResponseMetadata(response); awsResponse.setResult(result); return awsResponse; }//from www . j ava2 s .c o m }, null, null); }
From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechGetRequestMarshaller.java
License:Open Source License
public Request<CreateSpeechRequest> marshall(CreateSpeechRequest createSpeechRequest) { if (createSpeechRequest == null) { throw new AmazonClientException("null createSpeechRequest passed to marshall(...)"); }//from w w w . j a va 2 s . c om Request<CreateSpeechRequest> request = new DefaultRequest<CreateSpeechRequest>(createSpeechRequest, IvonaSpeechCloudClient.SERVICE_NAME); setRequestParameters(request, createSpeechRequest); request.setHttpMethod(HttpMethodName.GET); request.setResourcePath(RESOURCE_PATH); return request; }
From source file:com.ivona.services.tts.model.transform.listvoices.ListVoicesGetRequestMarshaller.java
License:Open Source License
public Request<ListVoicesRequest> marshall(ListVoicesRequest listVoicesRequest) { if (listVoicesRequest == null) { throw new AmazonClientException("null listVoicesRequest passed to marshall(...)"); }//from w w w . j ava 2 s.c o m Request<ListVoicesRequest> request = new DefaultRequest<ListVoicesRequest>(listVoicesRequest, IvonaSpeechCloudClient.SERVICE_NAME); request.setHttpMethod(HttpMethodName.GET); request.setResourcePath(RESOURCE_PATH); setRequestParameters(request, listVoicesRequest); return request; }
From source file:com.msi.tough.internal.autoscale.helper.AccountHelper.java
License:Apache License
/** * Construct a minimal valid account request. * * @param userName// w w w . j a va 2 s . c om * @return */ public static HttpRequest createAccountRequest(String userName, String accessKey, String secretKey) { final HttpRequest request = new HttpRequest(HttpMethodName.GET).withParameter("Action", "CreateAccount") .withParameter("UserName", userName).withParameter("AccessKey", accessKey) .withParameter("SecretKey", secretKey).withParameter("CloudName", defaultAvailabilityZone) .withParameter("APIUsername", accessKey).withParameter("APIPassword", secretKey) .withParameter("APITenant", tenant); return request; }
From source file:com.msi.tough.internal.autoscale.helper.AccountHelper.java
License:Apache License
/** * Construct a delete account request./*from w w w . j a v a 2 s . c o m*/ * * @param userName * @return */ public static HttpRequest deleteAccountRequest(AccountBean account) { final HttpRequest request = new HttpRequest(HttpMethodName.GET).withParameter("Id", "" + account.getId()) .withParameter("Action", "DeleteAccount").withParameter("UserName", account.getName()) .withParameter("AccessKey", account.getAccessKey()) .withParameter("SecretKey", account.getSecretKey()).withParameter("CloudName", account.getDefZone()) .withParameter("APIUsername", account.getApiUsername()) .withParameter("APIPassword", account.getApiPassword()).withParameter("APITenant", tenant) .withParameter("Id", String.valueOf(account.getId())); return request; }
From source file:org.apache.nifi.processors.aws.wag.AbstractAWSGatewayApiProcessor.java
License:Apache License
protected GenericApiGatewayRequest configureRequest(final ProcessContext context, final ProcessSession session, final String resourcePath, final FlowFile requestFlowFile, final HttpMethodName methodName) { GenericApiGatewayRequestBuilder builder = new GenericApiGatewayRequestBuilder() .withResourcePath(resourcePath); final Map<String, List<String>> parameters = getParameters(context); builder = builder.withParameters(parameters); InputStream requestBody = null; switch (methodName) { case GET:/*w w w . j av a 2 s. co m*/ builder = builder.withHttpMethod(HttpMethodName.GET); break; case POST: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.POST).withBody(requestBody); break; case PUT: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.PUT).withBody(requestBody); break; case PATCH: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.PATCH).withBody(requestBody); break; case HEAD: builder = builder.withHttpMethod(HttpMethodName.HEAD); break; case DELETE: builder = builder.withHttpMethod(HttpMethodName.DELETE); break; case OPTIONS: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.OPTIONS).withBody(requestBody); break; } builder = setHeaderProperties(context, builder, methodName, requestFlowFile); return builder.build(); }