use std::fmt::Write;
pub mod create_assistant_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) client_token: std::option::Option<std::string::String>,
pub(crate) name: std::option::Option<std::string::String>,
pub(crate) r#type: std::option::Option<crate::model::AssistantType>,
pub(crate) description: std::option::Option<std::string::String>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) server_side_encryption_configuration:
std::option::Option<crate::model::ServerSideEncryptionConfiguration>,
}
impl Builder {
pub fn client_token(mut self, input: impl Into<std::string::String>) -> Self {
self.client_token = Some(input.into());
self
}
pub fn set_client_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_token = input;
self
}
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.name = Some(input.into());
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.name = input;
self
}
pub fn r#type(mut self, input: crate::model::AssistantType) -> Self {
self.r#type = Some(input);
self
}
pub fn set_type(mut self, input: std::option::Option<crate::model::AssistantType>) -> Self {
self.r#type = input;
self
}
pub fn description(mut self, input: impl Into<std::string::String>) -> Self {
self.description = Some(input.into());
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.description = input;
self
}
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn server_side_encryption_configuration(
mut self,
input: crate::model::ServerSideEncryptionConfiguration,
) -> Self {
self.server_side_encryption_configuration = Some(input);
self
}
pub fn set_server_side_encryption_configuration(
mut self,
input: std::option::Option<crate::model::ServerSideEncryptionConfiguration>,
) -> Self {
self.server_side_encryption_configuration = input;
self
}
pub fn build(
self,
) -> Result<crate::input::CreateAssistantInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::CreateAssistantInput {
client_token: self.client_token,
name: self.name,
r#type: self.r#type,
description: self.description,
tags: self.tags,
server_side_encryption_configuration: self.server_side_encryption_configuration,
})
}
}
}
impl CreateAssistantInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
mut self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateAssistant,
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),
};
if self.client_token.is_none() {
self.client_token = Some(_config.make_token.make_idempotency_token());
}
let mut request = {
fn uri_base(
_input: &crate::input::CreateAssistantInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/assistants").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateAssistantInput,
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_create_assistant(&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::CreateAssistant::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateAssistant",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_assistant_input::Builder {
crate::input::create_assistant_input::Builder::default()
}
}
pub mod create_assistant_association_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_id: std::option::Option<std::string::String>,
pub(crate) association_type: std::option::Option<crate::model::AssociationType>,
pub(crate) association: std::option::Option<crate::model::AssistantAssociationInputData>,
pub(crate) client_token: std::option::Option<std::string::String>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn association_type(mut self, input: crate::model::AssociationType) -> Self {
self.association_type = Some(input);
self
}
pub fn set_association_type(
mut self,
input: std::option::Option<crate::model::AssociationType>,
) -> Self {
self.association_type = input;
self
}
pub fn association(mut self, input: crate::model::AssistantAssociationInputData) -> Self {
self.association = Some(input);
self
}
pub fn set_association(
mut self,
input: std::option::Option<crate::model::AssistantAssociationInputData>,
) -> Self {
self.association = input;
self
}
pub fn client_token(mut self, input: impl Into<std::string::String>) -> Self {
self.client_token = Some(input.into());
self
}
pub fn set_client_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_token = input;
self
}
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::CreateAssistantAssociationInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::CreateAssistantAssociationInput {
assistant_id: self.assistant_id,
association_type: self.association_type,
association: self.association,
client_token: self.client_token,
tags: self.tags,
})
}
}
}
impl CreateAssistantAssociationInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
mut self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateAssistantAssociation,
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),
};
if self.client_token.is_none() {
self.client_token = Some(_config.make_token.make_idempotency_token());
}
let mut request = {
fn uri_base(
_input: &crate::input::CreateAssistantAssociationInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_1 = &_input.assistant_id;
let input_1 = input_1.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_1,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/associations",
assistantId = assistant_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateAssistantAssociationInput,
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_create_assistant_association(
&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::CreateAssistantAssociation::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateAssistantAssociation",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_assistant_association_input::Builder {
crate::input::create_assistant_association_input::Builder::default()
}
}
pub mod create_content_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
pub(crate) name: std::option::Option<std::string::String>,
pub(crate) title: std::option::Option<std::string::String>,
pub(crate) override_link_out_uri: std::option::Option<std::string::String>,
pub(crate) metadata: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) upload_id: std::option::Option<std::string::String>,
pub(crate) client_token: std::option::Option<std::string::String>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.name = Some(input.into());
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.name = input;
self
}
pub fn title(mut self, input: impl Into<std::string::String>) -> Self {
self.title = Some(input.into());
self
}
pub fn set_title(mut self, input: std::option::Option<std::string::String>) -> Self {
self.title = input;
self
}
pub fn override_link_out_uri(mut self, input: impl Into<std::string::String>) -> Self {
self.override_link_out_uri = Some(input.into());
self
}
pub fn set_override_link_out_uri(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.override_link_out_uri = input;
self
}
pub fn metadata(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.metadata.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.metadata = Some(hash_map);
self
}
pub fn set_metadata(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.metadata = input;
self
}
pub fn upload_id(mut self, input: impl Into<std::string::String>) -> Self {
self.upload_id = Some(input.into());
self
}
pub fn set_upload_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.upload_id = input;
self
}
pub fn client_token(mut self, input: impl Into<std::string::String>) -> Self {
self.client_token = Some(input.into());
self
}
pub fn set_client_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_token = input;
self
}
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn build(
self,
) -> Result<crate::input::CreateContentInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::CreateContentInput {
knowledge_base_id: self.knowledge_base_id,
name: self.name,
title: self.title,
override_link_out_uri: self.override_link_out_uri,
metadata: self.metadata,
upload_id: self.upload_id,
client_token: self.client_token,
tags: self.tags,
})
}
}
}
impl CreateContentInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
mut self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateContent,
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),
};
if self.client_token.is_none() {
self.client_token = Some(_config.make_token.make_idempotency_token());
}
let mut request = {
fn uri_base(
_input: &crate::input::CreateContentInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_2 = &_input.knowledge_base_id;
let input_2 = input_2.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_2,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/contents",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateContentInput,
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_create_content(&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::CreateContent::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateContent",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_content_input::Builder {
crate::input::create_content_input::Builder::default()
}
}
pub mod create_knowledge_base_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) client_token: std::option::Option<std::string::String>,
pub(crate) name: std::option::Option<std::string::String>,
pub(crate) knowledge_base_type: std::option::Option<crate::model::KnowledgeBaseType>,
pub(crate) source_configuration: std::option::Option<crate::model::SourceConfiguration>,
pub(crate) rendering_configuration:
std::option::Option<crate::model::RenderingConfiguration>,
pub(crate) server_side_encryption_configuration:
std::option::Option<crate::model::ServerSideEncryptionConfiguration>,
pub(crate) description: std::option::Option<std::string::String>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
pub fn client_token(mut self, input: impl Into<std::string::String>) -> Self {
self.client_token = Some(input.into());
self
}
pub fn set_client_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_token = input;
self
}
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.name = Some(input.into());
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.name = input;
self
}
pub fn knowledge_base_type(mut self, input: crate::model::KnowledgeBaseType) -> Self {
self.knowledge_base_type = Some(input);
self
}
pub fn set_knowledge_base_type(
mut self,
input: std::option::Option<crate::model::KnowledgeBaseType>,
) -> Self {
self.knowledge_base_type = input;
self
}
pub fn source_configuration(mut self, input: crate::model::SourceConfiguration) -> Self {
self.source_configuration = Some(input);
self
}
pub fn set_source_configuration(
mut self,
input: std::option::Option<crate::model::SourceConfiguration>,
) -> Self {
self.source_configuration = input;
self
}
pub fn rendering_configuration(
mut self,
input: crate::model::RenderingConfiguration,
) -> Self {
self.rendering_configuration = Some(input);
self
}
pub fn set_rendering_configuration(
mut self,
input: std::option::Option<crate::model::RenderingConfiguration>,
) -> Self {
self.rendering_configuration = input;
self
}
pub fn server_side_encryption_configuration(
mut self,
input: crate::model::ServerSideEncryptionConfiguration,
) -> Self {
self.server_side_encryption_configuration = Some(input);
self
}
pub fn set_server_side_encryption_configuration(
mut self,
input: std::option::Option<crate::model::ServerSideEncryptionConfiguration>,
) -> Self {
self.server_side_encryption_configuration = input;
self
}
pub fn description(mut self, input: impl Into<std::string::String>) -> Self {
self.description = Some(input.into());
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.description = input;
self
}
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::CreateKnowledgeBaseInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::CreateKnowledgeBaseInput {
client_token: self.client_token,
name: self.name,
knowledge_base_type: self.knowledge_base_type,
source_configuration: self.source_configuration,
rendering_configuration: self.rendering_configuration,
server_side_encryption_configuration: self.server_side_encryption_configuration,
description: self.description,
tags: self.tags,
})
}
}
}
impl CreateKnowledgeBaseInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
mut self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateKnowledgeBase,
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),
};
if self.client_token.is_none() {
self.client_token = Some(_config.make_token.make_idempotency_token());
}
let mut request = {
fn uri_base(
_input: &crate::input::CreateKnowledgeBaseInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/knowledgeBases").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateKnowledgeBaseInput,
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_create_knowledge_base(&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::CreateKnowledgeBase::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateKnowledgeBase",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_knowledge_base_input::Builder {
crate::input::create_knowledge_base_input::Builder::default()
}
}
pub mod create_session_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) client_token: std::option::Option<std::string::String>,
pub(crate) assistant_id: std::option::Option<std::string::String>,
pub(crate) name: std::option::Option<std::string::String>,
pub(crate) description: std::option::Option<std::string::String>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
pub fn client_token(mut self, input: impl Into<std::string::String>) -> Self {
self.client_token = Some(input.into());
self
}
pub fn set_client_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_token = input;
self
}
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.name = Some(input.into());
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.name = input;
self
}
pub fn description(mut self, input: impl Into<std::string::String>) -> Self {
self.description = Some(input.into());
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.description = input;
self
}
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn build(
self,
) -> Result<crate::input::CreateSessionInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::CreateSessionInput {
client_token: self.client_token,
assistant_id: self.assistant_id,
name: self.name,
description: self.description,
tags: self.tags,
})
}
}
}
impl CreateSessionInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
mut self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateSession,
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),
};
if self.client_token.is_none() {
self.client_token = Some(_config.make_token.make_idempotency_token());
}
let mut request = {
fn uri_base(
_input: &crate::input::CreateSessionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_3 = &_input.assistant_id;
let input_3 = input_3.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_3,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/sessions",
assistantId = assistant_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateSessionInput,
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_create_session(&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::CreateSession::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateSession",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_session_input::Builder {
crate::input::create_session_input::Builder::default()
}
}
pub mod delete_assistant_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::DeleteAssistantInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::DeleteAssistantInput {
assistant_id: self.assistant_id,
})
}
}
}
impl DeleteAssistantInput {
#[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::DeleteAssistant,
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::DeleteAssistantInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_4 = &_input.assistant_id;
let input_4 = input_4.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_4,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}",
assistantId = assistant_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteAssistantInput,
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("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::DeleteAssistant::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteAssistant",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_assistant_input::Builder {
crate::input::delete_assistant_input::Builder::default()
}
}
pub mod delete_assistant_association_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_association_id: std::option::Option<std::string::String>,
pub(crate) assistant_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn assistant_association_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_association_id = Some(input.into());
self
}
pub fn set_assistant_association_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.assistant_association_id = input;
self
}
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::DeleteAssistantAssociationInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DeleteAssistantAssociationInput {
assistant_association_id: self.assistant_association_id,
assistant_id: self.assistant_id,
})
}
}
}
impl DeleteAssistantAssociationInput {
#[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::DeleteAssistantAssociation,
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::DeleteAssistantAssociationInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_5 = &_input.assistant_id;
let input_5 = input_5.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_5,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
let input_6 = &_input.assistant_association_id;
let input_6 = input_6.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_association_id",
"cannot be empty or unset",
)
})?;
let assistant_association_id = aws_smithy_http::label::fmt_string(
input_6,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_association_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_association_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/associations/{assistantAssociationId}",
assistantId = assistant_id,
assistantAssociationId = assistant_association_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteAssistantAssociationInput,
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("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::DeleteAssistantAssociation::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteAssistantAssociation",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_assistant_association_input::Builder {
crate::input::delete_assistant_association_input::Builder::default()
}
}
pub mod delete_content_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
pub(crate) content_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn content_id(mut self, input: impl Into<std::string::String>) -> Self {
self.content_id = Some(input.into());
self
}
pub fn set_content_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.content_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::DeleteContentInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::DeleteContentInput {
knowledge_base_id: self.knowledge_base_id,
content_id: self.content_id,
})
}
}
}
impl DeleteContentInput {
#[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::DeleteContent,
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::DeleteContentInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_7 = &_input.knowledge_base_id;
let input_7 = input_7.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_7,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
let input_8 = &_input.content_id;
let input_8 = input_8.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
)
})?;
let content_id = aws_smithy_http::label::fmt_string(
input_8,
aws_smithy_http::label::EncodingStrategy::Default,
);
if content_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/contents/{contentId}",
knowledgeBaseId = knowledge_base_id,
contentId = content_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteContentInput,
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("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::DeleteContent::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteContent",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_content_input::Builder {
crate::input::delete_content_input::Builder::default()
}
}
pub mod delete_knowledge_base_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::DeleteKnowledgeBaseInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DeleteKnowledgeBaseInput {
knowledge_base_id: self.knowledge_base_id,
})
}
}
}
impl DeleteKnowledgeBaseInput {
#[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::DeleteKnowledgeBase,
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::DeleteKnowledgeBaseInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_9 = &_input.knowledge_base_id;
let input_9 = input_9.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_9,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteKnowledgeBaseInput,
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("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::DeleteKnowledgeBase::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteKnowledgeBase",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_knowledge_base_input::Builder {
crate::input::delete_knowledge_base_input::Builder::default()
}
}
pub mod get_assistant_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::GetAssistantInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::GetAssistantInput {
assistant_id: self.assistant_id,
})
}
}
}
impl GetAssistantInput {
#[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::GetAssistant,
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::GetAssistantInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_10 = &_input.assistant_id;
let input_10 = input_10.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_10,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}",
assistantId = assistant_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetAssistantInput,
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("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::GetAssistant::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetAssistant",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_assistant_input::Builder {
crate::input::get_assistant_input::Builder::default()
}
}
pub mod get_assistant_association_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_association_id: std::option::Option<std::string::String>,
pub(crate) assistant_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn assistant_association_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_association_id = Some(input.into());
self
}
pub fn set_assistant_association_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.assistant_association_id = input;
self
}
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::GetAssistantAssociationInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::GetAssistantAssociationInput {
assistant_association_id: self.assistant_association_id,
assistant_id: self.assistant_id,
})
}
}
}
impl GetAssistantAssociationInput {
#[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::GetAssistantAssociation,
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::GetAssistantAssociationInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_11 = &_input.assistant_id;
let input_11 = input_11.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_11,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
let input_12 = &_input.assistant_association_id;
let input_12 = input_12.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_association_id",
"cannot be empty or unset",
)
})?;
let assistant_association_id = aws_smithy_http::label::fmt_string(
input_12,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_association_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_association_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/associations/{assistantAssociationId}",
assistantId = assistant_id,
assistantAssociationId = assistant_association_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetAssistantAssociationInput,
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("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::GetAssistantAssociation::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetAssistantAssociation",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_assistant_association_input::Builder {
crate::input::get_assistant_association_input::Builder::default()
}
}
pub mod get_content_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) content_id: std::option::Option<std::string::String>,
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn content_id(mut self, input: impl Into<std::string::String>) -> Self {
self.content_id = Some(input.into());
self
}
pub fn set_content_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.content_id = input;
self
}
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::GetContentInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::GetContentInput {
content_id: self.content_id,
knowledge_base_id: self.knowledge_base_id,
})
}
}
}
impl GetContentInput {
#[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::GetContent,
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::GetContentInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_13 = &_input.knowledge_base_id;
let input_13 = input_13.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_13,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
let input_14 = &_input.content_id;
let input_14 = input_14.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
)
})?;
let content_id = aws_smithy_http::label::fmt_string(
input_14,
aws_smithy_http::label::EncodingStrategy::Default,
);
if content_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/contents/{contentId}",
knowledgeBaseId = knowledge_base_id,
contentId = content_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetContentInput,
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("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::GetContent::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetContent",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_content_input::Builder {
crate::input::get_content_input::Builder::default()
}
}
pub mod get_content_summary_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) content_id: std::option::Option<std::string::String>,
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn content_id(mut self, input: impl Into<std::string::String>) -> Self {
self.content_id = Some(input.into());
self
}
pub fn set_content_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.content_id = input;
self
}
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::GetContentSummaryInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::GetContentSummaryInput {
content_id: self.content_id,
knowledge_base_id: self.knowledge_base_id,
})
}
}
}
impl GetContentSummaryInput {
#[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::GetContentSummary,
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::GetContentSummaryInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_15 = &_input.knowledge_base_id;
let input_15 = input_15.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_15,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
let input_16 = &_input.content_id;
let input_16 = input_16.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
)
})?;
let content_id = aws_smithy_http::label::fmt_string(
input_16,
aws_smithy_http::label::EncodingStrategy::Default,
);
if content_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/contents/{contentId}/summary",
knowledgeBaseId = knowledge_base_id,
contentId = content_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetContentSummaryInput,
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("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::GetContentSummary::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetContentSummary",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_content_summary_input::Builder {
crate::input::get_content_summary_input::Builder::default()
}
}
pub mod get_knowledge_base_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::GetKnowledgeBaseInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::GetKnowledgeBaseInput {
knowledge_base_id: self.knowledge_base_id,
})
}
}
}
impl GetKnowledgeBaseInput {
#[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::GetKnowledgeBase,
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::GetKnowledgeBaseInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_17 = &_input.knowledge_base_id;
let input_17 = input_17.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_17,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetKnowledgeBaseInput,
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("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::GetKnowledgeBase::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetKnowledgeBase",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_knowledge_base_input::Builder {
crate::input::get_knowledge_base_input::Builder::default()
}
}
pub mod get_recommendations_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) wait_time_seconds: std::option::Option<i32>,
}
impl Builder {
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn wait_time_seconds(mut self, input: i32) -> Self {
self.wait_time_seconds = Some(input);
self
}
pub fn set_wait_time_seconds(mut self, input: std::option::Option<i32>) -> Self {
self.wait_time_seconds = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::GetRecommendationsInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::GetRecommendationsInput {
assistant_id: self.assistant_id,
session_id: self.session_id,
max_results: self.max_results,
wait_time_seconds: self.wait_time_seconds.unwrap_or_default(),
})
}
}
}
impl GetRecommendationsInput {
#[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::GetRecommendations,
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::GetRecommendationsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_18 = &_input.assistant_id;
let input_18 = input_18.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_18,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
let input_19 = &_input.session_id;
let input_19 = input_19.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_19,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/sessions/{sessionId}/recommendations",
assistantId = assistant_id,
sessionId = session_id
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::GetRecommendationsInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_20) = &_input.max_results {
if *inner_20 != 0 {
query.push_kv(
"maxResults",
aws_smithy_types::primitive::Encoder::from(*inner_20).encode(),
);
}
}
if _input.wait_time_seconds != 0 {
query.push_kv(
"waitTimeSeconds",
aws_smithy_types::primitive::Encoder::from(_input.wait_time_seconds)
.encode(),
);
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetRecommendationsInput,
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)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::GetRecommendations::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetRecommendations",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_recommendations_input::Builder {
crate::input::get_recommendations_input::Builder::default()
}
}
pub mod get_session_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::GetSessionInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::GetSessionInput {
assistant_id: self.assistant_id,
session_id: self.session_id,
})
}
}
}
impl GetSessionInput {
#[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::GetSession,
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::GetSessionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_21 = &_input.assistant_id;
let input_21 = input_21.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_21,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
let input_22 = &_input.session_id;
let input_22 = input_22.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_22,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/sessions/{sessionId}",
assistantId = assistant_id,
sessionId = session_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetSessionInput,
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("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::GetSession::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetSession",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_session_input::Builder {
crate::input::get_session_input::Builder::default()
}
}
pub mod list_assistant_associations_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) assistant_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::ListAssistantAssociationsInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::ListAssistantAssociationsInput {
next_token: self.next_token,
max_results: self.max_results,
assistant_id: self.assistant_id,
})
}
}
}
impl ListAssistantAssociationsInput {
#[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::ListAssistantAssociations,
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::ListAssistantAssociationsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_23 = &_input.assistant_id;
let input_23 = input_23.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_23,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/associations",
assistantId = assistant_id
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::ListAssistantAssociationsInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_24) = &_input.next_token {
{
query.push_kv("nextToken", &aws_smithy_http::query::fmt_string(&inner_24));
}
}
if let Some(inner_25) = &_input.max_results {
if *inner_25 != 0 {
query.push_kv(
"maxResults",
aws_smithy_types::primitive::Encoder::from(*inner_25).encode(),
);
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListAssistantAssociationsInput,
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)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::ListAssistantAssociations::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListAssistantAssociations",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_assistant_associations_input::Builder {
crate::input::list_assistant_associations_input::Builder::default()
}
}
pub mod list_assistants_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
}
impl Builder {
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn build(
self,
) -> Result<crate::input::ListAssistantsInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::ListAssistantsInput {
next_token: self.next_token,
max_results: self.max_results,
})
}
}
}
impl ListAssistantsInput {
#[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::ListAssistants,
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::ListAssistantsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/assistants").expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::ListAssistantsInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_26) = &_input.next_token {
{
query.push_kv("nextToken", &aws_smithy_http::query::fmt_string(&inner_26));
}
}
if let Some(inner_27) = &_input.max_results {
if *inner_27 != 0 {
query.push_kv(
"maxResults",
aws_smithy_types::primitive::Encoder::from(*inner_27).encode(),
);
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListAssistantsInput,
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)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::ListAssistants::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListAssistants",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_assistants_input::Builder {
crate::input::list_assistants_input::Builder::default()
}
}
pub mod list_contents_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::ListContentsInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::ListContentsInput {
next_token: self.next_token,
max_results: self.max_results,
knowledge_base_id: self.knowledge_base_id,
})
}
}
}
impl ListContentsInput {
#[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::ListContents,
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::ListContentsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_28 = &_input.knowledge_base_id;
let input_28 = input_28.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_28,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/contents",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::ListContentsInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_29) = &_input.next_token {
{
query.push_kv("nextToken", &aws_smithy_http::query::fmt_string(&inner_29));
}
}
if let Some(inner_30) = &_input.max_results {
if *inner_30 != 0 {
query.push_kv(
"maxResults",
aws_smithy_types::primitive::Encoder::from(*inner_30).encode(),
);
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListContentsInput,
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)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::ListContents::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListContents",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_contents_input::Builder {
crate::input::list_contents_input::Builder::default()
}
}
pub mod list_knowledge_bases_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
}
impl Builder {
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::ListKnowledgeBasesInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::ListKnowledgeBasesInput {
next_token: self.next_token,
max_results: self.max_results,
})
}
}
}
impl ListKnowledgeBasesInput {
#[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::ListKnowledgeBases,
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::ListKnowledgeBasesInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/knowledgeBases").expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::ListKnowledgeBasesInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_31) = &_input.next_token {
{
query.push_kv("nextToken", &aws_smithy_http::query::fmt_string(&inner_31));
}
}
if let Some(inner_32) = &_input.max_results {
if *inner_32 != 0 {
query.push_kv(
"maxResults",
aws_smithy_types::primitive::Encoder::from(*inner_32).encode(),
);
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListKnowledgeBasesInput,
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)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::ListKnowledgeBases::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListKnowledgeBases",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_knowledge_bases_input::Builder {
crate::input::list_knowledge_bases_input::Builder::default()
}
}
pub mod list_tags_for_resource_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>,
}
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 build(
self,
) -> Result<
crate::input::ListTagsForResourceInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::ListTagsForResourceInput {
resource_arn: self.resource_arn,
})
}
}
}
impl ListTagsForResourceInput {
#[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::ListTagsForResource,
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::ListTagsForResourceInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_33 = &_input.resource_arn;
let input_33 = input_33.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"resource_arn",
"cannot be empty or unset",
)
})?;
let resource_arn = aws_smithy_http::label::fmt_string(
input_33,
aws_smithy_http::label::EncodingStrategy::Default,
);
if resource_arn.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"resource_arn",
"cannot be empty or unset",
),
);
}
write!(output, "/tags/{resourceArn}", resourceArn = resource_arn)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListTagsForResourceInput,
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("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::ListTagsForResource::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListTagsForResource",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_tags_for_resource_input::Builder {
crate::input::list_tags_for_resource_input::Builder::default()
}
}
pub mod notify_recommendations_received_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) assistant_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
pub(crate) recommendation_ids: std::option::Option<std::vec::Vec<std::string::String>>,
}
impl Builder {
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn recommendation_ids(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.recommendation_ids.unwrap_or_default();
v.push(input.into());
self.recommendation_ids = Some(v);
self
}
pub fn set_recommendation_ids(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.recommendation_ids = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::NotifyRecommendationsReceivedInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::NotifyRecommendationsReceivedInput {
assistant_id: self.assistant_id,
session_id: self.session_id,
recommendation_ids: self.recommendation_ids,
})
}
}
}
impl NotifyRecommendationsReceivedInput {
#[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::NotifyRecommendationsReceived,
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::NotifyRecommendationsReceivedInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_34 = &_input.assistant_id;
let input_34 = input_34.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_34,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
let input_35 = &_input.session_id;
let input_35 = input_35.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_35,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/sessions/{sessionId}/recommendations/notify",
assistantId = assistant_id,
sessionId = session_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::NotifyRecommendationsReceivedInput,
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_notify_recommendations_received(&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::NotifyRecommendationsReceived::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"NotifyRecommendationsReceived",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::notify_recommendations_received_input::Builder {
crate::input::notify_recommendations_received_input::Builder::default()
}
}
pub mod query_assistant_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default)]
pub struct Builder {
pub(crate) assistant_id: std::option::Option<std::string::String>,
pub(crate) query_text: std::option::Option<std::string::String>,
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
}
impl Builder {
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn query_text(mut self, input: impl Into<std::string::String>) -> Self {
self.query_text = Some(input.into());
self
}
pub fn set_query_text(mut self, input: std::option::Option<std::string::String>) -> Self {
self.query_text = input;
self
}
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn build(
self,
) -> Result<crate::input::QueryAssistantInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::QueryAssistantInput {
assistant_id: self.assistant_id,
query_text: self.query_text,
next_token: self.next_token,
max_results: self.max_results,
})
}
}
impl std::fmt::Debug for Builder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("Builder");
formatter.field("assistant_id", &self.assistant_id);
formatter.field("query_text", &"*** Sensitive Data Redacted ***");
formatter.field("next_token", &self.next_token);
formatter.field("max_results", &self.max_results);
formatter.finish()
}
}
}
impl QueryAssistantInput {
#[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::QueryAssistant,
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::QueryAssistantInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_36 = &_input.assistant_id;
let input_36 = input_36.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_36,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/query",
assistantId = assistant_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::QueryAssistantInput,
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_query_assistant(&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::QueryAssistant::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"QueryAssistant",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::query_assistant_input::Builder {
crate::input::query_assistant_input::Builder::default()
}
}
pub mod remove_knowledge_base_template_uri_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::RemoveKnowledgeBaseTemplateUriInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::RemoveKnowledgeBaseTemplateUriInput {
knowledge_base_id: self.knowledge_base_id,
})
}
}
}
impl RemoveKnowledgeBaseTemplateUriInput {
#[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::RemoveKnowledgeBaseTemplateUri,
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::RemoveKnowledgeBaseTemplateUriInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_37 = &_input.knowledge_base_id;
let input_37 = input_37.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_37,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/templateUri",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::RemoveKnowledgeBaseTemplateUriInput,
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("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::RemoveKnowledgeBaseTemplateUri::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"RemoveKnowledgeBaseTemplateUri",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::remove_knowledge_base_template_uri_input::Builder {
crate::input::remove_knowledge_base_template_uri_input::Builder::default()
}
}
pub mod search_content_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
pub(crate) search_expression: std::option::Option<crate::model::SearchExpression>,
}
impl Builder {
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn search_expression(mut self, input: crate::model::SearchExpression) -> Self {
self.search_expression = Some(input);
self
}
pub fn set_search_expression(
mut self,
input: std::option::Option<crate::model::SearchExpression>,
) -> Self {
self.search_expression = input;
self
}
pub fn build(
self,
) -> Result<crate::input::SearchContentInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::SearchContentInput {
next_token: self.next_token,
max_results: self.max_results,
knowledge_base_id: self.knowledge_base_id,
search_expression: self.search_expression,
})
}
}
}
impl SearchContentInput {
#[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::SearchContent,
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::SearchContentInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_38 = &_input.knowledge_base_id;
let input_38 = input_38.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_38,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/search",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::SearchContentInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_39) = &_input.next_token {
{
query.push_kv("nextToken", &aws_smithy_http::query::fmt_string(&inner_39));
}
}
if let Some(inner_40) = &_input.max_results {
if *inner_40 != 0 {
query.push_kv(
"maxResults",
aws_smithy_types::primitive::Encoder::from(*inner_40).encode(),
);
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::SearchContentInput,
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)?;
uri_query(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_search_content(&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::SearchContent::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"SearchContent",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::search_content_input::Builder {
crate::input::search_content_input::Builder::default()
}
}
pub mod search_sessions_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) assistant_id: std::option::Option<std::string::String>,
pub(crate) search_expression: std::option::Option<crate::model::SearchExpression>,
}
impl Builder {
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn assistant_id(mut self, input: impl Into<std::string::String>) -> Self {
self.assistant_id = Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn search_expression(mut self, input: crate::model::SearchExpression) -> Self {
self.search_expression = Some(input);
self
}
pub fn set_search_expression(
mut self,
input: std::option::Option<crate::model::SearchExpression>,
) -> Self {
self.search_expression = input;
self
}
pub fn build(
self,
) -> Result<crate::input::SearchSessionsInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::SearchSessionsInput {
next_token: self.next_token,
max_results: self.max_results,
assistant_id: self.assistant_id,
search_expression: self.search_expression,
})
}
}
}
impl SearchSessionsInput {
#[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::SearchSessions,
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::SearchSessionsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_41 = &_input.assistant_id;
let input_41 = input_41.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
)
})?;
let assistant_id = aws_smithy_http::label::fmt_string(
input_41,
aws_smithy_http::label::EncodingStrategy::Default,
);
if assistant_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"assistant_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/assistants/{assistantId}/searchSessions",
assistantId = assistant_id
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::SearchSessionsInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_42) = &_input.next_token {
{
query.push_kv("nextToken", &aws_smithy_http::query::fmt_string(&inner_42));
}
}
if let Some(inner_43) = &_input.max_results {
if *inner_43 != 0 {
query.push_kv(
"maxResults",
aws_smithy_types::primitive::Encoder::from(*inner_43).encode(),
);
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::SearchSessionsInput,
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)?;
uri_query(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_search_sessions(&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::SearchSessions::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"SearchSessions",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::search_sessions_input::Builder {
crate::input::search_sessions_input::Builder::default()
}
}
pub mod start_content_upload_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
pub(crate) content_type: std::option::Option<std::string::String>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn content_type(mut self, input: impl Into<std::string::String>) -> Self {
self.content_type = Some(input.into());
self
}
pub fn set_content_type(mut self, input: std::option::Option<std::string::String>) -> Self {
self.content_type = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::StartContentUploadInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::StartContentUploadInput {
knowledge_base_id: self.knowledge_base_id,
content_type: self.content_type,
})
}
}
}
impl StartContentUploadInput {
#[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::StartContentUpload,
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::StartContentUploadInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_44 = &_input.knowledge_base_id;
let input_44 = input_44.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_44,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/upload",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::StartContentUploadInput,
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_start_content_upload(&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::StartContentUpload::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"StartContentUpload",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::start_content_upload_input::Builder {
crate::input::start_content_upload_input::Builder::default()
}
}
pub mod tag_resource_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) tags: std::option::Option<
std::collections::HashMap<std::string::String, 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 tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn build(
self,
) -> Result<crate::input::TagResourceInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::TagResourceInput {
resource_arn: self.resource_arn,
tags: self.tags,
})
}
}
}
impl TagResourceInput {
#[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::TagResource,
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::TagResourceInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_45 = &_input.resource_arn;
let input_45 = input_45.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"resource_arn",
"cannot be empty or unset",
)
})?;
let resource_arn = aws_smithy_http::label::fmt_string(
input_45,
aws_smithy_http::label::EncodingStrategy::Default,
);
if resource_arn.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"resource_arn",
"cannot be empty or unset",
),
);
}
write!(output, "/tags/{resourceArn}", resourceArn = resource_arn)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::TagResourceInput,
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_tag_resource(&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::TagResource::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"TagResource",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::tag_resource_input::Builder {
crate::input::tag_resource_input::Builder::default()
}
}
pub mod untag_resource_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) tag_keys: std::option::Option<std::vec::Vec<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 tag_keys(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.tag_keys.unwrap_or_default();
v.push(input.into());
self.tag_keys = Some(v);
self
}
pub fn set_tag_keys(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.tag_keys = input;
self
}
pub fn build(
self,
) -> Result<crate::input::UntagResourceInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::UntagResourceInput {
resource_arn: self.resource_arn,
tag_keys: self.tag_keys,
})
}
}
}
impl UntagResourceInput {
#[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::UntagResource,
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::UntagResourceInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_46 = &_input.resource_arn;
let input_46 = input_46.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"resource_arn",
"cannot be empty or unset",
)
})?;
let resource_arn = aws_smithy_http::label::fmt_string(
input_46,
aws_smithy_http::label::EncodingStrategy::Default,
);
if resource_arn.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"resource_arn",
"cannot be empty or unset",
),
);
}
write!(output, "/tags/{resourceArn}", resourceArn = resource_arn)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::UntagResourceInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
let inner_47 = &_input.tag_keys;
let inner_47 = inner_47.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"tag_keys",
"cannot be empty or unset",
)
})?;
for inner_48 in inner_47 {
query.push_kv("tagKeys", &aws_smithy_http::query::fmt_string(&inner_48));
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::UntagResourceInput,
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)?;
uri_query(input, &mut uri)?;
Ok(builder.method("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
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::UntagResource::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"UntagResource",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::untag_resource_input::Builder {
crate::input::untag_resource_input::Builder::default()
}
}
pub mod update_content_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
pub(crate) content_id: std::option::Option<std::string::String>,
pub(crate) revision_id: std::option::Option<std::string::String>,
pub(crate) title: std::option::Option<std::string::String>,
pub(crate) override_link_out_uri: std::option::Option<std::string::String>,
pub(crate) remove_override_link_out_uri: std::option::Option<bool>,
pub(crate) metadata: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) upload_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn content_id(mut self, input: impl Into<std::string::String>) -> Self {
self.content_id = Some(input.into());
self
}
pub fn set_content_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.content_id = input;
self
}
pub fn revision_id(mut self, input: impl Into<std::string::String>) -> Self {
self.revision_id = Some(input.into());
self
}
pub fn set_revision_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.revision_id = input;
self
}
pub fn title(mut self, input: impl Into<std::string::String>) -> Self {
self.title = Some(input.into());
self
}
pub fn set_title(mut self, input: std::option::Option<std::string::String>) -> Self {
self.title = input;
self
}
pub fn override_link_out_uri(mut self, input: impl Into<std::string::String>) -> Self {
self.override_link_out_uri = Some(input.into());
self
}
pub fn set_override_link_out_uri(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.override_link_out_uri = input;
self
}
pub fn remove_override_link_out_uri(mut self, input: bool) -> Self {
self.remove_override_link_out_uri = Some(input);
self
}
pub fn set_remove_override_link_out_uri(
mut self,
input: std::option::Option<bool>,
) -> Self {
self.remove_override_link_out_uri = input;
self
}
pub fn metadata(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.metadata.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.metadata = Some(hash_map);
self
}
pub fn set_metadata(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.metadata = input;
self
}
pub fn upload_id(mut self, input: impl Into<std::string::String>) -> Self {
self.upload_id = Some(input.into());
self
}
pub fn set_upload_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.upload_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::UpdateContentInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::UpdateContentInput {
knowledge_base_id: self.knowledge_base_id,
content_id: self.content_id,
revision_id: self.revision_id,
title: self.title,
override_link_out_uri: self.override_link_out_uri,
remove_override_link_out_uri: self.remove_override_link_out_uri,
metadata: self.metadata,
upload_id: self.upload_id,
})
}
}
}
impl UpdateContentInput {
#[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::UpdateContent,
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::UpdateContentInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_49 = &_input.knowledge_base_id;
let input_49 = input_49.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_49,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
let input_50 = &_input.content_id;
let input_50 = input_50.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
)
})?;
let content_id = aws_smithy_http::label::fmt_string(
input_50,
aws_smithy_http::label::EncodingStrategy::Default,
);
if content_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"content_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/contents/{contentId}",
knowledgeBaseId = knowledge_base_id,
contentId = content_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::UpdateContentInput,
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_update_content(&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::UpdateContent::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"UpdateContent",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::update_content_input::Builder {
crate::input::update_content_input::Builder::default()
}
}
pub mod update_knowledge_base_template_uri_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) knowledge_base_id: std::option::Option<std::string::String>,
pub(crate) template_uri: std::option::Option<std::string::String>,
}
impl Builder {
pub fn knowledge_base_id(mut self, input: impl Into<std::string::String>) -> Self {
self.knowledge_base_id = Some(input.into());
self
}
pub fn set_knowledge_base_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.knowledge_base_id = input;
self
}
pub fn template_uri(mut self, input: impl Into<std::string::String>) -> Self {
self.template_uri = Some(input.into());
self
}
pub fn set_template_uri(mut self, input: std::option::Option<std::string::String>) -> Self {
self.template_uri = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::UpdateKnowledgeBaseTemplateUriInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::UpdateKnowledgeBaseTemplateUriInput {
knowledge_base_id: self.knowledge_base_id,
template_uri: self.template_uri,
})
}
}
}
impl UpdateKnowledgeBaseTemplateUriInput {
#[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::UpdateKnowledgeBaseTemplateUri,
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::UpdateKnowledgeBaseTemplateUriInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_51 = &_input.knowledge_base_id;
let input_51 = input_51.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
)
})?;
let knowledge_base_id = aws_smithy_http::label::fmt_string(
input_51,
aws_smithy_http::label::EncodingStrategy::Default,
);
if knowledge_base_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"knowledge_base_id",
"cannot be empty or unset",
),
);
}
write!(
output,
"/knowledgeBases/{knowledgeBaseId}/templateUri",
knowledgeBaseId = knowledge_base_id
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::UpdateKnowledgeBaseTemplateUriInput,
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_update_knowledge_base_template_uri(&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::UpdateKnowledgeBaseTemplateUri::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"UpdateKnowledgeBaseTemplateUri",
"wisdom",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::update_knowledge_base_template_uri_input::Builder {
crate::input::update_knowledge_base_template_uri_input::Builder::default()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct UpdateKnowledgeBaseTemplateUriInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub template_uri: std::option::Option<std::string::String>,
}
impl UpdateKnowledgeBaseTemplateUriInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
pub fn template_uri(&self) -> std::option::Option<&str> {
self.template_uri.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct StartContentUploadInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub content_type: std::option::Option<std::string::String>,
}
impl StartContentUploadInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
pub fn content_type(&self) -> std::option::Option<&str> {
self.content_type.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct SearchContentInput {
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub search_expression: std::option::Option<crate::model::SearchExpression>,
}
impl SearchContentInput {
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
pub fn search_expression(&self) -> std::option::Option<&crate::model::SearchExpression> {
self.search_expression.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct RemoveKnowledgeBaseTemplateUriInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
}
impl RemoveKnowledgeBaseTemplateUriInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListKnowledgeBasesInput {
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
}
impl ListKnowledgeBasesInput {
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateKnowledgeBaseInput {
#[doc(hidden)]
pub client_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub knowledge_base_type: std::option::Option<crate::model::KnowledgeBaseType>,
#[doc(hidden)]
pub source_configuration: std::option::Option<crate::model::SourceConfiguration>,
#[doc(hidden)]
pub rendering_configuration: std::option::Option<crate::model::RenderingConfiguration>,
#[doc(hidden)]
pub server_side_encryption_configuration:
std::option::Option<crate::model::ServerSideEncryptionConfiguration>,
#[doc(hidden)]
pub description: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl CreateKnowledgeBaseInput {
pub fn client_token(&self) -> std::option::Option<&str> {
self.client_token.as_deref()
}
pub fn name(&self) -> std::option::Option<&str> {
self.name.as_deref()
}
pub fn knowledge_base_type(&self) -> std::option::Option<&crate::model::KnowledgeBaseType> {
self.knowledge_base_type.as_ref()
}
pub fn source_configuration(&self) -> std::option::Option<&crate::model::SourceConfiguration> {
self.source_configuration.as_ref()
}
pub fn rendering_configuration(
&self,
) -> std::option::Option<&crate::model::RenderingConfiguration> {
self.rendering_configuration.as_ref()
}
pub fn server_side_encryption_configuration(
&self,
) -> std::option::Option<&crate::model::ServerSideEncryptionConfiguration> {
self.server_side_encryption_configuration.as_ref()
}
pub fn description(&self) -> std::option::Option<&str> {
self.description.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteKnowledgeBaseInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
}
impl DeleteKnowledgeBaseInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetKnowledgeBaseInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
}
impl GetKnowledgeBaseInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetContentSummaryInput {
#[doc(hidden)]
pub content_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
}
impl GetContentSummaryInput {
pub fn content_id(&self) -> std::option::Option<&str> {
self.content_id.as_deref()
}
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListContentsInput {
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
}
impl ListContentsInput {
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateContentInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub title: std::option::Option<std::string::String>,
#[doc(hidden)]
pub override_link_out_uri: std::option::Option<std::string::String>,
#[doc(hidden)]
pub metadata:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
#[doc(hidden)]
pub upload_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub client_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl CreateContentInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
pub fn name(&self) -> std::option::Option<&str> {
self.name.as_deref()
}
pub fn title(&self) -> std::option::Option<&str> {
self.title.as_deref()
}
pub fn override_link_out_uri(&self) -> std::option::Option<&str> {
self.override_link_out_uri.as_deref()
}
pub fn metadata(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.metadata.as_ref()
}
pub fn upload_id(&self) -> std::option::Option<&str> {
self.upload_id.as_deref()
}
pub fn client_token(&self) -> std::option::Option<&str> {
self.client_token.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteContentInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub content_id: std::option::Option<std::string::String>,
}
impl DeleteContentInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
pub fn content_id(&self) -> std::option::Option<&str> {
self.content_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct UpdateContentInput {
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub content_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub revision_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub title: std::option::Option<std::string::String>,
#[doc(hidden)]
pub override_link_out_uri: std::option::Option<std::string::String>,
#[doc(hidden)]
pub remove_override_link_out_uri: std::option::Option<bool>,
#[doc(hidden)]
pub metadata:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
#[doc(hidden)]
pub upload_id: std::option::Option<std::string::String>,
}
impl UpdateContentInput {
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
pub fn content_id(&self) -> std::option::Option<&str> {
self.content_id.as_deref()
}
pub fn revision_id(&self) -> std::option::Option<&str> {
self.revision_id.as_deref()
}
pub fn title(&self) -> std::option::Option<&str> {
self.title.as_deref()
}
pub fn override_link_out_uri(&self) -> std::option::Option<&str> {
self.override_link_out_uri.as_deref()
}
pub fn remove_override_link_out_uri(&self) -> std::option::Option<bool> {
self.remove_override_link_out_uri
}
pub fn metadata(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.metadata.as_ref()
}
pub fn upload_id(&self) -> std::option::Option<&str> {
self.upload_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetContentInput {
#[doc(hidden)]
pub content_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub knowledge_base_id: std::option::Option<std::string::String>,
}
impl GetContentInput {
pub fn content_id(&self) -> std::option::Option<&str> {
self.content_id.as_deref()
}
pub fn knowledge_base_id(&self) -> std::option::Option<&str> {
self.knowledge_base_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct SearchSessionsInput {
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub search_expression: std::option::Option<crate::model::SearchExpression>,
}
impl SearchSessionsInput {
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
pub fn search_expression(&self) -> std::option::Option<&crate::model::SearchExpression> {
self.search_expression.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct QueryAssistantInput {
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub query_text: std::option::Option<std::string::String>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
}
impl QueryAssistantInput {
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
pub fn query_text(&self) -> std::option::Option<&str> {
self.query_text.as_deref()
}
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
}
impl std::fmt::Debug for QueryAssistantInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("QueryAssistantInput");
formatter.field("assistant_id", &self.assistant_id);
formatter.field("query_text", &"*** Sensitive Data Redacted ***");
formatter.field("next_token", &self.next_token);
formatter.field("max_results", &self.max_results);
formatter.finish()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct NotifyRecommendationsReceivedInput {
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub recommendation_ids: std::option::Option<std::vec::Vec<std::string::String>>,
}
impl NotifyRecommendationsReceivedInput {
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
pub fn recommendation_ids(&self) -> std::option::Option<&[std::string::String]> {
self.recommendation_ids.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetRecommendationsInput {
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub wait_time_seconds: i32,
}
impl GetRecommendationsInput {
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
pub fn wait_time_seconds(&self) -> i32 {
self.wait_time_seconds
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListAssistantsInput {
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
}
impl ListAssistantsInput {
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateAssistantInput {
#[doc(hidden)]
pub client_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub r#type: std::option::Option<crate::model::AssistantType>,
#[doc(hidden)]
pub description: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
#[doc(hidden)]
pub server_side_encryption_configuration:
std::option::Option<crate::model::ServerSideEncryptionConfiguration>,
}
impl CreateAssistantInput {
pub fn client_token(&self) -> std::option::Option<&str> {
self.client_token.as_deref()
}
pub fn name(&self) -> std::option::Option<&str> {
self.name.as_deref()
}
pub fn r#type(&self) -> std::option::Option<&crate::model::AssistantType> {
self.r#type.as_ref()
}
pub fn description(&self) -> std::option::Option<&str> {
self.description.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
pub fn server_side_encryption_configuration(
&self,
) -> std::option::Option<&crate::model::ServerSideEncryptionConfiguration> {
self.server_side_encryption_configuration.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteAssistantInput {
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
}
impl DeleteAssistantInput {
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetAssistantInput {
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
}
impl GetAssistantInput {
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateSessionInput {
#[doc(hidden)]
pub client_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub description: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl CreateSessionInput {
pub fn client_token(&self) -> std::option::Option<&str> {
self.client_token.as_deref()
}
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
pub fn name(&self) -> std::option::Option<&str> {
self.name.as_deref()
}
pub fn description(&self) -> std::option::Option<&str> {
self.description.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetSessionInput {
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
}
impl GetSessionInput {
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListAssistantAssociationsInput {
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
}
impl ListAssistantAssociationsInput {
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateAssistantAssociationInput {
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub association_type: std::option::Option<crate::model::AssociationType>,
#[doc(hidden)]
pub association: std::option::Option<crate::model::AssistantAssociationInputData>,
#[doc(hidden)]
pub client_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl CreateAssistantAssociationInput {
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
pub fn association_type(&self) -> std::option::Option<&crate::model::AssociationType> {
self.association_type.as_ref()
}
pub fn association(&self) -> std::option::Option<&crate::model::AssistantAssociationInputData> {
self.association.as_ref()
}
pub fn client_token(&self) -> std::option::Option<&str> {
self.client_token.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteAssistantAssociationInput {
#[doc(hidden)]
pub assistant_association_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
}
impl DeleteAssistantAssociationInput {
pub fn assistant_association_id(&self) -> std::option::Option<&str> {
self.assistant_association_id.as_deref()
}
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetAssistantAssociationInput {
#[doc(hidden)]
pub assistant_association_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub assistant_id: std::option::Option<std::string::String>,
}
impl GetAssistantAssociationInput {
pub fn assistant_association_id(&self) -> std::option::Option<&str> {
self.assistant_association_id.as_deref()
}
pub fn assistant_id(&self) -> std::option::Option<&str> {
self.assistant_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct UntagResourceInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tag_keys: std::option::Option<std::vec::Vec<std::string::String>>,
}
impl UntagResourceInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn tag_keys(&self) -> std::option::Option<&[std::string::String]> {
self.tag_keys.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct TagResourceInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl TagResourceInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListTagsForResourceInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
}
impl ListTagsForResourceInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
}