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<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;
  }
  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;
  }
  /** 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);
    }
  }