Exemplo n.º 1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof DeleteMethodRequest == false) return false;
    DeleteMethodRequest other = (DeleteMethodRequest) obj;
    if (other.getRestApiId() == null ^ this.getRestApiId() == null) return false;
    if (other.getRestApiId() != null && other.getRestApiId().equals(this.getRestApiId()) == false)
      return false;
    if (other.getResourceId() == null ^ this.getResourceId() == null) return false;
    if (other.getResourceId() != null
        && other.getResourceId().equals(this.getResourceId()) == false) return false;
    if (other.getHttpMethod() == null ^ this.getHttpMethod() == null) return false;
    if (other.getHttpMethod() != null
        && other.getHttpMethod().equals(this.getHttpMethod()) == false) return false;
    return true;
  }
  public Request<DeleteMethodRequest> marshall(DeleteMethodRequest deleteMethodRequest) {

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

    Request<DeleteMethodRequest> request =
        new DefaultRequest<DeleteMethodRequest>(deleteMethodRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.DELETE);

    String uriResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}";

    uriResourcePath =
        uriResourcePath.replace(
            "{restapi_id}",
            (deleteMethodRequest.getRestApiId() != null)
                ? SdkHttpUtils.urlEncode(
                    StringUtils.fromString(deleteMethodRequest.getRestApiId()), false)
                : "");
    uriResourcePath =
        uriResourcePath.replace(
            "{resource_id}",
            (deleteMethodRequest.getResourceId() != null)
                ? SdkHttpUtils.urlEncode(
                    StringUtils.fromString(deleteMethodRequest.getResourceId()), false)
                : "");
    uriResourcePath =
        uriResourcePath.replace(
            "{http_method}",
            (deleteMethodRequest.getHttpMethod() != null)
                ? SdkHttpUtils.urlEncode(
                    StringUtils.fromString(deleteMethodRequest.getHttpMethod()), false)
                : "");
    request.setResourcePath(uriResourcePath);

    request.setContent(new ByteArrayInputStream(new byte[0]));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", protocolFactory.getContentType());
    }

    return request;
  }