/** 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<GetEvaluationRequest> marshall(GetEvaluationRequest getEvaluationRequest) {

    if (getEvaluationRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<GetEvaluationRequest> request =
        new DefaultRequest<GetEvaluationRequest>(getEvaluationRequest, "AmazonMachineLearning");
    request.addHeader("X-Amz-Target", "AmazonML_20141212.GetEvaluation");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);

      jsonWriter.object();

      if (getEvaluationRequest.getEvaluationId() != null) {
        jsonWriter.key("EvaluationId").value(getEvaluationRequest.getEvaluationId());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", "application/x-amz-json-1.1");
    } 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;
  }
  public Request<DescribeDataSourcesRequest> marshall(
      DescribeDataSourcesRequest describeDataSourcesRequest) {

    if (describeDataSourcesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeDataSourcesRequest> request =
        new DefaultRequest<DescribeDataSourcesRequest>(
            describeDataSourcesRequest, "AmazonMachineLearning");
    request.addHeader("X-Amz-Target", "AmazonML_20141212.DescribeDataSources");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);

      jsonWriter.object();

      if (describeDataSourcesRequest.getFilterVariable() != null) {
        jsonWriter.key("FilterVariable").value(describeDataSourcesRequest.getFilterVariable());
      }

      if (describeDataSourcesRequest.getEQ() != null) {
        jsonWriter.key("EQ").value(describeDataSourcesRequest.getEQ());
      }

      if (describeDataSourcesRequest.getGT() != null) {
        jsonWriter.key("GT").value(describeDataSourcesRequest.getGT());
      }

      if (describeDataSourcesRequest.getLT() != null) {
        jsonWriter.key("LT").value(describeDataSourcesRequest.getLT());
      }

      if (describeDataSourcesRequest.getGE() != null) {
        jsonWriter.key("GE").value(describeDataSourcesRequest.getGE());
      }

      if (describeDataSourcesRequest.getLE() != null) {
        jsonWriter.key("LE").value(describeDataSourcesRequest.getLE());
      }

      if (describeDataSourcesRequest.getNE() != null) {
        jsonWriter.key("NE").value(describeDataSourcesRequest.getNE());
      }

      if (describeDataSourcesRequest.getPrefix() != null) {
        jsonWriter.key("Prefix").value(describeDataSourcesRequest.getPrefix());
      }

      if (describeDataSourcesRequest.getSortOrder() != null) {
        jsonWriter.key("SortOrder").value(describeDataSourcesRequest.getSortOrder());
      }

      if (describeDataSourcesRequest.getNextToken() != null) {
        jsonWriter.key("NextToken").value(describeDataSourcesRequest.getNextToken());
      }

      if (describeDataSourcesRequest.getLimit() != null) {
        jsonWriter.key("Limit").value(describeDataSourcesRequest.getLimit());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", "application/x-amz-json-1.1");
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(RDSDataSpec rDSDataSpec, JSONWriter jsonWriter) {
    if (rDSDataSpec == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (rDSDataSpec.getDatabaseInformation() != null) {
        jsonWriter.key("DatabaseInformation");
        RDSDatabaseJsonMarshaller.getInstance()
            .marshall(rDSDataSpec.getDatabaseInformation(), jsonWriter);
      }

      if (rDSDataSpec.getSelectSqlQuery() != null) {
        jsonWriter.key("SelectSqlQuery").value(rDSDataSpec.getSelectSqlQuery());
      }

      if (rDSDataSpec.getDatabaseCredentials() != null) {
        jsonWriter.key("DatabaseCredentials");
        RDSDatabaseCredentialsJsonMarshaller.getInstance()
            .marshall(rDSDataSpec.getDatabaseCredentials(), jsonWriter);
      }

      if (rDSDataSpec.getS3StagingLocation() != null) {
        jsonWriter.key("S3StagingLocation").value(rDSDataSpec.getS3StagingLocation());
      }

      if (rDSDataSpec.getDataRearrangement() != null) {
        jsonWriter.key("DataRearrangement").value(rDSDataSpec.getDataRearrangement());
      }

      if (rDSDataSpec.getDataSchema() != null) {
        jsonWriter.key("DataSchema").value(rDSDataSpec.getDataSchema());
      }

      if (rDSDataSpec.getDataSchemaUri() != null) {
        jsonWriter.key("DataSchemaUri").value(rDSDataSpec.getDataSchemaUri());
      }

      if (rDSDataSpec.getResourceRole() != null) {
        jsonWriter.key("ResourceRole").value(rDSDataSpec.getResourceRole());
      }

      if (rDSDataSpec.getServiceRole() != null) {
        jsonWriter.key("ServiceRole").value(rDSDataSpec.getServiceRole());
      }

      if (rDSDataSpec.getSubnetId() != null) {
        jsonWriter.key("SubnetId").value(rDSDataSpec.getSubnetId());
      }

      com.amazonaws.internal.SdkInternalList<String> securityGroupIdsList =
          (com.amazonaws.internal.SdkInternalList<String>) rDSDataSpec.getSecurityGroupIds();
      if (!securityGroupIdsList.isEmpty() || !securityGroupIdsList.isAutoConstruct()) {
        jsonWriter.key("SecurityGroupIds");
        jsonWriter.array();
        for (String securityGroupIdsListValue : securityGroupIdsList) {
          if (securityGroupIdsListValue != null) {
            jsonWriter.value(securityGroupIdsListValue);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }