/* * Copyright 2018-2023 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 StartQueryRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *

* The log group on which to perform the query. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
*/ private String logGroupName; /** *

* The list of log groups to be queried. You can include up to 50 log groups. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
*/ private com.amazonaws.internal.SdkInternalList logGroupNames; /** *

* The list of log groups to query. You can include up to 50 log groups. *

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and * you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also * be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*/ private com.amazonaws.internal.SdkInternalList logGroupIdentifiers; /** *

* The beginning of the time range to query. The range is inclusive, so the specified start time is included in the * query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

*/ private Long startTime; /** *

* The end of the time range to query. The range is inclusive, so the specified end time is included in the query. * Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

*/ private Long endTime; /** *

* The query string to use. For more information, see CloudWatch Logs Insights * Query Syntax. *

*/ private String queryString; /** *

* The maximum number of log events to return in the query. If the query string uses the fields * command, only the specified fields and their values are returned. The default is 1000. *

*/ private Integer limit; /** *

* The log group on which to perform the query. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
* * @param logGroupName * The log group on which to perform the query.

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*/ public void setLogGroupName(String logGroupName) { this.logGroupName = logGroupName; } /** *

* The log group on which to perform the query. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
* * @return The log group on which to perform the query.

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*/ public String getLogGroupName() { return this.logGroupName; } /** *

* The log group on which to perform the query. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
* * @param logGroupName * The log group on which to perform the query.

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

* @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest withLogGroupName(String logGroupName) { setLogGroupName(logGroupName); return this; } /** *

* The list of log groups to be queried. You can include up to 50 log groups. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
* * @return The list of log groups to be queried. You can include up to 50 log groups.

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*/ public java.util.List getLogGroupNames() { if (logGroupNames == null) { logGroupNames = new com.amazonaws.internal.SdkInternalList(); } return logGroupNames; } /** *

* The list of log groups to be queried. You can include up to 50 log groups. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
* * @param logGroupNames * The list of log groups to be queried. You can include up to 50 log groups.

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*/ public void setLogGroupNames(java.util.Collection logGroupNames) { if (logGroupNames == null) { this.logGroupNames = null; return; } this.logGroupNames = new com.amazonaws.internal.SdkInternalList(logGroupNames); } /** *

* The list of log groups to be queried. You can include up to 50 log groups. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
*

* 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 * The list of log groups to be queried. You can include up to 50 log groups.

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

* @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest 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; } /** *

* The list of log groups to be queried. You can include up to 50 log groups. *

* *

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*
* * @param logGroupNames * The list of log groups to be queried. You can include up to 50 log groups.

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

* @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest withLogGroupNames(java.util.Collection logGroupNames) { setLogGroupNames(logGroupNames); return this; } /** *

* The list of log groups to query. You can include up to 50 log groups. *

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and * you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also * be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

* * @return The list of log groups to query. You can include up to 50 log groups.

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source * account and you're using a monitoring account, you must specify the ARN of the log group here. The query * definition must also be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. */ public java.util.List getLogGroupIdentifiers() { if (logGroupIdentifiers == null) { logGroupIdentifiers = new com.amazonaws.internal.SdkInternalList(); } return logGroupIdentifiers; } /** *

* The list of log groups to query. You can include up to 50 log groups. *

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and * you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also * be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

* * @param logGroupIdentifiers * The list of log groups to query. You can include up to 50 log groups.

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source * account and you're using a monitoring account, you must specify the ARN of the log group here. The query * definition must also be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. */ public void setLogGroupIdentifiers(java.util.Collection logGroupIdentifiers) { if (logGroupIdentifiers == null) { this.logGroupIdentifiers = null; return; } this.logGroupIdentifiers = new com.amazonaws.internal.SdkInternalList(logGroupIdentifiers); } /** *

* The list of log groups to query. You can include up to 50 log groups. *

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and * you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also * be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setLogGroupIdentifiers(java.util.Collection)} or {@link #withLogGroupIdentifiers(java.util.Collection)} * if you want to override the existing values. *

* * @param logGroupIdentifiers * The list of log groups to query. You can include up to 50 log groups.

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source * account and you're using a monitoring account, you must specify the ARN of the log group here. The query * definition must also be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. * @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest withLogGroupIdentifiers(String... logGroupIdentifiers) { if (this.logGroupIdentifiers == null) { setLogGroupIdentifiers(new com.amazonaws.internal.SdkInternalList(logGroupIdentifiers.length)); } for (String ele : logGroupIdentifiers) { this.logGroupIdentifiers.add(ele); } return this; } /** *

* The list of log groups to query. You can include up to 50 log groups. *

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and * you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also * be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. *

* * @param logGroupIdentifiers * The list of log groups to query. You can include up to 50 log groups.

*

* You can specify them by the log group name or ARN. If a log group that you're querying is in a source * account and you're using a monitoring account, you must specify the ARN of the log group here. The query * definition must also be defined in the monitoring account. *

*

* If you specify an ARN, the ARN can't end with an asterisk (*). *

*

* A StartQuery operation must include exactly one of the following parameters: * logGroupName, logGroupNames, or logGroupIdentifiers. * @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest withLogGroupIdentifiers(java.util.Collection logGroupIdentifiers) { setLogGroupIdentifiers(logGroupIdentifiers); return this; } /** *

* The beginning of the time range to query. The range is inclusive, so the specified start time is included in the * query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

* * @param startTime * The beginning of the time range to query. The range is inclusive, so the specified start time is included * in the query. Specified as epoch time, the number of seconds since * January 1, 1970, 00:00:00 UTC. */ public void setStartTime(Long startTime) { this.startTime = startTime; } /** *

* The beginning of the time range to query. The range is inclusive, so the specified start time is included in the * query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

* * @return The beginning of the time range to query. The range is inclusive, so the specified start time is included * in the query. Specified as epoch time, the number of seconds since * January 1, 1970, 00:00:00 UTC. */ public Long getStartTime() { return this.startTime; } /** *

* The beginning of the time range to query. The range is inclusive, so the specified start time is included in the * query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

* * @param startTime * The beginning of the time range to query. The range is inclusive, so the specified start time is included * in the query. Specified as epoch time, the number of seconds since * January 1, 1970, 00:00:00 UTC. * @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest withStartTime(Long startTime) { setStartTime(startTime); return this; } /** *

* The end of the time range to query. The range is inclusive, so the specified end time is included in the query. * Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

* * @param endTime * The end of the time range to query. The range is inclusive, so the specified end time is included in the * query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. */ public void setEndTime(Long endTime) { this.endTime = endTime; } /** *

* The end of the time range to query. The range is inclusive, so the specified end time is included in the query. * Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

* * @return The end of the time range to query. The range is inclusive, so the specified end time is included in the * query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. */ public Long getEndTime() { return this.endTime; } /** *

* The end of the time range to query. The range is inclusive, so the specified end time is included in the query. * Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. *

* * @param endTime * The end of the time range to query. The range is inclusive, so the specified end time is included in the * query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC. * @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest withEndTime(Long endTime) { setEndTime(endTime); return this; } /** *

* The query string to use. For more information, see CloudWatch Logs Insights * Query Syntax. *

* * @param queryString * The query string to use. For more information, see CloudWatch Logs * Insights Query Syntax. */ public void setQueryString(String queryString) { this.queryString = queryString; } /** *

* The query string to use. For more information, see CloudWatch Logs Insights * Query Syntax. *

* * @return The query string to use. For more information, see CloudWatch Logs * Insights Query Syntax. */ public String getQueryString() { return this.queryString; } /** *

* The query string to use. For more information, see CloudWatch Logs Insights * Query Syntax. *

* * @param queryString * The query string to use. 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 StartQueryRequest withQueryString(String queryString) { setQueryString(queryString); return this; } /** *

* The maximum number of log events to return in the query. If the query string uses the fields * command, only the specified fields and their values are returned. The default is 1000. *

* * @param limit * The maximum number of log events to return in the query. If the query string uses the fields * command, only the specified fields and their values are returned. The default is 1000. */ public void setLimit(Integer limit) { this.limit = limit; } /** *

* The maximum number of log events to return in the query. If the query string uses the fields * command, only the specified fields and their values are returned. The default is 1000. *

* * @return The maximum number of log events to return in the query. If the query string uses the fields * command, only the specified fields and their values are returned. The default is 1000. */ public Integer getLimit() { return this.limit; } /** *

* The maximum number of log events to return in the query. If the query string uses the fields * command, only the specified fields and their values are returned. The default is 1000. *

* * @param limit * The maximum number of log events to return in the query. If the query string uses the fields * command, only the specified fields and their values are returned. The default is 1000. * @return Returns a reference to this object so that method calls can be chained together. */ public StartQueryRequest withLimit(Integer limit) { setLimit(limit); 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 (getLogGroupName() != null) sb.append("LogGroupName: ").append(getLogGroupName()).append(","); if (getLogGroupNames() != null) sb.append("LogGroupNames: ").append(getLogGroupNames()).append(","); if (getLogGroupIdentifiers() != null) sb.append("LogGroupIdentifiers: ").append(getLogGroupIdentifiers()).append(","); if (getStartTime() != null) sb.append("StartTime: ").append(getStartTime()).append(","); if (getEndTime() != null) sb.append("EndTime: ").append(getEndTime()).append(","); if (getQueryString() != null) sb.append("QueryString: ").append(getQueryString()).append(","); if (getLimit() != null) sb.append("Limit: ").append(getLimit()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof StartQueryRequest == false) return false; StartQueryRequest other = (StartQueryRequest) obj; if (other.getLogGroupName() == null ^ this.getLogGroupName() == null) return false; if (other.getLogGroupName() != null && other.getLogGroupName().equals(this.getLogGroupName()) == 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.getLogGroupIdentifiers() == null ^ this.getLogGroupIdentifiers() == null) return false; if (other.getLogGroupIdentifiers() != null && other.getLogGroupIdentifiers().equals(this.getLogGroupIdentifiers()) == false) return false; if (other.getStartTime() == null ^ this.getStartTime() == null) return false; if (other.getStartTime() != null && other.getStartTime().equals(this.getStartTime()) == false) return false; if (other.getEndTime() == null ^ this.getEndTime() == null) return false; if (other.getEndTime() != null && other.getEndTime().equals(this.getEndTime()) == 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.getLimit() == null ^ this.getLimit() == null) return false; if (other.getLimit() != null && other.getLimit().equals(this.getLimit()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLogGroupName() == null) ? 0 : getLogGroupName().hashCode()); hashCode = prime * hashCode + ((getLogGroupNames() == null) ? 0 : getLogGroupNames().hashCode()); hashCode = prime * hashCode + ((getLogGroupIdentifiers() == null) ? 0 : getLogGroupIdentifiers().hashCode()); hashCode = prime * hashCode + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); hashCode = prime * hashCode + ((getEndTime() == null) ? 0 : getEndTime().hashCode()); hashCode = prime * hashCode + ((getQueryString() == null) ? 0 : getQueryString().hashCode()); hashCode = prime * hashCode + ((getLimit() == null) ? 0 : getLimit().hashCode()); return hashCode; } @Override public StartQueryRequest clone() { return (StartQueryRequest) super.clone(); } }