/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( RealtimeEndpointInfo realtimeEndpointInfo, StructuredJsonGenerator jsonGenerator) { if (realtimeEndpointInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (realtimeEndpointInfo.getPeakRequestsPerSecond() != null) { jsonGenerator .writeFieldName("PeakRequestsPerSecond") .writeValue(realtimeEndpointInfo.getPeakRequestsPerSecond()); } if (realtimeEndpointInfo.getCreatedAt() != null) { jsonGenerator.writeFieldName("CreatedAt").writeValue(realtimeEndpointInfo.getCreatedAt()); } if (realtimeEndpointInfo.getEndpointUrl() != null) { jsonGenerator .writeFieldName("EndpointUrl") .writeValue(realtimeEndpointInfo.getEndpointUrl()); } if (realtimeEndpointInfo.getEndpointStatus() != null) { jsonGenerator .writeFieldName("EndpointStatus") .writeValue(realtimeEndpointInfo.getEndpointStatus()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<CreateRealtimeEndpointRequest> marshall( CreateRealtimeEndpointRequest createRealtimeEndpointRequest) { if (createRealtimeEndpointRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateRealtimeEndpointRequest> request = new DefaultRequest<CreateRealtimeEndpointRequest>( createRealtimeEndpointRequest, "AmazonMachineLearning"); request.addHeader("X-Amz-Target", "AmazonML_20141212.CreateRealtimeEndpoint"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (createRealtimeEndpointRequest.getMLModelId() != null) { jsonGenerator .writeFieldName("MLModelId") .writeValue(createRealtimeEndpointRequest.getMLModelId()); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", protocolFactory.getContentType()); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<DescribeMLModelsRequest> marshall( DescribeMLModelsRequest describeMLModelsRequest) { if (describeMLModelsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<DescribeMLModelsRequest> request = new DefaultRequest<DescribeMLModelsRequest>( describeMLModelsRequest, "AmazonMachineLearning"); request.addHeader("X-Amz-Target", "AmazonML_20141212.DescribeMLModels"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = SdkJsonProtocolFactory.createWriter(false, "1.1"); jsonGenerator.writeStartObject(); if (describeMLModelsRequest.getFilterVariable() != null) { jsonGenerator .writeFieldName("FilterVariable") .writeValue(describeMLModelsRequest.getFilterVariable()); } if (describeMLModelsRequest.getEQ() != null) { jsonGenerator.writeFieldName("EQ").writeValue(describeMLModelsRequest.getEQ()); } if (describeMLModelsRequest.getGT() != null) { jsonGenerator.writeFieldName("GT").writeValue(describeMLModelsRequest.getGT()); } if (describeMLModelsRequest.getLT() != null) { jsonGenerator.writeFieldName("LT").writeValue(describeMLModelsRequest.getLT()); } if (describeMLModelsRequest.getGE() != null) { jsonGenerator.writeFieldName("GE").writeValue(describeMLModelsRequest.getGE()); } if (describeMLModelsRequest.getLE() != null) { jsonGenerator.writeFieldName("LE").writeValue(describeMLModelsRequest.getLE()); } if (describeMLModelsRequest.getNE() != null) { jsonGenerator.writeFieldName("NE").writeValue(describeMLModelsRequest.getNE()); } if (describeMLModelsRequest.getPrefix() != null) { jsonGenerator.writeFieldName("Prefix").writeValue(describeMLModelsRequest.getPrefix()); } if (describeMLModelsRequest.getSortOrder() != null) { jsonGenerator .writeFieldName("SortOrder") .writeValue(describeMLModelsRequest.getSortOrder()); } if (describeMLModelsRequest.getNextToken() != null) { jsonGenerator .writeFieldName("NextToken") .writeValue(describeMLModelsRequest.getNextToken()); } if (describeMLModelsRequest.getLimit() != null) { jsonGenerator.writeFieldName("Limit").writeValue(describeMLModelsRequest.getLimit()); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", jsonGenerator.getContentType()); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }