com.amazonaws.services.logs.model.QueryDefinition Maven / Gradle / Ivy
Show all versions of aws-java-sdk-logs Show documentation
/*
* Copyright 2019-2024 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.logs.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* This structure contains details about a saved CloudWatch Logs Insights query definition.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class QueryDefinition implements Serializable, Cloneable, StructuredPojo {
/**
*
* The unique ID of the query definition.
*
*/
private String queryDefinitionId;
/**
*
* The name of the query definition.
*
*/
private String name;
/**
*
* The query string to use for this definition. For more information, see CloudWatch Logs Insights
* Query Syntax.
*
*/
private String queryString;
/**
*
* The date that the query definition was most recently modified.
*
*/
private Long lastModified;
/**
*
* If this query definition contains a list of log groups that it is limited to, that list appears here.
*
*/
private com.amazonaws.internal.SdkInternalList logGroupNames;
/**
*
* The unique ID of the query definition.
*
*
* @param queryDefinitionId
* The unique ID of the query definition.
*/
public void setQueryDefinitionId(String queryDefinitionId) {
this.queryDefinitionId = queryDefinitionId;
}
/**
*
* The unique ID of the query definition.
*
*
* @return The unique ID of the query definition.
*/
public String getQueryDefinitionId() {
return this.queryDefinitionId;
}
/**
*
* The unique ID of the query definition.
*
*
* @param queryDefinitionId
* The unique ID of the query definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryDefinition withQueryDefinitionId(String queryDefinitionId) {
setQueryDefinitionId(queryDefinitionId);
return this;
}
/**
*
* The name of the query definition.
*
*
* @param name
* The name of the query definition.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the query definition.
*
*
* @return The name of the query definition.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the query definition.
*
*
* @param name
* The name of the query definition.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryDefinition withName(String name) {
setName(name);
return this;
}
/**
*
* The query string to use for this definition. For more information, see CloudWatch Logs Insights
* Query Syntax.
*
*
* @param queryString
* The query string to use for this definition. For more information, see CloudWatch Logs
* Insights Query Syntax.
*/
public void setQueryString(String queryString) {
this.queryString = queryString;
}
/**
*
* The query string to use for this definition. For more information, see CloudWatch Logs Insights
* Query Syntax.
*
*
* @return The query string to use for this definition. For more information, see CloudWatch Logs
* Insights Query Syntax.
*/
public String getQueryString() {
return this.queryString;
}
/**
*
* The query string to use for this definition. For more information, see CloudWatch Logs Insights
* Query Syntax.
*
*
* @param queryString
* The query string to use for this definition. For more information, see CloudWatch Logs
* Insights Query Syntax.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryDefinition withQueryString(String queryString) {
setQueryString(queryString);
return this;
}
/**
*
* The date that the query definition was most recently modified.
*
*
* @param lastModified
* The date that the query definition was most recently modified.
*/
public void setLastModified(Long lastModified) {
this.lastModified = lastModified;
}
/**
*
* The date that the query definition was most recently modified.
*
*
* @return The date that the query definition was most recently modified.
*/
public Long getLastModified() {
return this.lastModified;
}
/**
*
* The date that the query definition was most recently modified.
*
*
* @param lastModified
* The date that the query definition was most recently modified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryDefinition withLastModified(Long lastModified) {
setLastModified(lastModified);
return this;
}
/**
*
* If this query definition contains a list of log groups that it is limited to, that list appears here.
*
*
* @return If this query definition contains a list of log groups that it is limited to, that list appears here.
*/
public java.util.List getLogGroupNames() {
if (logGroupNames == null) {
logGroupNames = new com.amazonaws.internal.SdkInternalList();
}
return logGroupNames;
}
/**
*
* If this query definition contains a list of log groups that it is limited to, that list appears here.
*
*
* @param logGroupNames
* If this query definition contains a list of log groups that it is limited to, that list appears here.
*/
public void setLogGroupNames(java.util.Collection logGroupNames) {
if (logGroupNames == null) {
this.logGroupNames = null;
return;
}
this.logGroupNames = new com.amazonaws.internal.SdkInternalList(logGroupNames);
}
/**
*
* If this query definition contains a list of log groups that it is limited to, that list appears here.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setLogGroupNames(java.util.Collection)} or {@link #withLogGroupNames(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param logGroupNames
* If this query definition contains a list of log groups that it is limited to, that list appears here.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryDefinition withLogGroupNames(String... logGroupNames) {
if (this.logGroupNames == null) {
setLogGroupNames(new com.amazonaws.internal.SdkInternalList(logGroupNames.length));
}
for (String ele : logGroupNames) {
this.logGroupNames.add(ele);
}
return this;
}
/**
*
* If this query definition contains a list of log groups that it is limited to, that list appears here.
*
*
* @param logGroupNames
* If this query definition contains a list of log groups that it is limited to, that list appears here.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryDefinition withLogGroupNames(java.util.Collection logGroupNames) {
setLogGroupNames(logGroupNames);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getQueryDefinitionId() != null)
sb.append("QueryDefinitionId: ").append(getQueryDefinitionId()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getQueryString() != null)
sb.append("QueryString: ").append(getQueryString()).append(",");
if (getLastModified() != null)
sb.append("LastModified: ").append(getLastModified()).append(",");
if (getLogGroupNames() != null)
sb.append("LogGroupNames: ").append(getLogGroupNames());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof QueryDefinition == false)
return false;
QueryDefinition other = (QueryDefinition) obj;
if (other.getQueryDefinitionId() == null ^ this.getQueryDefinitionId() == null)
return false;
if (other.getQueryDefinitionId() != null && other.getQueryDefinitionId().equals(this.getQueryDefinitionId()) == false)
return false;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getQueryString() == null ^ this.getQueryString() == null)
return false;
if (other.getQueryString() != null && other.getQueryString().equals(this.getQueryString()) == false)
return false;
if (other.getLastModified() == null ^ this.getLastModified() == null)
return false;
if (other.getLastModified() != null && other.getLastModified().equals(this.getLastModified()) == false)
return false;
if (other.getLogGroupNames() == null ^ this.getLogGroupNames() == null)
return false;
if (other.getLogGroupNames() != null && other.getLogGroupNames().equals(this.getLogGroupNames()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getQueryDefinitionId() == null) ? 0 : getQueryDefinitionId().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getQueryString() == null) ? 0 : getQueryString().hashCode());
hashCode = prime * hashCode + ((getLastModified() == null) ? 0 : getLastModified().hashCode());
hashCode = prime * hashCode + ((getLogGroupNames() == null) ? 0 : getLogGroupNames().hashCode());
return hashCode;
}
@Override
public QueryDefinition clone() {
try {
return (QueryDefinition) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.logs.model.transform.QueryDefinitionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}