/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( RejectedLogEventsInfo rejectedLogEventsInfo, StructuredJsonGenerator jsonGenerator) { if (rejectedLogEventsInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (rejectedLogEventsInfo.getTooNewLogEventStartIndex() != null) { jsonGenerator .writeFieldName("tooNewLogEventStartIndex") .writeValue(rejectedLogEventsInfo.getTooNewLogEventStartIndex()); } if (rejectedLogEventsInfo.getTooOldLogEventEndIndex() != null) { jsonGenerator .writeFieldName("tooOldLogEventEndIndex") .writeValue(rejectedLogEventsInfo.getTooOldLogEventEndIndex()); } if (rejectedLogEventsInfo.getExpiredLogEventEndIndex() != null) { jsonGenerator .writeFieldName("expiredLogEventEndIndex") .writeValue(rejectedLogEventsInfo.getExpiredLogEventEndIndex()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(ExportTask exportTask, StructuredJsonGenerator jsonGenerator) { if (exportTask == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (exportTask.getTaskId() != null) { jsonGenerator.writeFieldName("taskId").writeValue(exportTask.getTaskId()); } if (exportTask.getTaskName() != null) { jsonGenerator.writeFieldName("taskName").writeValue(exportTask.getTaskName()); } if (exportTask.getLogGroupName() != null) { jsonGenerator.writeFieldName("logGroupName").writeValue(exportTask.getLogGroupName()); } if (exportTask.getFrom() != null) { jsonGenerator.writeFieldName("from").writeValue(exportTask.getFrom()); } if (exportTask.getTo() != null) { jsonGenerator.writeFieldName("to").writeValue(exportTask.getTo()); } if (exportTask.getDestination() != null) { jsonGenerator.writeFieldName("destination").writeValue(exportTask.getDestination()); } if (exportTask.getDestinationPrefix() != null) { jsonGenerator .writeFieldName("destinationPrefix") .writeValue(exportTask.getDestinationPrefix()); } if (exportTask.getStatus() != null) { jsonGenerator.writeFieldName("status"); ExportTaskStatusJsonMarshaller.getInstance() .marshall(exportTask.getStatus(), jsonGenerator); } if (exportTask.getExecutionInfo() != null) { jsonGenerator.writeFieldName("executionInfo"); ExportTaskExecutionInfoJsonMarshaller.getInstance() .marshall(exportTask.getExecutionInfo(), jsonGenerator); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(MetricFilter metricFilter, StructuredJsonGenerator jsonGenerator) { if (metricFilter == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (metricFilter.getFilterName() != null) { jsonGenerator.writeFieldName("filterName").writeValue(metricFilter.getFilterName()); } if (metricFilter.getFilterPattern() != null) { jsonGenerator.writeFieldName("filterPattern").writeValue(metricFilter.getFilterPattern()); } com.amazonaws.internal.SdkInternalList<MetricTransformation> metricTransformationsList = (com.amazonaws.internal.SdkInternalList<MetricTransformation>) metricFilter.getMetricTransformations(); if (!metricTransformationsList.isEmpty() || !metricTransformationsList.isAutoConstruct()) { jsonGenerator.writeFieldName("metricTransformations"); jsonGenerator.writeStartArray(); for (MetricTransformation metricTransformationsListValue : metricTransformationsList) { if (metricTransformationsListValue != null) { MetricTransformationJsonMarshaller.getInstance() .marshall(metricTransformationsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } if (metricFilter.getCreationTime() != null) { jsonGenerator.writeFieldName("creationTime").writeValue(metricFilter.getCreationTime()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<PutMetricFilterRequest> marshall(PutMetricFilterRequest putMetricFilterRequest) { if (putMetricFilterRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<PutMetricFilterRequest> request = new DefaultRequest<PutMetricFilterRequest>(putMetricFilterRequest, "AWSLogs"); request.addHeader("X-Amz-Target", "Logs_20140328.PutMetricFilter"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (putMetricFilterRequest.getLogGroupName() != null) { jsonGenerator .writeFieldName("logGroupName") .writeValue(putMetricFilterRequest.getLogGroupName()); } if (putMetricFilterRequest.getFilterName() != null) { jsonGenerator .writeFieldName("filterName") .writeValue(putMetricFilterRequest.getFilterName()); } if (putMetricFilterRequest.getFilterPattern() != null) { jsonGenerator .writeFieldName("filterPattern") .writeValue(putMetricFilterRequest.getFilterPattern()); } com.amazonaws.internal.SdkInternalList<MetricTransformation> metricTransformationsList = (com.amazonaws.internal.SdkInternalList<MetricTransformation>) putMetricFilterRequest.getMetricTransformations(); if (!metricTransformationsList.isEmpty() || !metricTransformationsList.isAutoConstruct()) { jsonGenerator.writeFieldName("metricTransformations"); jsonGenerator.writeStartArray(); for (MetricTransformation metricTransformationsListValue : metricTransformationsList) { if (metricTransformationsListValue != null) { MetricTransformationJsonMarshaller.getInstance() .marshall(metricTransformationsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } 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 SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }