
com.amazonaws.services.cloudwatchevents.model.Target Maven / Gradle / Ivy
Show all versions of aws-java-sdk-events Show documentation
/*
* Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.cloudwatchevents.model;
import java.io.Serializable;
/**
*
* Targets are the resources that can be invoked when a rule is triggered. For
* example, AWS Lambda functions, Amazon Kinesis streams, and built-in targets.
*
*
* Input and InputPath are mutually-exclusive and optional
* parameters of a target. When a rule is triggered due to a matched event, if
* for a target:
*
*
* - Neither Input nor InputPath is specified, then the entire
* event is passed to the target in JSON form.
* - InputPath is specified in the form of JSONPath (e.g.
* $.detail), then only the part of the event specified in the path is
* passed to the target (e.g. only the detail part of the event is passed).
* - Input is specified in the form of a valid JSON, then the matched
* event is overridden with this constant.
*
*/
public class Target implements Serializable, Cloneable {
/**
*
* The unique target assignment ID.
*
*/
private String id;
/**
*
* The Amazon Resource Name (ARN) associated of the target.
*
*/
private String arn;
/**
*
* Valid JSON text passed to the target. For more information about JSON
* text, see The
* JavaScript Object Notation (JSON) Data Interchange Format.
*
*/
private String input;
/**
*
* The value of the JSONPath that is used for extracting part of the matched
* event when passing it to the target. For more information about JSON
* paths, see JSONPath.
*
*/
private String inputPath;
/**
*
* The unique target assignment ID.
*
*
* @param id
* The unique target assignment ID.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The unique target assignment ID.
*
*
* @return The unique target assignment ID.
*/
public String getId() {
return this.id;
}
/**
*
* The unique target assignment ID.
*
*
* @param id
* The unique target assignment ID.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Target withId(String id) {
setId(id);
return this;
}
/**
*
* The Amazon Resource Name (ARN) associated of the target.
*
*
* @param arn
* The Amazon Resource Name (ARN) associated of the target.
*/
public void setArn(String arn) {
this.arn = arn;
}
/**
*
* The Amazon Resource Name (ARN) associated of the target.
*
*
* @return The Amazon Resource Name (ARN) associated of the target.
*/
public String getArn() {
return this.arn;
}
/**
*
* The Amazon Resource Name (ARN) associated of the target.
*
*
* @param arn
* The Amazon Resource Name (ARN) associated of the target.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Target withArn(String arn) {
setArn(arn);
return this;
}
/**
*
* Valid JSON text passed to the target. For more information about JSON
* text, see The
* JavaScript Object Notation (JSON) Data Interchange Format.
*
*
* @param input
* Valid JSON text passed to the target. For more information about
* JSON text, see The JavaScript
* Object Notation (JSON) Data Interchange Format.
*/
public void setInput(String input) {
this.input = input;
}
/**
*
* Valid JSON text passed to the target. For more information about JSON
* text, see The
* JavaScript Object Notation (JSON) Data Interchange Format.
*
*
* @return Valid JSON text passed to the target. For more information about
* JSON text, see The JavaScript
* Object Notation (JSON) Data Interchange Format.
*/
public String getInput() {
return this.input;
}
/**
*
* Valid JSON text passed to the target. For more information about JSON
* text, see The
* JavaScript Object Notation (JSON) Data Interchange Format.
*
*
* @param input
* Valid JSON text passed to the target. For more information about
* JSON text, see The JavaScript
* Object Notation (JSON) Data Interchange Format.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Target withInput(String input) {
setInput(input);
return this;
}
/**
*
* The value of the JSONPath that is used for extracting part of the matched
* event when passing it to the target. For more information about JSON
* paths, see JSONPath.
*
*
* @param inputPath
* The value of the JSONPath that is used for extracting part of the
* matched event when passing it to the target. For more information
* about JSON paths, see JSONPath.
*/
public void setInputPath(String inputPath) {
this.inputPath = inputPath;
}
/**
*
* The value of the JSONPath that is used for extracting part of the matched
* event when passing it to the target. For more information about JSON
* paths, see JSONPath.
*
*
* @return The value of the JSONPath that is used for extracting part of the
* matched event when passing it to the target. For more information
* about JSON paths, see JSONPath.
*/
public String getInputPath() {
return this.inputPath;
}
/**
*
* The value of the JSONPath that is used for extracting part of the matched
* event when passing it to the target. For more information about JSON
* paths, see JSONPath.
*
*
* @param inputPath
* The value of the JSONPath that is used for extracting part of the
* matched event when passing it to the target. For more information
* about JSON paths, see JSONPath.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Target withInputPath(String inputPath) {
setInputPath(inputPath);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getId() != null)
sb.append("Id: " + getId() + ",");
if (getArn() != null)
sb.append("Arn: " + getArn() + ",");
if (getInput() != null)
sb.append("Input: " + getInput() + ",");
if (getInputPath() != null)
sb.append("InputPath: " + getInputPath());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Target == false)
return false;
Target other = (Target) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null
&& other.getId().equals(this.getId()) == false)
return false;
if (other.getArn() == null ^ this.getArn() == null)
return false;
if (other.getArn() != null
&& other.getArn().equals(this.getArn()) == false)
return false;
if (other.getInput() == null ^ this.getInput() == null)
return false;
if (other.getInput() != null
&& other.getInput().equals(this.getInput()) == false)
return false;
if (other.getInputPath() == null ^ this.getInputPath() == null)
return false;
if (other.getInputPath() != null
&& other.getInputPath().equals(this.getInputPath()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode
+ ((getArn() == null) ? 0 : getArn().hashCode());
hashCode = prime * hashCode
+ ((getInput() == null) ? 0 : getInput().hashCode());
hashCode = prime * hashCode
+ ((getInputPath() == null) ? 0 : getInputPath().hashCode());
return hashCode;
}
@Override
public Target clone() {
try {
return (Target) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}