Skip to content

Commit

Permalink
Added missing 'version' field to ScheduledEvent from CloudWatch (#447)
Browse files Browse the repository at this point in the history
* Adding version field to avoid UnrecognizedPropertyException upon invocation of lambdas
  • Loading branch information
render3d committed Oct 16, 2023
1 parent 90155b3 commit d3f23ce
Showing 1 changed file with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class ScheduledEvent implements Serializable, Cloneable {

private static final long serialVersionUID = -5810383198587331146L;

private String version;

private String account;

private String region;
Expand All @@ -47,6 +49,29 @@ public class ScheduledEvent implements Serializable, Cloneable {
*/
public ScheduledEvent() {}

/**
* @return the version number
*/
public String getVersion() {
return version;
}

/**
* @param version the version number
*/
public void setVersion(String version) {
this.version = version;
}

/**
* @param version version number
* @return ScheduledEvent
*/
public ScheduledEvent withVersion(String version) {
setVersion(version);
return this;
}

/**
* @return the account id
*/
Expand All @@ -69,7 +94,7 @@ public ScheduledEvent withAccount(String account) {
setAccount(account);
return this;
}

/**
* @return the aws region
*/
Expand All @@ -92,7 +117,7 @@ public ScheduledEvent withRegion(String region) {
setRegion(region);
return this;
}

/**
* @return The details of the events (usually left blank)
*/
Expand All @@ -115,7 +140,7 @@ public ScheduledEvent withDetail(Map<String, Object> detail) {
setDetail(detail);
return this;
}

/**
* @return The details type - see cloud watch events for more info
*/
Expand All @@ -138,19 +163,19 @@ public ScheduledEvent withDetailType(String detailType) {
setDetailType(detailType);
return this;
}

/**
* @return the soruce of the event
* @return the source of the event
*/
public String getSource() {
return source;
}

/**
* @param soruce the soruce of the event
* @param source the source of the event
*/
public void setSource(String soruce) {
this.source = soruce;
public void setSource(String source) {
this.source = source;
}

/**
Expand All @@ -161,7 +186,7 @@ public ScheduledEvent withSource(String source) {
setSource(source);
return this;
}

/**
* @return the timestamp for when the event is scheduled
*/
Expand All @@ -184,7 +209,7 @@ public ScheduledEvent withTime(DateTime time) {
setTime(time);
return this;
}

/**
* @return the id of the event
*/
Expand All @@ -207,7 +232,7 @@ public ScheduledEvent withId(String id) {
setId(id);
return this;
}

/**
* @return the resources used by event
*/
Expand Down Expand Up @@ -242,6 +267,8 @@ public ScheduledEvent withResources(List<String> resources) {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getVersion() != null)
sb.append("version: ").append(getVersion()).append(",");
if (getAccount() != null)
sb.append("account: ").append(getAccount()).append(",");
if (getRegion() != null)
Expand Down Expand Up @@ -272,6 +299,10 @@ public boolean equals(Object obj) {
if (obj instanceof ScheduledEvent == false)
return false;
ScheduledEvent other = (ScheduledEvent) obj;
if (other.getVersion() == null ^ this.getVersion() == null)
return false;
if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false)
return false;
if (other.getAccount() == null ^ this.getAccount() == null)
return false;
if (other.getAccount() != null && other.getAccount().equals(this.getAccount()) == false)
Expand Down Expand Up @@ -312,6 +343,7 @@ public int hashCode() {
final int prime = 31;
int hashCode = 1;

hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode());
hashCode = prime * hashCode + ((getAccount() == null) ? 0 : getAccount().hashCode());
hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode());
hashCode = prime * hashCode + ((getDetail() == null) ? 0 : getDetail().hashCode());
Expand All @@ -331,5 +363,5 @@ public ScheduledEvent clone() {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e);
}
}

}

0 comments on commit d3f23ce

Please sign in to comment.