use std::fmt::Write;
pub mod batch_execute_statement_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
pub(crate) secret_arn: std::option::Option<std::string::String>,
pub(crate) sql: std::option::Option<std::string::String>,
pub(crate) database: std::option::Option<std::string::String>,
pub(crate) schema: std::option::Option<std::string::String>,
pub(crate) parameter_sets:
std::option::Option<std::vec::Vec<std::vec::Vec<crate::model::SqlParameter>>>,
pub(crate) transaction_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn secret_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.secret_arn = Some(input.into());
self
}
pub fn set_secret_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.secret_arn = input;
self
}
pub fn sql(mut self, input: impl Into<std::string::String>) -> Self {
self.sql = Some(input.into());
self
}
pub fn set_sql(mut self, input: std::option::Option<std::string::String>) -> Self {
self.sql = input;
self
}
pub fn database(mut self, input: impl Into<std::string::String>) -> Self {
self.database = Some(input.into());
self
}
pub fn set_database(mut self, input: std::option::Option<std::string::String>) -> Self {
self.database = input;
self
}
pub fn schema(mut self, input: impl Into<std::string::String>) -> Self {
self.schema = Some(input.into());
self
}
pub fn set_schema(mut self, input: std::option::Option<std::string::String>) -> Self {
self.schema = input;
self
}
pub fn parameter_sets(mut self, input: std::vec::Vec<crate::model::SqlParameter>) -> Self {
let mut v = self.parameter_sets.unwrap_or_default();
v.push(input);
self.parameter_sets = Some(v);
self
}
pub fn set_parameter_sets(
mut self,
input: std::option::Option<std::vec::Vec<std::vec::Vec<crate::model::SqlParameter>>>,
) -> Self {
self.parameter_sets = input;
self
}
pub fn transaction_id(mut self, input: impl Into<std::string::String>) -> Self {
self.transaction_id = Some(input.into());
self
}
pub fn set_transaction_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.transaction_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::BatchExecuteStatementInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::BatchExecuteStatementInput {
resource_arn: self.resource_arn,
secret_arn: self.secret_arn,
sql: self.sql,
database: self.database,
schema: self.schema,
parameter_sets: self.parameter_sets,
transaction_id: self.transaction_id,
})
}
}
}
impl BatchExecuteStatementInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::BatchExecuteStatement,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::BatchExecuteStatementInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/BatchExecute").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::BatchExecuteStatementInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_batch_execute_statement(
&self,
)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::BatchExecuteStatement::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"BatchExecuteStatement",
"rdsdata",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::batch_execute_statement_input::Builder {
crate::input::batch_execute_statement_input::Builder::default()
}
}
pub mod begin_transaction_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
pub(crate) secret_arn: std::option::Option<std::string::String>,
pub(crate) database: std::option::Option<std::string::String>,
pub(crate) schema: std::option::Option<std::string::String>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn secret_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.secret_arn = Some(input.into());
self
}
pub fn set_secret_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.secret_arn = input;
self
}
pub fn database(mut self, input: impl Into<std::string::String>) -> Self {
self.database = Some(input.into());
self
}
pub fn set_database(mut self, input: std::option::Option<std::string::String>) -> Self {
self.database = input;
self
}
pub fn schema(mut self, input: impl Into<std::string::String>) -> Self {
self.schema = Some(input.into());
self
}
pub fn set_schema(mut self, input: std::option::Option<std::string::String>) -> Self {
self.schema = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::BeginTransactionInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::BeginTransactionInput {
resource_arn: self.resource_arn,
secret_arn: self.secret_arn,
database: self.database,
schema: self.schema,
})
}
}
}
impl BeginTransactionInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::BeginTransaction,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::BeginTransactionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/BeginTransaction").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::BeginTransactionInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_begin_transaction(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::BeginTransaction::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"BeginTransaction",
"rdsdata",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::begin_transaction_input::Builder {
crate::input::begin_transaction_input::Builder::default()
}
}
pub mod commit_transaction_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
pub(crate) secret_arn: std::option::Option<std::string::String>,
pub(crate) transaction_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn secret_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.secret_arn = Some(input.into());
self
}
pub fn set_secret_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.secret_arn = input;
self
}
pub fn transaction_id(mut self, input: impl Into<std::string::String>) -> Self {
self.transaction_id = Some(input.into());
self
}
pub fn set_transaction_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.transaction_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::CommitTransactionInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::CommitTransactionInput {
resource_arn: self.resource_arn,
secret_arn: self.secret_arn,
transaction_id: self.transaction_id,
})
}
}
}
impl CommitTransactionInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CommitTransaction,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::CommitTransactionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/CommitTransaction").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CommitTransactionInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_commit_transaction(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::CommitTransaction::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CommitTransaction",
"rdsdata",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::commit_transaction_input::Builder {
crate::input::commit_transaction_input::Builder::default()
}
}
pub mod execute_sql_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) db_cluster_or_instance_arn: std::option::Option<std::string::String>,
pub(crate) aws_secret_store_arn: std::option::Option<std::string::String>,
pub(crate) sql_statements: std::option::Option<std::string::String>,
pub(crate) database: std::option::Option<std::string::String>,
pub(crate) schema: std::option::Option<std::string::String>,
}
impl Builder {
pub fn db_cluster_or_instance_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.db_cluster_or_instance_arn = Some(input.into());
self
}
pub fn set_db_cluster_or_instance_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.db_cluster_or_instance_arn = input;
self
}
pub fn aws_secret_store_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.aws_secret_store_arn = Some(input.into());
self
}
pub fn set_aws_secret_store_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.aws_secret_store_arn = input;
self
}
pub fn sql_statements(mut self, input: impl Into<std::string::String>) -> Self {
self.sql_statements = Some(input.into());
self
}
pub fn set_sql_statements(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.sql_statements = input;
self
}
pub fn database(mut self, input: impl Into<std::string::String>) -> Self {
self.database = Some(input.into());
self
}
pub fn set_database(mut self, input: std::option::Option<std::string::String>) -> Self {
self.database = input;
self
}
pub fn schema(mut self, input: impl Into<std::string::String>) -> Self {
self.schema = Some(input.into());
self
}
pub fn set_schema(mut self, input: std::option::Option<std::string::String>) -> Self {
self.schema = input;
self
}
pub fn build(
self,
) -> Result<crate::input::ExecuteSqlInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::ExecuteSqlInput {
db_cluster_or_instance_arn: self.db_cluster_or_instance_arn,
aws_secret_store_arn: self.aws_secret_store_arn,
sql_statements: self.sql_statements,
database: self.database,
schema: self.schema,
})
}
}
}
impl ExecuteSqlInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::ExecuteSql,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::ExecuteSqlInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/ExecuteSql").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ExecuteSqlInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_execute_sql(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::ExecuteSql::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ExecuteSql",
"rdsdata",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::execute_sql_input::Builder {
crate::input::execute_sql_input::Builder::default()
}
}
pub mod execute_statement_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
pub(crate) secret_arn: std::option::Option<std::string::String>,
pub(crate) sql: std::option::Option<std::string::String>,
pub(crate) database: std::option::Option<std::string::String>,
pub(crate) schema: std::option::Option<std::string::String>,
pub(crate) parameters: std::option::Option<std::vec::Vec<crate::model::SqlParameter>>,
pub(crate) transaction_id: std::option::Option<std::string::String>,
pub(crate) include_result_metadata: std::option::Option<bool>,
pub(crate) continue_after_timeout: std::option::Option<bool>,
pub(crate) result_set_options: std::option::Option<crate::model::ResultSetOptions>,
pub(crate) format_records_as: std::option::Option<crate::model::RecordsFormatType>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn secret_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.secret_arn = Some(input.into());
self
}
pub fn set_secret_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.secret_arn = input;
self
}
pub fn sql(mut self, input: impl Into<std::string::String>) -> Self {
self.sql = Some(input.into());
self
}
pub fn set_sql(mut self, input: std::option::Option<std::string::String>) -> Self {
self.sql = input;
self
}
pub fn database(mut self, input: impl Into<std::string::String>) -> Self {
self.database = Some(input.into());
self
}
pub fn set_database(mut self, input: std::option::Option<std::string::String>) -> Self {
self.database = input;
self
}
pub fn schema(mut self, input: impl Into<std::string::String>) -> Self {
self.schema = Some(input.into());
self
}
pub fn set_schema(mut self, input: std::option::Option<std::string::String>) -> Self {
self.schema = input;
self
}
pub fn parameters(mut self, input: crate::model::SqlParameter) -> Self {
let mut v = self.parameters.unwrap_or_default();
v.push(input);
self.parameters = Some(v);
self
}
pub fn set_parameters(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SqlParameter>>,
) -> Self {
self.parameters = input;
self
}
pub fn transaction_id(mut self, input: impl Into<std::string::String>) -> Self {
self.transaction_id = Some(input.into());
self
}
pub fn set_transaction_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.transaction_id = input;
self
}
pub fn include_result_metadata(mut self, input: bool) -> Self {
self.include_result_metadata = Some(input);
self
}
pub fn set_include_result_metadata(mut self, input: std::option::Option<bool>) -> Self {
self.include_result_metadata = input;
self
}
pub fn continue_after_timeout(mut self, input: bool) -> Self {
self.continue_after_timeout = Some(input);
self
}
pub fn set_continue_after_timeout(mut self, input: std::option::Option<bool>) -> Self {
self.continue_after_timeout = input;
self
}
pub fn result_set_options(mut self, input: crate::model::ResultSetOptions) -> Self {
self.result_set_options = Some(input);
self
}
pub fn set_result_set_options(
mut self,
input: std::option::Option<crate::model::ResultSetOptions>,
) -> Self {
self.result_set_options = input;
self
}
pub fn format_records_as(mut self, input: crate::model::RecordsFormatType) -> Self {
self.format_records_as = Some(input);
self
}
pub fn set_format_records_as(
mut self,
input: std::option::Option<crate::model::RecordsFormatType>,
) -> Self {
self.format_records_as = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::ExecuteStatementInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::ExecuteStatementInput {
resource_arn: self.resource_arn,
secret_arn: self.secret_arn,
sql: self.sql,
database: self.database,
schema: self.schema,
parameters: self.parameters,
transaction_id: self.transaction_id,
include_result_metadata: self.include_result_metadata.unwrap_or_default(),
continue_after_timeout: self.continue_after_timeout.unwrap_or_default(),
result_set_options: self.result_set_options,
format_records_as: self.format_records_as,
})
}
}
}
impl ExecuteStatementInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::ExecuteStatement,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::ExecuteStatementInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/Execute").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ExecuteStatementInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_execute_statement(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::ExecuteStatement::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ExecuteStatement",
"rdsdata",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::execute_statement_input::Builder {
crate::input::execute_statement_input::Builder::default()
}
}
pub mod rollback_transaction_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
pub(crate) secret_arn: std::option::Option<std::string::String>,
pub(crate) transaction_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn secret_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.secret_arn = Some(input.into());
self
}
pub fn set_secret_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.secret_arn = input;
self
}
pub fn transaction_id(mut self, input: impl Into<std::string::String>) -> Self {
self.transaction_id = Some(input.into());
self
}
pub fn set_transaction_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.transaction_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::RollbackTransactionInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::RollbackTransactionInput {
resource_arn: self.resource_arn,
secret_arn: self.secret_arn,
transaction_id: self.transaction_id,
})
}
}
}
impl RollbackTransactionInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::RollbackTransaction,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::RollbackTransactionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/RollbackTransaction").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::RollbackTransactionInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_rollback_transaction(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::RollbackTransaction::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"RollbackTransaction",
"rdsdata",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::rollback_transaction_input::Builder {
crate::input::rollback_transaction_input::Builder::default()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct RollbackTransactionInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub secret_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub transaction_id: std::option::Option<std::string::String>,
}
impl RollbackTransactionInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn secret_arn(&self) -> std::option::Option<&str> {
self.secret_arn.as_deref()
}
pub fn transaction_id(&self) -> std::option::Option<&str> {
self.transaction_id.as_deref()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ExecuteStatementInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub secret_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub sql: std::option::Option<std::string::String>,
#[doc(hidden)]
pub database: std::option::Option<std::string::String>,
#[doc(hidden)]
pub schema: std::option::Option<std::string::String>,
#[doc(hidden)]
pub parameters: std::option::Option<std::vec::Vec<crate::model::SqlParameter>>,
#[doc(hidden)]
pub transaction_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub include_result_metadata: bool,
#[doc(hidden)]
pub continue_after_timeout: bool,
#[doc(hidden)]
pub result_set_options: std::option::Option<crate::model::ResultSetOptions>,
#[doc(hidden)]
pub format_records_as: std::option::Option<crate::model::RecordsFormatType>,
}
impl ExecuteStatementInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn secret_arn(&self) -> std::option::Option<&str> {
self.secret_arn.as_deref()
}
pub fn sql(&self) -> std::option::Option<&str> {
self.sql.as_deref()
}
pub fn database(&self) -> std::option::Option<&str> {
self.database.as_deref()
}
pub fn schema(&self) -> std::option::Option<&str> {
self.schema.as_deref()
}
pub fn parameters(&self) -> std::option::Option<&[crate::model::SqlParameter]> {
self.parameters.as_deref()
}
pub fn transaction_id(&self) -> std::option::Option<&str> {
self.transaction_id.as_deref()
}
pub fn include_result_metadata(&self) -> bool {
self.include_result_metadata
}
pub fn continue_after_timeout(&self) -> bool {
self.continue_after_timeout
}
pub fn result_set_options(&self) -> std::option::Option<&crate::model::ResultSetOptions> {
self.result_set_options.as_ref()
}
pub fn format_records_as(&self) -> std::option::Option<&crate::model::RecordsFormatType> {
self.format_records_as.as_ref()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ExecuteSqlInput {
#[doc(hidden)]
pub db_cluster_or_instance_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub aws_secret_store_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub sql_statements: std::option::Option<std::string::String>,
#[doc(hidden)]
pub database: std::option::Option<std::string::String>,
#[doc(hidden)]
pub schema: std::option::Option<std::string::String>,
}
impl ExecuteSqlInput {
pub fn db_cluster_or_instance_arn(&self) -> std::option::Option<&str> {
self.db_cluster_or_instance_arn.as_deref()
}
pub fn aws_secret_store_arn(&self) -> std::option::Option<&str> {
self.aws_secret_store_arn.as_deref()
}
pub fn sql_statements(&self) -> std::option::Option<&str> {
self.sql_statements.as_deref()
}
pub fn database(&self) -> std::option::Option<&str> {
self.database.as_deref()
}
pub fn schema(&self) -> std::option::Option<&str> {
self.schema.as_deref()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CommitTransactionInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub secret_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub transaction_id: std::option::Option<std::string::String>,
}
impl CommitTransactionInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn secret_arn(&self) -> std::option::Option<&str> {
self.secret_arn.as_deref()
}
pub fn transaction_id(&self) -> std::option::Option<&str> {
self.transaction_id.as_deref()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct BeginTransactionInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub secret_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub database: std::option::Option<std::string::String>,
#[doc(hidden)]
pub schema: std::option::Option<std::string::String>,
}
impl BeginTransactionInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn secret_arn(&self) -> std::option::Option<&str> {
self.secret_arn.as_deref()
}
pub fn database(&self) -> std::option::Option<&str> {
self.database.as_deref()
}
pub fn schema(&self) -> std::option::Option<&str> {
self.schema.as_deref()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct BatchExecuteStatementInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub secret_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub sql: std::option::Option<std::string::String>,
#[doc(hidden)]
pub database: std::option::Option<std::string::String>,
#[doc(hidden)]
pub schema: std::option::Option<std::string::String>,
#[doc(hidden)]
pub parameter_sets:
std::option::Option<std::vec::Vec<std::vec::Vec<crate::model::SqlParameter>>>,
#[doc(hidden)]
pub transaction_id: std::option::Option<std::string::String>,
}
impl BatchExecuteStatementInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn secret_arn(&self) -> std::option::Option<&str> {
self.secret_arn.as_deref()
}
pub fn sql(&self) -> std::option::Option<&str> {
self.sql.as_deref()
}
pub fn database(&self) -> std::option::Option<&str> {
self.database.as_deref()
}
pub fn schema(&self) -> std::option::Option<&str> {
self.schema.as_deref()
}
pub fn parameter_sets(
&self,
) -> std::option::Option<&[std::vec::Vec<crate::model::SqlParameter>]> {
self.parameter_sets.as_deref()
}
pub fn transaction_id(&self) -> std::option::Option<&str> {
self.transaction_id.as_deref()
}
}