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<CreateResourceRequest> marshall(CreateResourceRequest createResourceRequest) {

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

    Request<CreateResourceRequest> request =
        new DefaultRequest<CreateResourceRequest>(createResourceRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/restapis/{restapi_id}/resources/{parent_id}";

    uriResourcePath =
        uriResourcePath.replace(
            "{restapi_id}",
            (createResourceRequest.getRestApiId() == null)
                ? ""
                : StringUtils.fromString(createResourceRequest.getRestApiId()));
    uriResourcePath =
        uriResourcePath.replace(
            "{parent_id}",
            (createResourceRequest.getParentId() == null)
                ? ""
                : StringUtils.fromString(createResourceRequest.getParentId()));
    request.setResourcePath(uriResourcePath);

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

      jsonWriter.object();

      if (createResourceRequest.getPathPart() != null) {
        jsonWriter.key("pathPart").value(createResourceRequest.getPathPart());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE);
      }
    } catch (Throwable t) {
      throw new AmazonClientException("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;
  }
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(ApiKey apiKey, JSONWriter jsonWriter) {
    if (apiKey == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (apiKey.getId() != null) {
        jsonWriter.key("id").value(apiKey.getId());
      }

      if (apiKey.getName() != null) {
        jsonWriter.key("name").value(apiKey.getName());
      }

      if (apiKey.getDescription() != null) {
        jsonWriter.key("description").value(apiKey.getDescription());
      }

      if (apiKey.getEnabled() != null) {
        jsonWriter.key("enabled").value(apiKey.getEnabled());
      }

      java.util.List<String> stageKeysList = apiKey.getStageKeys();
      if (stageKeysList != null) {
        jsonWriter.key("stageKeys");
        jsonWriter.array();
        for (String stageKeysListValue : stageKeysList) {
          if (stageKeysListValue != null) {
            jsonWriter.value(stageKeysListValue);
          }
        }
        jsonWriter.endArray();
      }

      if (apiKey.getCreatedDate() != null) {
        jsonWriter.key("createdDate").value(apiKey.getCreatedDate());
      }

      if (apiKey.getLastUpdatedDate() != null) {
        jsonWriter.key("lastUpdatedDate").value(apiKey.getLastUpdatedDate());
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(MethodSetting methodSetting, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (methodSetting.getMetricsEnabled() != null) {
        jsonGenerator
            .writeFieldName("metricsEnabled")
            .writeValue(methodSetting.getMetricsEnabled());
      }
      if (methodSetting.getLoggingLevel() != null) {
        jsonGenerator.writeFieldName("loggingLevel").writeValue(methodSetting.getLoggingLevel());
      }
      if (methodSetting.getDataTraceEnabled() != null) {
        jsonGenerator
            .writeFieldName("dataTraceEnabled")
            .writeValue(methodSetting.getDataTraceEnabled());
      }
      if (methodSetting.getThrottlingBurstLimit() != null) {
        jsonGenerator
            .writeFieldName("throttlingBurstLimit")
            .writeValue(methodSetting.getThrottlingBurstLimit());
      }
      if (methodSetting.getThrottlingRateLimit() != null) {
        jsonGenerator
            .writeFieldName("throttlingRateLimit")
            .writeValue(methodSetting.getThrottlingRateLimit());
      }
      if (methodSetting.getCachingEnabled() != null) {
        jsonGenerator
            .writeFieldName("cachingEnabled")
            .writeValue(methodSetting.getCachingEnabled());
      }
      if (methodSetting.getCacheTtlInSeconds() != null) {
        jsonGenerator
            .writeFieldName("cacheTtlInSeconds")
            .writeValue(methodSetting.getCacheTtlInSeconds());
      }
      if (methodSetting.getCacheDataEncrypted() != null) {
        jsonGenerator
            .writeFieldName("cacheDataEncrypted")
            .writeValue(methodSetting.getCacheDataEncrypted());
      }
      if (methodSetting.getRequireAuthorizationForCacheControl() != null) {
        jsonGenerator
            .writeFieldName("requireAuthorizationForCacheControl")
            .writeValue(methodSetting.getRequireAuthorizationForCacheControl());
      }
      if (methodSetting.getUnauthorizedCacheControlHeaderStrategy() != null) {
        jsonGenerator
            .writeFieldName("unauthorizedCacheControlHeaderStrategy")
            .writeValue(methodSetting.getUnauthorizedCacheControlHeaderStrategy());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  public Request<UpdateBasePathMappingRequest> marshall(
      UpdateBasePathMappingRequest updateBasePathMappingRequest) {

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

    Request<UpdateBasePathMappingRequest> request =
        new DefaultRequest<UpdateBasePathMappingRequest>(
            updateBasePathMappingRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.PATCH);

    String uriResourcePath = "/domainnames/{domain_name}/basepathmappings/{base_path}";

    uriResourcePath =
        uriResourcePath.replace(
            "{domain_name}",
            (updateBasePathMappingRequest.getDomainName() == null)
                ? ""
                : StringUtils.fromString(updateBasePathMappingRequest.getDomainName()));
    uriResourcePath =
        uriResourcePath.replace(
            "{base_path}",
            (updateBasePathMappingRequest.getBasePath() == null)
                ? ""
                : StringUtils.fromString(updateBasePathMappingRequest.getBasePath()));
    request.setResourcePath(uriResourcePath);

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

      jsonWriter.object();

      java.util.List<PatchOperation> patchOperationsList =
          updateBasePathMappingRequest.getPatchOperations();
      if (patchOperationsList != null) {
        jsonWriter.key("patchOperations");
        jsonWriter.array();
        for (PatchOperation patchOperationsListValue : patchOperationsList) {
          if (patchOperationsListValue != null) {

            PatchOperationJsonMarshaller.getInstance()
                .marshall(patchOperationsListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE);
      }
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<CreateDeploymentRequest> marshall(
      CreateDeploymentRequest createDeploymentRequest) {

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

    Request<CreateDeploymentRequest> request =
        new DefaultRequest<CreateDeploymentRequest>(createDeploymentRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/restapis/{restapi_id}/deployments";

    uriResourcePath =
        uriResourcePath.replace(
            "{restapi_id}",
            (createDeploymentRequest.getRestApiId() == null)
                ? ""
                : StringUtils.fromString(createDeploymentRequest.getRestApiId()));
    request.setResourcePath(uriResourcePath);

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

      jsonWriter.object();

      if (createDeploymentRequest.getStageName() != null) {
        jsonWriter.key("stageName").value(createDeploymentRequest.getStageName());
      }

      if (createDeploymentRequest.getStageDescription() != null) {
        jsonWriter.key("stageDescription").value(createDeploymentRequest.getStageDescription());
      }

      if (createDeploymentRequest.getDescription() != null) {
        jsonWriter.key("description").value(createDeploymentRequest.getDescription());
      }

      if (createDeploymentRequest.getCacheClusterEnabled() != null) {
        jsonWriter
            .key("cacheClusterEnabled")
            .value(createDeploymentRequest.getCacheClusterEnabled());
      }

      if (createDeploymentRequest.getCacheClusterSize() != null) {
        jsonWriter.key("cacheClusterSize").value(createDeploymentRequest.getCacheClusterSize());
      }

      java.util.Map<String, String> variablesMap = createDeploymentRequest.getVariables();
      if (variablesMap != null) {
        jsonWriter.key("variables");
        jsonWriter.object();

        for (Map.Entry<String, String> variablesMapValue : variablesMap.entrySet()) {
          if (variablesMapValue.getValue() != null) {
            jsonWriter.key(variablesMapValue.getKey());

            jsonWriter.value(variablesMapValue.getValue());
          }
        }
        jsonWriter.endObject();
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE);
      }
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }