public Request<PutSubscriptionFilterRequest> marshall( PutSubscriptionFilterRequest putSubscriptionFilterRequest) { if (putSubscriptionFilterRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<PutSubscriptionFilterRequest> request = new DefaultRequest<PutSubscriptionFilterRequest>(putSubscriptionFilterRequest, "AWSLogs"); String target = "Logs_20140328.PutSubscriptionFilter"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (putSubscriptionFilterRequest.getLogGroupName() != null) { jsonWriter.key("logGroupName").value(putSubscriptionFilterRequest.getLogGroupName()); } if (putSubscriptionFilterRequest.getFilterName() != null) { jsonWriter.key("filterName").value(putSubscriptionFilterRequest.getFilterName()); } if (putSubscriptionFilterRequest.getFilterPattern() != null) { jsonWriter.key("filterPattern").value(putSubscriptionFilterRequest.getFilterPattern()); } if (putSubscriptionFilterRequest.getDestinationArn() != null) { jsonWriter.key("destinationArn").value(putSubscriptionFilterRequest.getDestinationArn()); } if (putSubscriptionFilterRequest.getRoleArn() != null) { jsonWriter.key("roleArn").value(putSubscriptionFilterRequest.getRoleArn()); } 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; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutSubscriptionFilterRequest == false) return false; PutSubscriptionFilterRequest other = (PutSubscriptionFilterRequest) obj; if (other.getLogGroupName() == null ^ this.getLogGroupName() == null) return false; if (other.getLogGroupName() != null && other.getLogGroupName().equals(this.getLogGroupName()) == false) return false; if (other.getFilterName() == null ^ this.getFilterName() == null) return false; if (other.getFilterName() != null && other.getFilterName().equals(this.getFilterName()) == false) return false; if (other.getFilterPattern() == null ^ this.getFilterPattern() == null) return false; if (other.getFilterPattern() != null && other.getFilterPattern().equals(this.getFilterPattern()) == false) return false; if (other.getDestinationArn() == null ^ this.getDestinationArn() == null) return false; if (other.getDestinationArn() != null && other.getDestinationArn().equals(this.getDestinationArn()) == false) return false; if (other.getRoleArn() == null ^ this.getRoleArn() == null) return false; if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == false) return false; return true; }