// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::create_component_version::_create_component_version_input::CreateComponentVersionInputBuilder;
pub use crate::operation::create_component_version::_create_component_version_output::CreateComponentVersionOutputBuilder;
impl crate::operation::create_component_version::builders::CreateComponentVersionInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::create_component_version::CreateComponentVersionOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_component_version::CreateComponentVersionError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.create_component_version();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `CreateComponentVersion`.
///
/// <p>Creates a component. Components are software that run on Greengrass core devices. After you develop and test a component on your core device, you can use this operation to upload your component to IoT Greengrass. Then, you can deploy the component to other core devices.</p>
/// <p>You can use this operation to do the following:</p>
/// <ul>
/// <li>
/// <p><b>Create components from recipes</b></p>
/// <p>Create a component from a recipe, which is a file that defines the component's metadata, parameters, dependencies, lifecycle, artifacts, and platform capability. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/component-recipe-reference.html">IoT Greengrass component recipe reference</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
/// <p>To create a component from a recipe, specify <code>inlineRecipe</code> when you call this operation.</p></li>
/// <li>
/// <p><b>Create components from Lambda functions</b></p>
/// <p>Create a component from an Lambda function that runs on IoT Greengrass. This creates a recipe and artifacts from the Lambda function's deployment package. You can use this operation to migrate Lambda functions from IoT Greengrass V1 to IoT Greengrass V2.</p>
/// <p>This function accepts Lambda functions in all supported versions of Python, Node.js, and Java runtimes. IoT Greengrass doesn't apply any additional restrictions on deprecated Lambda runtime versions.</p>
/// <p>To create a component from a Lambda function, specify <code>lambdaFunction</code> when you call this operation.</p><note>
/// <p>IoT Greengrass currently supports Lambda functions on only Linux core devices.</p>
/// </note></li>
/// </ul>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CreateComponentVersionFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::create_component_version::builders::CreateComponentVersionInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::create_component_version::CreateComponentVersionOutput,
crate::operation::create_component_version::CreateComponentVersionError,
> for CreateComponentVersionFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::create_component_version::CreateComponentVersionOutput,
crate::operation::create_component_version::CreateComponentVersionError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl CreateComponentVersionFluentBuilder {
/// Creates a new `CreateComponentVersionFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the CreateComponentVersion as a reference.
pub fn as_input(&self) -> &crate::operation::create_component_version::builders::CreateComponentVersionInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::create_component_version::CreateComponentVersionOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_component_version::CreateComponentVersionError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::create_component_version::CreateComponentVersion::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::create_component_version::CreateComponentVersion::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::create_component_version::CreateComponentVersionOutput,
crate::operation::create_component_version::CreateComponentVersionError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>The recipe to use to create the component. The recipe defines the component's metadata, parameters, dependencies, lifecycle, artifacts, and platform compatibility.</p>
/// <p>You must specify either <code>inlineRecipe</code> or <code>lambdaFunction</code>.</p>
pub fn inline_recipe(mut self, input: ::aws_smithy_types::Blob) -> Self {
self.inner = self.inner.inline_recipe(input);
self
}
/// <p>The recipe to use to create the component. The recipe defines the component's metadata, parameters, dependencies, lifecycle, artifacts, and platform compatibility.</p>
/// <p>You must specify either <code>inlineRecipe</code> or <code>lambdaFunction</code>.</p>
pub fn set_inline_recipe(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
self.inner = self.inner.set_inline_recipe(input);
self
}
/// <p>The recipe to use to create the component. The recipe defines the component's metadata, parameters, dependencies, lifecycle, artifacts, and platform compatibility.</p>
/// <p>You must specify either <code>inlineRecipe</code> or <code>lambdaFunction</code>.</p>
pub fn get_inline_recipe(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
self.inner.get_inline_recipe()
}
/// <p>The parameters to create a component from a Lambda function.</p>
/// <p>You must specify either <code>inlineRecipe</code> or <code>lambdaFunction</code>.</p>
pub fn lambda_function(mut self, input: crate::types::LambdaFunctionRecipeSource) -> Self {
self.inner = self.inner.lambda_function(input);
self
}
/// <p>The parameters to create a component from a Lambda function.</p>
/// <p>You must specify either <code>inlineRecipe</code> or <code>lambdaFunction</code>.</p>
pub fn set_lambda_function(mut self, input: ::std::option::Option<crate::types::LambdaFunctionRecipeSource>) -> Self {
self.inner = self.inner.set_lambda_function(input);
self
}
/// <p>The parameters to create a component from a Lambda function.</p>
/// <p>You must specify either <code>inlineRecipe</code> or <code>lambdaFunction</code>.</p>
pub fn get_lambda_function(&self) -> &::std::option::Option<crate::types::LambdaFunctionRecipeSource> {
self.inner.get_lambda_function()
}
///
/// Adds a key-value pair to `tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
///
/// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.tags(k.into(), v.into());
self
}
/// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
self.inner = self.inner.set_tags(input);
self
}
/// <p>A list of key-value pairs that contain metadata for the resource. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html">Tag your resources</a> in the <i>IoT Greengrass V2 Developer Guide</i>.</p>
pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.inner.get_tags()
}
/// <p>A unique, case-sensitive identifier that you can provide to ensure that the request is idempotent. Idempotency means that the request is successfully processed only once, even if you send the request multiple times. When a request succeeds, and you specify the same client token for subsequent successful requests, the IoT Greengrass V2 service returns the successful response that it caches from the previous request. IoT Greengrass V2 caches successful responses for idempotent requests for up to 8 hours.</p>
pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.client_token(input.into());
self
}
/// <p>A unique, case-sensitive identifier that you can provide to ensure that the request is idempotent. Idempotency means that the request is successfully processed only once, even if you send the request multiple times. When a request succeeds, and you specify the same client token for subsequent successful requests, the IoT Greengrass V2 service returns the successful response that it caches from the previous request. IoT Greengrass V2 caches successful responses for idempotent requests for up to 8 hours.</p>
pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_client_token(input);
self
}
/// <p>A unique, case-sensitive identifier that you can provide to ensure that the request is idempotent. Idempotency means that the request is successfully processed only once, even if you send the request multiple times. When a request succeeds, and you specify the same client token for subsequent successful requests, the IoT Greengrass V2 service returns the successful response that it caches from the previous request. IoT Greengrass V2 caches successful responses for idempotent requests for up to 8 hours.</p>
pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_client_token()
}
}