/* * 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.rdsdata.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** *

* The request parameters represent the input of a request to run a SQL statement against a database. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ExecuteStatementRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *

* The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster. *

*/ private String resourceArn; /** *

* The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the * credentials in the secret. *

*

* For information about creating the secret, see Create a database * secret. *

*/ private String secretArn; /** *

* The SQL statement to run. *

*/ private String sql; /** *

* The name of the database. *

*/ private String database; /** *

* The name of the database schema. *

* *

* Currently, the schema parameter isn't supported. *

*
*/ private String schema; /** *

* The parameters for the SQL statement. *

* *

* Array parameters are not supported. *

*
*/ private java.util.List parameters; /** *

* The identifier of a transaction that was started by using the BeginTransaction operation. Specify * the transaction ID of the transaction that you want to include the SQL statement in. *

*

* If the SQL statement is not part of a transaction, don't set this parameter. *

*/ private String transactionId; /** *

* A value that indicates whether to include metadata in the results. *

*/ private Boolean includeResultMetadata; /** *

* A value that indicates whether to continue running the statement after the call times out. By default, the * statement stops running when the call times out. *

* *

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement * terminates before it is finished running, it can result in errors and possibly corrupted data structures. *

*
*/ private Boolean continueAfterTimeout; /** *

* Options that control how the result set is returned. *

*/ private ResultSetOptions resultSetOptions; /** *

* A value that indicates whether to format the result set as a single JSON string. This parameter only applies to * SELECT statements and is ignored for other types of statements. Allowed values are NONE * and JSON. The default value is NONE. The result is returned in the * formattedRecords field. *

*

* For usage information about the JSON format for result sets, see Using the Data API in the * Amazon Aurora User Guide. *

*/ private String formatRecordsAs; /** *

* The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster. *

* * @param resourceArn * The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster. */ public void setResourceArn(String resourceArn) { this.resourceArn = resourceArn; } /** *

* The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster. *

* * @return The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster. */ public String getResourceArn() { return this.resourceArn; } /** *

* The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster. *

* * @param resourceArn * The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withResourceArn(String resourceArn) { setResourceArn(resourceArn); return this; } /** *

* The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the * credentials in the secret. *

*

* For information about creating the secret, see Create a database * secret. *

* * @param secretArn * The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for * the credentials in the secret.

*

* For information about creating the secret, see Create a * database secret. */ public void setSecretArn(String secretArn) { this.secretArn = secretArn; } /** *

* The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the * credentials in the secret. *

*

* For information about creating the secret, see Create a database * secret. *

* * @return The ARN of the secret that enables access to the DB cluster. Enter the database user name and password * for the credentials in the secret.

*

* For information about creating the secret, see Create a * database secret. */ public String getSecretArn() { return this.secretArn; } /** *

* The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the * credentials in the secret. *

*

* For information about creating the secret, see Create a database * secret. *

* * @param secretArn * The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for * the credentials in the secret.

*

* For information about creating the secret, see Create a * database secret. * @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withSecretArn(String secretArn) { setSecretArn(secretArn); return this; } /** *

* The SQL statement to run. *

* * @param sql * The SQL statement to run. */ public void setSql(String sql) { this.sql = sql; } /** *

* The SQL statement to run. *

* * @return The SQL statement to run. */ public String getSql() { return this.sql; } /** *

* The SQL statement to run. *

* * @param sql * The SQL statement to run. * @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withSql(String sql) { setSql(sql); return this; } /** *

* The name of the database. *

* * @param database * The name of the database. */ public void setDatabase(String database) { this.database = database; } /** *

* The name of the database. *

* * @return The name of the database. */ public String getDatabase() { return this.database; } /** *

* The name of the database. *

* * @param database * The name of the database. * @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withDatabase(String database) { setDatabase(database); return this; } /** *

* The name of the database schema. *

* *

* Currently, the schema parameter isn't supported. *

*
* * @param schema * The name of the database schema.

*

* Currently, the schema parameter isn't supported. *

*/ public void setSchema(String schema) { this.schema = schema; } /** *

* The name of the database schema. *

* *

* Currently, the schema parameter isn't supported. *

*
* * @return The name of the database schema.

*

* Currently, the schema parameter isn't supported. *

*/ public String getSchema() { return this.schema; } /** *

* The name of the database schema. *

* *

* Currently, the schema parameter isn't supported. *

*
* * @param schema * The name of the database schema.

*

* Currently, the schema parameter isn't supported. *

* @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withSchema(String schema) { setSchema(schema); return this; } /** *

* The parameters for the SQL statement. *

* *

* Array parameters are not supported. *

*
* * @return The parameters for the SQL statement.

*

* Array parameters are not supported. *

*/ public java.util.List getParameters() { return parameters; } /** *

* The parameters for the SQL statement. *

* *

* Array parameters are not supported. *

*
* * @param parameters * The parameters for the SQL statement.

*

* Array parameters are not supported. *

*/ public void setParameters(java.util.Collection parameters) { if (parameters == null) { this.parameters = null; return; } this.parameters = new java.util.ArrayList(parameters); } /** *

* The parameters for the SQL statement. *

* *

* Array parameters are not supported. *

*
*

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

* * @param parameters * The parameters for the SQL statement.

*

* Array parameters are not supported. *

* @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withParameters(SqlParameter... parameters) { if (this.parameters == null) { setParameters(new java.util.ArrayList(parameters.length)); } for (SqlParameter ele : parameters) { this.parameters.add(ele); } return this; } /** *

* The parameters for the SQL statement. *

* *

* Array parameters are not supported. *

*
* * @param parameters * The parameters for the SQL statement.

*

* Array parameters are not supported. *

* @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withParameters(java.util.Collection parameters) { setParameters(parameters); return this; } /** *

* The identifier of a transaction that was started by using the BeginTransaction operation. Specify * the transaction ID of the transaction that you want to include the SQL statement in. *

*

* If the SQL statement is not part of a transaction, don't set this parameter. *

* * @param transactionId * The identifier of a transaction that was started by using the BeginTransaction operation. * Specify the transaction ID of the transaction that you want to include the SQL statement in.

*

* If the SQL statement is not part of a transaction, don't set this parameter. */ public void setTransactionId(String transactionId) { this.transactionId = transactionId; } /** *

* The identifier of a transaction that was started by using the BeginTransaction operation. Specify * the transaction ID of the transaction that you want to include the SQL statement in. *

*

* If the SQL statement is not part of a transaction, don't set this parameter. *

* * @return The identifier of a transaction that was started by using the BeginTransaction operation. * Specify the transaction ID of the transaction that you want to include the SQL statement in.

*

* If the SQL statement is not part of a transaction, don't set this parameter. */ public String getTransactionId() { return this.transactionId; } /** *

* The identifier of a transaction that was started by using the BeginTransaction operation. Specify * the transaction ID of the transaction that you want to include the SQL statement in. *

*

* If the SQL statement is not part of a transaction, don't set this parameter. *

* * @param transactionId * The identifier of a transaction that was started by using the BeginTransaction operation. * Specify the transaction ID of the transaction that you want to include the SQL statement in.

*

* If the SQL statement is not part of a transaction, don't set this parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withTransactionId(String transactionId) { setTransactionId(transactionId); return this; } /** *

* A value that indicates whether to include metadata in the results. *

* * @param includeResultMetadata * A value that indicates whether to include metadata in the results. */ public void setIncludeResultMetadata(Boolean includeResultMetadata) { this.includeResultMetadata = includeResultMetadata; } /** *

* A value that indicates whether to include metadata in the results. *

* * @return A value that indicates whether to include metadata in the results. */ public Boolean getIncludeResultMetadata() { return this.includeResultMetadata; } /** *

* A value that indicates whether to include metadata in the results. *

* * @param includeResultMetadata * A value that indicates whether to include metadata in the results. * @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withIncludeResultMetadata(Boolean includeResultMetadata) { setIncludeResultMetadata(includeResultMetadata); return this; } /** *

* A value that indicates whether to include metadata in the results. *

* * @return A value that indicates whether to include metadata in the results. */ public Boolean isIncludeResultMetadata() { return this.includeResultMetadata; } /** *

* A value that indicates whether to continue running the statement after the call times out. By default, the * statement stops running when the call times out. *

* *

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement * terminates before it is finished running, it can result in errors and possibly corrupted data structures. *

*
* * @param continueAfterTimeout * A value that indicates whether to continue running the statement after the call times out. By default, the * statement stops running when the call times out.

*

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL * statement terminates before it is finished running, it can result in errors and possibly corrupted data * structures. *

*/ public void setContinueAfterTimeout(Boolean continueAfterTimeout) { this.continueAfterTimeout = continueAfterTimeout; } /** *

* A value that indicates whether to continue running the statement after the call times out. By default, the * statement stops running when the call times out. *

* *

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement * terminates before it is finished running, it can result in errors and possibly corrupted data structures. *

*
* * @return A value that indicates whether to continue running the statement after the call times out. By default, * the statement stops running when the call times out.

*

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL * statement terminates before it is finished running, it can result in errors and possibly corrupted data * structures. *

*/ public Boolean getContinueAfterTimeout() { return this.continueAfterTimeout; } /** *

* A value that indicates whether to continue running the statement after the call times out. By default, the * statement stops running when the call times out. *

* *

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement * terminates before it is finished running, it can result in errors and possibly corrupted data structures. *

*
* * @param continueAfterTimeout * A value that indicates whether to continue running the statement after the call times out. By default, the * statement stops running when the call times out.

*

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL * statement terminates before it is finished running, it can result in errors and possibly corrupted data * structures. *

* @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withContinueAfterTimeout(Boolean continueAfterTimeout) { setContinueAfterTimeout(continueAfterTimeout); return this; } /** *

* A value that indicates whether to continue running the statement after the call times out. By default, the * statement stops running when the call times out. *

* *

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement * terminates before it is finished running, it can result in errors and possibly corrupted data structures. *

*
* * @return A value that indicates whether to continue running the statement after the call times out. By default, * the statement stops running when the call times out.

*

* For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL * statement terminates before it is finished running, it can result in errors and possibly corrupted data * structures. *

*/ public Boolean isContinueAfterTimeout() { return this.continueAfterTimeout; } /** *

* Options that control how the result set is returned. *

* * @param resultSetOptions * Options that control how the result set is returned. */ public void setResultSetOptions(ResultSetOptions resultSetOptions) { this.resultSetOptions = resultSetOptions; } /** *

* Options that control how the result set is returned. *

* * @return Options that control how the result set is returned. */ public ResultSetOptions getResultSetOptions() { return this.resultSetOptions; } /** *

* Options that control how the result set is returned. *

* * @param resultSetOptions * Options that control how the result set is returned. * @return Returns a reference to this object so that method calls can be chained together. */ public ExecuteStatementRequest withResultSetOptions(ResultSetOptions resultSetOptions) { setResultSetOptions(resultSetOptions); return this; } /** *

* A value that indicates whether to format the result set as a single JSON string. This parameter only applies to * SELECT statements and is ignored for other types of statements. Allowed values are NONE * and JSON. The default value is NONE. The result is returned in the * formattedRecords field. *

*

* For usage information about the JSON format for result sets, see Using the Data API in the * Amazon Aurora User Guide. *

* * @param formatRecordsAs * A value that indicates whether to format the result set as a single JSON string. This parameter only * applies to SELECT statements and is ignored for other types of statements. Allowed values are * NONE and JSON. The default value is NONE. The result is returned in * the formattedRecords field.

*

* For usage information about the JSON format for result sets, see Using the Data API * in the Amazon Aurora User Guide. * @see RecordsFormatType */ public void setFormatRecordsAs(String formatRecordsAs) { this.formatRecordsAs = formatRecordsAs; } /** *

* A value that indicates whether to format the result set as a single JSON string. This parameter only applies to * SELECT statements and is ignored for other types of statements. Allowed values are NONE * and JSON. The default value is NONE. The result is returned in the * formattedRecords field. *

*

* For usage information about the JSON format for result sets, see Using the Data API in the * Amazon Aurora User Guide. *

* * @return A value that indicates whether to format the result set as a single JSON string. This parameter only * applies to SELECT statements and is ignored for other types of statements. Allowed values * are NONE and JSON. The default value is NONE. The result is * returned in the formattedRecords field.

*

* For usage information about the JSON format for result sets, see Using the Data API * in the Amazon Aurora User Guide. * @see RecordsFormatType */ public String getFormatRecordsAs() { return this.formatRecordsAs; } /** *

* A value that indicates whether to format the result set as a single JSON string. This parameter only applies to * SELECT statements and is ignored for other types of statements. Allowed values are NONE * and JSON. The default value is NONE. The result is returned in the * formattedRecords field. *

*

* For usage information about the JSON format for result sets, see Using the Data API in the * Amazon Aurora User Guide. *

* * @param formatRecordsAs * A value that indicates whether to format the result set as a single JSON string. This parameter only * applies to SELECT statements and is ignored for other types of statements. Allowed values are * NONE and JSON. The default value is NONE. The result is returned in * the formattedRecords field.

*

* For usage information about the JSON format for result sets, see Using the Data API * in the Amazon Aurora User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see RecordsFormatType */ public ExecuteStatementRequest withFormatRecordsAs(String formatRecordsAs) { setFormatRecordsAs(formatRecordsAs); return this; } /** *

* A value that indicates whether to format the result set as a single JSON string. This parameter only applies to * SELECT statements and is ignored for other types of statements. Allowed values are NONE * and JSON. The default value is NONE. The result is returned in the * formattedRecords field. *

*

* For usage information about the JSON format for result sets, see Using the Data API in the * Amazon Aurora User Guide. *

* * @param formatRecordsAs * A value that indicates whether to format the result set as a single JSON string. This parameter only * applies to SELECT statements and is ignored for other types of statements. Allowed values are * NONE and JSON. The default value is NONE. The result is returned in * the formattedRecords field.

*

* For usage information about the JSON format for result sets, see Using the Data API * in the Amazon Aurora User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see RecordsFormatType */ public ExecuteStatementRequest withFormatRecordsAs(RecordsFormatType formatRecordsAs) { this.formatRecordsAs = formatRecordsAs.toString(); 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 (getResourceArn() != null) sb.append("ResourceArn: ").append(getResourceArn()).append(","); if (getSecretArn() != null) sb.append("SecretArn: ").append(getSecretArn()).append(","); if (getSql() != null) sb.append("Sql: ").append(getSql()).append(","); if (getDatabase() != null) sb.append("Database: ").append(getDatabase()).append(","); if (getSchema() != null) sb.append("Schema: ").append(getSchema()).append(","); if (getParameters() != null) sb.append("Parameters: ").append(getParameters()).append(","); if (getTransactionId() != null) sb.append("TransactionId: ").append(getTransactionId()).append(","); if (getIncludeResultMetadata() != null) sb.append("IncludeResultMetadata: ").append(getIncludeResultMetadata()).append(","); if (getContinueAfterTimeout() != null) sb.append("ContinueAfterTimeout: ").append(getContinueAfterTimeout()).append(","); if (getResultSetOptions() != null) sb.append("ResultSetOptions: ").append(getResultSetOptions()).append(","); if (getFormatRecordsAs() != null) sb.append("FormatRecordsAs: ").append(getFormatRecordsAs()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ExecuteStatementRequest == false) return false; ExecuteStatementRequest other = (ExecuteStatementRequest) obj; if (other.getResourceArn() == null ^ this.getResourceArn() == null) return false; if (other.getResourceArn() != null && other.getResourceArn().equals(this.getResourceArn()) == false) return false; if (other.getSecretArn() == null ^ this.getSecretArn() == null) return false; if (other.getSecretArn() != null && other.getSecretArn().equals(this.getSecretArn()) == false) return false; if (other.getSql() == null ^ this.getSql() == null) return false; if (other.getSql() != null && other.getSql().equals(this.getSql()) == false) return false; if (other.getDatabase() == null ^ this.getDatabase() == null) return false; if (other.getDatabase() != null && other.getDatabase().equals(this.getDatabase()) == false) return false; if (other.getSchema() == null ^ this.getSchema() == null) return false; if (other.getSchema() != null && other.getSchema().equals(this.getSchema()) == false) return false; if (other.getParameters() == null ^ this.getParameters() == null) return false; if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false) return false; if (other.getTransactionId() == null ^ this.getTransactionId() == null) return false; if (other.getTransactionId() != null && other.getTransactionId().equals(this.getTransactionId()) == false) return false; if (other.getIncludeResultMetadata() == null ^ this.getIncludeResultMetadata() == null) return false; if (other.getIncludeResultMetadata() != null && other.getIncludeResultMetadata().equals(this.getIncludeResultMetadata()) == false) return false; if (other.getContinueAfterTimeout() == null ^ this.getContinueAfterTimeout() == null) return false; if (other.getContinueAfterTimeout() != null && other.getContinueAfterTimeout().equals(this.getContinueAfterTimeout()) == false) return false; if (other.getResultSetOptions() == null ^ this.getResultSetOptions() == null) return false; if (other.getResultSetOptions() != null && other.getResultSetOptions().equals(this.getResultSetOptions()) == false) return false; if (other.getFormatRecordsAs() == null ^ this.getFormatRecordsAs() == null) return false; if (other.getFormatRecordsAs() != null && other.getFormatRecordsAs().equals(this.getFormatRecordsAs()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getResourceArn() == null) ? 0 : getResourceArn().hashCode()); hashCode = prime * hashCode + ((getSecretArn() == null) ? 0 : getSecretArn().hashCode()); hashCode = prime * hashCode + ((getSql() == null) ? 0 : getSql().hashCode()); hashCode = prime * hashCode + ((getDatabase() == null) ? 0 : getDatabase().hashCode()); hashCode = prime * hashCode + ((getSchema() == null) ? 0 : getSchema().hashCode()); hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode()); hashCode = prime * hashCode + ((getTransactionId() == null) ? 0 : getTransactionId().hashCode()); hashCode = prime * hashCode + ((getIncludeResultMetadata() == null) ? 0 : getIncludeResultMetadata().hashCode()); hashCode = prime * hashCode + ((getContinueAfterTimeout() == null) ? 0 : getContinueAfterTimeout().hashCode()); hashCode = prime * hashCode + ((getResultSetOptions() == null) ? 0 : getResultSetOptions().hashCode()); hashCode = prime * hashCode + ((getFormatRecordsAs() == null) ? 0 : getFormatRecordsAs().hashCode()); return hashCode; } @Override public ExecuteStatementRequest clone() { return (ExecuteStatementRequest) super.clone(); } }