public Request<UpdateMethodRequest> marshall(UpdateMethodRequest updateMethodRequest) { if (updateMethodRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<UpdateMethodRequest> request = new DefaultRequest<UpdateMethodRequest>(updateMethodRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.PATCH); String uriResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "restapi_id", updateMethodRequest.getRestApiId()); uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "resource_id", updateMethodRequest.getResourceId()); uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "http_method", updateMethodRequest.getHttpMethod()); request.setResourcePath(uriResourcePath); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); java.util.List<PatchOperation> patchOperationsList = updateMethodRequest.getPatchOperations(); if (patchOperationsList != null) { jsonGenerator.writeFieldName("patchOperations"); jsonGenerator.writeStartArray(); for (PatchOperation patchOperationsListValue : patchOperationsList) { if (patchOperationsListValue != null) { PatchOperationJsonMarshaller.getInstance() .marshall(patchOperationsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<CreateBasePathMappingRequest> marshall( CreateBasePathMappingRequest createBasePathMappingRequest) { if (createBasePathMappingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateBasePathMappingRequest> request = new DefaultRequest<CreateBasePathMappingRequest>( createBasePathMappingRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/domainnames/{domain_name}/basepathmappings"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "domain_name", createBasePathMappingRequest.getDomainName()); request.setResourcePath(uriResourcePath); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (createBasePathMappingRequest.getBasePath() != null) { jsonGenerator .writeFieldName("basePath") .writeValue(createBasePathMappingRequest.getBasePath()); } if (createBasePathMappingRequest.getRestApiId() != null) { jsonGenerator .writeFieldName("restApiId") .writeValue(createBasePathMappingRequest.getRestApiId()); } if (createBasePathMappingRequest.getStage() != null) { jsonGenerator.writeFieldName("stage").writeValue(createBasePathMappingRequest.getStage()); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<GetStagesRequest> marshall(GetStagesRequest getStagesRequest) { if (getStagesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<GetStagesRequest> request = new DefaultRequest<GetStagesRequest>(getStagesRequest, "AmazonApiGateway"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "/restapis/{restapi_id}/stages"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall( uriResourcePath, "restapi_id", getStagesRequest.getRestApiId()); request.setResourcePath(uriResourcePath); if (getStagesRequest.getDeploymentId() != null) { request.addParameter( "deploymentId", StringUtils.fromString(getStagesRequest.getDeploymentId())); } request.setContent(new ByteArrayInputStream(new byte[0])); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", protocolFactory.getContentType()); } return request; }