com.amazonaws.services.logs.model.PutQueryDefinitionRequest 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.AmazonWebServiceRequest;
/**
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PutQueryDefinitionRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* A name for the query definition. If you are saving numerous query definitions, we recommend that you name them.
* This way, you can find the ones you want by using the first part of the name as a filter in the
* queryDefinitionNamePrefix
parameter of DescribeQueryDefinitions.
*
*/
private String name;
/**
*
* If you are updating a query definition, use this parameter to specify the ID of the query definition that you
* want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
*
*
* If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the
* new query definition and include it in the response to this operation.
*
*/
private String queryDefinitionId;
/**
*
* Use this parameter to include specific log groups as part of your query definition.
*
*
* If you are updating a query definition and you omit this parameter, then the updated definition will contain no
* log groups.
*
*/
private com.amazonaws.internal.SdkInternalList logGroupNames;
/**
*
* The query string to use for this definition. For more information, see CloudWatch Logs Insights
* Query Syntax.
*
*/
private String queryString;
/**
*
* Used as an idempotency token, to avoid returning an exception if the service receives the same request twice
* because of a network error.
*
*/
private String clientToken;
/**
*
* A name for the query definition. If you are saving numerous query definitions, we recommend that you name them.
* This way, you can find the ones you want by using the first part of the name as a filter in the
* queryDefinitionNamePrefix
parameter of DescribeQueryDefinitions.
*
*
* @param name
* A name for the query definition. If you are saving numerous query definitions, we recommend that you name
* them. This way, you can find the ones you want by using the first part of the name as a filter in the
* queryDefinitionNamePrefix
parameter of DescribeQueryDefinitions.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* A name for the query definition. If you are saving numerous query definitions, we recommend that you name them.
* This way, you can find the ones you want by using the first part of the name as a filter in the
* queryDefinitionNamePrefix
parameter of DescribeQueryDefinitions.
*
*
* @return A name for the query definition. If you are saving numerous query definitions, we recommend that you name
* them. This way, you can find the ones you want by using the first part of the name as a filter in the
* queryDefinitionNamePrefix
parameter of DescribeQueryDefinitions.
*/
public String getName() {
return this.name;
}
/**
*
* A name for the query definition. If you are saving numerous query definitions, we recommend that you name them.
* This way, you can find the ones you want by using the first part of the name as a filter in the
* queryDefinitionNamePrefix
parameter of DescribeQueryDefinitions.
*
*
* @param name
* A name for the query definition. If you are saving numerous query definitions, we recommend that you name
* them. This way, you can find the ones you want by using the first part of the name as a filter in the
* queryDefinitionNamePrefix
parameter of DescribeQueryDefinitions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutQueryDefinitionRequest withName(String name) {
setName(name);
return this;
}
/**
*
* If you are updating a query definition, use this parameter to specify the ID of the query definition that you
* want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
*
*
* If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the
* new query definition and include it in the response to this operation.
*
*
* @param queryDefinitionId
* If you are updating a query definition, use this parameter to specify the ID of the query definition that
* you want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
*
* If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID
* for the new query definition and include it in the response to this operation.
*/
public void setQueryDefinitionId(String queryDefinitionId) {
this.queryDefinitionId = queryDefinitionId;
}
/**
*
* If you are updating a query definition, use this parameter to specify the ID of the query definition that you
* want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
*
*
* If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the
* new query definition and include it in the response to this operation.
*
*
* @return If you are updating a query definition, use this parameter to specify the ID of the query definition that
* you want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
*
* If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID
* for the new query definition and include it in the response to this operation.
*/
public String getQueryDefinitionId() {
return this.queryDefinitionId;
}
/**
*
* If you are updating a query definition, use this parameter to specify the ID of the query definition that you
* want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
*
*
* If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the
* new query definition and include it in the response to this operation.
*
*
* @param queryDefinitionId
* If you are updating a query definition, use this parameter to specify the ID of the query definition that
* you want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
*
* If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID
* for the new query definition and include it in the response to this operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutQueryDefinitionRequest withQueryDefinitionId(String queryDefinitionId) {
setQueryDefinitionId(queryDefinitionId);
return this;
}
/**
*
* Use this parameter to include specific log groups as part of your query definition.
*
*
* If you are updating a query definition and you omit this parameter, then the updated definition will contain no
* log groups.
*
*
* @return Use this parameter to include specific log groups as part of your query definition.
*
* If you are updating a query definition and you omit this parameter, then the updated definition will
* contain no log groups.
*/
public java.util.List getLogGroupNames() {
if (logGroupNames == null) {
logGroupNames = new com.amazonaws.internal.SdkInternalList();
}
return logGroupNames;
}
/**
*
* Use this parameter to include specific log groups as part of your query definition.
*
*
* If you are updating a query definition and you omit this parameter, then the updated definition will contain no
* log groups.
*
*
* @param logGroupNames
* Use this parameter to include specific log groups as part of your query definition.
*
* If you are updating a query definition and you omit this parameter, then the updated definition will
* contain no log groups.
*/
public void setLogGroupNames(java.util.Collection logGroupNames) {
if (logGroupNames == null) {
this.logGroupNames = null;
return;
}
this.logGroupNames = new com.amazonaws.internal.SdkInternalList(logGroupNames);
}
/**
*
* Use this parameter to include specific log groups as part of your query definition.
*
*
* If you are updating a query definition and you omit this parameter, then the updated definition will contain no
* log groups.
*
*
* 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
* Use this parameter to include specific log groups as part of your query definition.
*
* If you are updating a query definition and you omit this parameter, then the updated definition will
* contain no log groups.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutQueryDefinitionRequest 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;
}
/**
*
* Use this parameter to include specific log groups as part of your query definition.
*
*
* If you are updating a query definition and you omit this parameter, then the updated definition will contain no
* log groups.
*
*
* @param logGroupNames
* Use this parameter to include specific log groups as part of your query definition.
*
* If you are updating a query definition and you omit this parameter, then the updated definition will
* contain no log groups.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutQueryDefinitionRequest withLogGroupNames(java.util.Collection logGroupNames) {
setLogGroupNames(logGroupNames);
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 PutQueryDefinitionRequest withQueryString(String queryString) {
setQueryString(queryString);
return this;
}
/**
*
* Used as an idempotency token, to avoid returning an exception if the service receives the same request twice
* because of a network error.
*
*
* @param clientToken
* Used as an idempotency token, to avoid returning an exception if the service receives the same request
* twice because of a network error.
*/
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
/**
*
* Used as an idempotency token, to avoid returning an exception if the service receives the same request twice
* because of a network error.
*
*
* @return Used as an idempotency token, to avoid returning an exception if the service receives the same request
* twice because of a network error.
*/
public String getClientToken() {
return this.clientToken;
}
/**
*
* Used as an idempotency token, to avoid returning an exception if the service receives the same request twice
* because of a network error.
*
*
* @param clientToken
* Used as an idempotency token, to avoid returning an exception if the service receives the same request
* twice because of a network error.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutQueryDefinitionRequest withClientToken(String clientToken) {
setClientToken(clientToken);
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 (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getQueryDefinitionId() != null)
sb.append("QueryDefinitionId: ").append(getQueryDefinitionId()).append(",");
if (getLogGroupNames() != null)
sb.append("LogGroupNames: ").append(getLogGroupNames()).append(",");
if (getQueryString() != null)
sb.append("QueryString: ").append(getQueryString()).append(",");
if (getClientToken() != null)
sb.append("ClientToken: ").append(getClientToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PutQueryDefinitionRequest == false)
return false;
PutQueryDefinitionRequest other = (PutQueryDefinitionRequest) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getQueryDefinitionId() == null ^ this.getQueryDefinitionId() == null)
return false;
if (other.getQueryDefinitionId() != null && other.getQueryDefinitionId().equals(this.getQueryDefinitionId()) == false)
return false;
if (other.getLogGroupNames() == null ^ this.getLogGroupNames() == null)
return false;
if (other.getLogGroupNames() != null && other.getLogGroupNames().equals(this.getLogGroupNames()) == 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.getClientToken() == null ^ this.getClientToken() == null)
return false;
if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getQueryDefinitionId() == null) ? 0 : getQueryDefinitionId().hashCode());
hashCode = prime * hashCode + ((getLogGroupNames() == null) ? 0 : getLogGroupNames().hashCode());
hashCode = prime * hashCode + ((getQueryString() == null) ? 0 : getQueryString().hashCode());
hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode());
return hashCode;
}
@Override
public PutQueryDefinitionRequest clone() {
return (PutQueryDefinitionRequest) super.clone();
}
}