Skip to main content

aws_sdk_codecommit/operation/
put_file.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `PutFile`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct PutFile;
6impl PutFile {
7    /// Creates a new `PutFile`
8    pub fn new() -> Self {
9        Self
10    }
11    pub(crate) async fn orchestrate(
12        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13        input: crate::operation::put_file::PutFileInput,
14    ) -> ::std::result::Result<
15        crate::operation::put_file::PutFileOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::put_file::PutFileError,
18            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19        >,
20    > {
21        let map_err =
22            |err: ::aws_smithy_runtime_api::client::result::SdkError<
23                ::aws_smithy_runtime_api::client::interceptors::context::Error,
24                ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25            >| { err.map_service_error(|err| err.downcast::<crate::operation::put_file::PutFileError>().expect("correct error type")) };
26        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
27            .await
28            .map_err(map_err)?;
29        let output = context.finalize().map_err(map_err)?;
30        ::std::result::Result::Ok(
31            output
32                .downcast::<crate::operation::put_file::PutFileOutput>()
33                .expect("correct output type"),
34        )
35    }
36
37    pub(crate) async fn orchestrate_with_stop_point(
38        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
39        input: crate::operation::put_file::PutFileInput,
40        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
41    ) -> ::std::result::Result<
42        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
43        ::aws_smithy_runtime_api::client::result::SdkError<
44            ::aws_smithy_runtime_api::client::interceptors::context::Error,
45            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
46        >,
47    > {
48        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
49        use ::tracing::Instrument;
50        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("CodeCommit", "PutFile", input, runtime_plugins, stop_point)
51            // Create a parent span for the entire operation. Includes a random, internal-only,
52            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
53            .instrument(::tracing::debug_span!(
54                "CodeCommit.PutFile",
55                "rpc.service" = "CodeCommit",
56                "rpc.method" = "PutFile",
57                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
58                "rpc.system" = "aws-api",
59            ))
60            .await
61    }
62
63    pub(crate) fn operation_runtime_plugins(
64        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
65        client_config: &crate::config::Config,
66        config_override: ::std::option::Option<crate::config::Builder>,
67    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
68        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
69
70        if let ::std::option::Option::Some(config_override) = config_override {
71            for plugin in config_override.runtime_plugins.iter().cloned() {
72                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
73            }
74            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
75                config_override,
76                client_config.config.clone(),
77                &client_config.runtime_components,
78            ));
79        }
80        runtime_plugins
81    }
82}
83impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for PutFile {
84    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
85        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("PutFile");
86
87        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
88            PutFileRequestSerializer,
89        ));
90        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
91            PutFileResponseDeserializer,
92        ));
93
94        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
95            crate::config::auth::Params::builder()
96                .operation_name("PutFile")
97                .build()
98                .expect("required fields set"),
99        ));
100
101        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("PutFile", "CodeCommit"));
102        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
103        signing_options.double_uri_encode = true;
104        signing_options.content_sha256_header = false;
105        signing_options.normalize_uri_path = true;
106        signing_options.payload_override = None;
107
108        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
109            signing_options,
110            ..::std::default::Default::default()
111        });
112
113        ::std::option::Option::Some(cfg.freeze())
114    }
115
116    fn runtime_components(
117        &self,
118        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
119    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
120        #[allow(unused_mut)]
121        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("PutFile")
122            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
123                PutFileTelemetryInputCaptureInterceptor,
124            ))
125            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
126                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
127            ))
128            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
129                PutFileEndpointParamsInterceptor,
130            ))
131            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
132                crate::operation::put_file::PutFileError,
133            >::new())
134            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
135                crate::operation::put_file::PutFileError,
136            >::new())
137            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
138                crate::operation::put_file::PutFileError,
139            >::new())
140            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
141                crate::operation::put_file::PutFileError,
142            >::new());
143
144        ::std::borrow::Cow::Owned(rcb)
145    }
146}
147
148#[derive(Debug)]
149struct PutFileTelemetryInputCaptureInterceptor;
150
151#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
152impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutFileTelemetryInputCaptureInterceptor {
153    fn name(&self) -> &'static str {
154        "PutFileTelemetryInputCaptureInterceptor"
155    }
156
157    fn read_before_execution(
158        &self,
159        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
160            '_,
161            ::aws_smithy_runtime_api::client::interceptors::context::Input,
162            ::aws_smithy_runtime_api::client::interceptors::context::Output,
163            ::aws_smithy_runtime_api::client::interceptors::context::Error,
164        >,
165        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
166    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
167        // Nothing to do unless the customer opted in by naming members to record.
168        let ::std::option::Option::Some(requested) = cfg
169            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
170            .filter(|r| !r.is_empty())
171        else {
172            return ::std::result::Result::Ok(());
173        };
174
175        let ::std::option::Option::Some(input) = context.input().downcast_ref::<PutFileInput>() else {
176            // A mismatched input is not this interceptor's concern; skip quietly.
177            return ::std::result::Result::Ok(());
178        };
179
180        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
181        if requested.should_capture("repositoryName") {
182            if let ::std::option::Option::Some(value) = input.repository_name.as_deref() {
183                captured.insert("repositoryName", value);
184            }
185        }
186        if requested.should_capture("branchName") {
187            if let ::std::option::Option::Some(value) = input.branch_name.as_deref() {
188                captured.insert("branchName", value);
189            }
190        }
191        if requested.should_capture("filePath") {
192            if let ::std::option::Option::Some(value) = input.file_path.as_deref() {
193                captured.insert("filePath", value);
194            }
195        }
196        if requested.should_capture("parentCommitId") {
197            if let ::std::option::Option::Some(value) = input.parent_commit_id.as_deref() {
198                captured.insert("parentCommitId", value);
199            }
200        }
201        if requested.should_capture("commitMessage") {
202            if let ::std::option::Option::Some(value) = input.commit_message.as_deref() {
203                captured.insert("commitMessage", value);
204            }
205        }
206        if requested.should_capture("name") {
207            if let ::std::option::Option::Some(value) = input.name.as_deref() {
208                captured.insert("name", value);
209            }
210        }
211        if requested.should_capture("email") {
212            if let ::std::option::Option::Some(value) = input.email.as_deref() {
213                captured.insert("email", value);
214            }
215        }
216
217        cfg.interceptor_state().store_put(captured);
218        ::std::result::Result::Ok(())
219    }
220}
221#[derive(Debug)]
222struct PutFileResponseDeserializer;
223impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutFileResponseDeserializer {
224    fn deserialize_nonstreaming_with_config(
225        &self,
226        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
227        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
228    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
229        let (success, status) = (response.status().is_success(), response.status().as_u16());
230        let headers = response.headers();
231        let body = response.body().bytes().expect("body loaded");
232        #[allow(unused_mut)]
233        let mut force_error = false;
234        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
235        let parse_result = if !success && status != 200 || force_error {
236            crate::protocol_serde::shape_put_file::de_put_file_http_error(status, headers, body)
237        } else {
238            crate::protocol_serde::shape_put_file::de_put_file_http_response(status, headers, body)
239        };
240        crate::protocol_serde::type_erase_result(parse_result)
241    }
242}
243#[derive(Debug)]
244struct PutFileRequestSerializer;
245impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutFileRequestSerializer {
246    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
247    fn serialize_input(
248        &self,
249        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
250        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
251    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
252        let input = input.downcast::<crate::operation::put_file::PutFileInput>().expect("correct type");
253        let _header_serialization_settings = _cfg
254            .load::<crate::serialization_settings::HeaderSerializationSettings>()
255            .cloned()
256            .unwrap_or_default();
257        let mut request_builder = {
258            #[allow(clippy::uninlined_format_args)]
259            fn uri_base(
260                _input: &crate::operation::put_file::PutFileInput,
261                output: &mut ::std::string::String,
262            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
263                use ::std::fmt::Write as _;
264                ::std::write!(output, "/").expect("formatting should succeed");
265                ::std::result::Result::Ok(())
266            }
267            #[allow(clippy::unnecessary_wraps)]
268            fn update_http_builder(
269                input: &crate::operation::put_file::PutFileInput,
270                builder: ::http_1x::request::Builder,
271            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
272                let mut uri = ::std::string::String::new();
273                uri_base(input, &mut uri)?;
274                ::std::result::Result::Ok(builder.method("POST").uri(uri))
275            }
276            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
277            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
278            builder = _header_serialization_settings.set_default_header(
279                builder,
280                ::http_1x::header::HeaderName::from_static("x-amz-target"),
281                "CodeCommit_20150413.PutFile",
282            );
283            builder
284        };
285        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_put_file::ser_put_file_input(&input)?);
286        if let Some(content_length) = body.content_length() {
287            let content_length = content_length.to_string();
288            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
289        }
290        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
291    }
292}
293#[derive(Debug)]
294struct PutFileEndpointParamsInterceptor;
295
296#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
297impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutFileEndpointParamsInterceptor {
298    fn name(&self) -> &'static str {
299        "PutFileEndpointParamsInterceptor"
300    }
301
302    fn read_before_execution(
303        &self,
304        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
305            '_,
306            ::aws_smithy_runtime_api::client::interceptors::context::Input,
307            ::aws_smithy_runtime_api::client::interceptors::context::Output,
308            ::aws_smithy_runtime_api::client::interceptors::context::Error,
309        >,
310        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
311    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
312        let _input = context
313            .input()
314            .downcast_ref::<PutFileInput>()
315            .ok_or("failed to downcast to PutFileInput")?;
316
317        let params = crate::config::endpoint::Params::builder()
318            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
319            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
320            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
321            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
322            .build()
323            .map_err(|err| {
324                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
325            })?;
326        cfg.interceptor_state()
327            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
328        ::std::result::Result::Ok(())
329    }
330}
331
332// The get_* functions below are generated from JMESPath expressions in the
333// operationContextParams trait. They target the operation's input shape.
334
335/// Error type for the `PutFileError` operation.
336#[non_exhaustive]
337#[derive(::std::fmt::Debug)]
338pub enum PutFileError {
339    /// <p>The specified branch does not exist.</p>
340    BranchDoesNotExistException(crate::types::error::BranchDoesNotExistException),
341    /// <p>The specified branch name is not valid because it is a tag name. Enter the name of a branch in the repository. For a list of valid branch names, use <code>ListBranches</code>.</p>
342    BranchNameIsTagNameException(crate::types::error::BranchNameIsTagNameException),
343    /// <p>A branch name is required, but was not specified.</p>
344    BranchNameRequiredException(crate::types::error::BranchNameRequiredException),
345    /// <p>The commit message is too long. Provide a shorter string.</p>
346    CommitMessageLengthExceededException(crate::types::error::CommitMessageLengthExceededException),
347    /// <p>A file cannot be added to the repository because the specified path name has the same name as a file that already exists in this repository. Either provide a different name for the file, or specify a different path for the file.</p>
348    DirectoryNameConflictsWithFileNameException(crate::types::error::DirectoryNameConflictsWithFileNameException),
349    /// <p>An encryption integrity check failed.</p>
350    EncryptionIntegrityChecksFailedException(crate::types::error::EncryptionIntegrityChecksFailedException),
351    /// <p>An encryption key could not be accessed.</p>
352    EncryptionKeyAccessDeniedException(crate::types::error::EncryptionKeyAccessDeniedException),
353    /// <p>The encryption key is disabled.</p>
354    EncryptionKeyDisabledException(crate::types::error::EncryptionKeyDisabledException),
355    /// <p>No encryption key was found.</p>
356    EncryptionKeyNotFoundException(crate::types::error::EncryptionKeyNotFoundException),
357    /// <p>The encryption key is not available.</p>
358    EncryptionKeyUnavailableException(crate::types::error::EncryptionKeyUnavailableException),
359    /// <p>The file cannot be added because it is empty. Empty files cannot be added to the repository with this API.</p>
360    FileContentRequiredException(crate::types::error::FileContentRequiredException),
361    /// <p>The file cannot be added because it is too large. The maximum file size is 6 MB, and the combined file content change size is 7 MB. Consider making these changes using a Git client.</p>
362    FileContentSizeLimitExceededException(crate::types::error::FileContentSizeLimitExceededException),
363    /// <p>A file cannot be added to the repository because the specified file name has the same name as a directory in this repository. Either provide another name for the file, or add the file in a directory that does not match the file name.</p>
364    FileNameConflictsWithDirectoryNameException(crate::types::error::FileNameConflictsWithDirectoryNameException),
365    /// <p>The commit cannot be created because a specified file path points to a submodule. Verify that the destination files have valid file paths that do not point to a submodule.</p>
366    FilePathConflictsWithSubmodulePathException(crate::types::error::FilePathConflictsWithSubmodulePathException),
367    /// <p>The commit cannot be created because at least one of the overall changes in the commit results in a folder whose contents exceed the limit of 6 MB. Either reduce the number and size of your changes, or split the changes across multiple folders.</p>
368    FolderContentSizeLimitExceededException(crate::types::error::FolderContentSizeLimitExceededException),
369    /// <p>The specified reference name is not valid.</p>
370    InvalidBranchNameException(crate::types::error::InvalidBranchNameException),
371    /// <p>The specified deletion parameter is not valid.</p>
372    InvalidDeletionParameterException(crate::types::error::InvalidDeletionParameterException),
373    /// <p>The specified email address either contains one or more characters that are not allowed, or it exceeds the maximum number of characters allowed for an email address.</p>
374    InvalidEmailException(crate::types::error::InvalidEmailException),
375    /// <p>The specified file mode permission is not valid. For a list of valid file mode permissions, see <code>PutFile</code>.</p>
376    InvalidFileModeException(crate::types::error::InvalidFileModeException),
377    /// <p>The parent commit ID is not valid. The commit ID cannot be empty, and must match the head commit ID for the branch of the repository where you want to add or update a file.</p>
378    InvalidParentCommitIdException(crate::types::error::InvalidParentCommitIdException),
379    /// <p>The specified path is not valid.</p>
380    InvalidPathException(crate::types::error::InvalidPathException),
381    /// <p>A specified repository name is not valid.</p><note>
382    /// <p>This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.</p>
383    /// </note>
384    InvalidRepositoryNameException(crate::types::error::InvalidRepositoryNameException),
385    /// <p>The user name is not valid because it has exceeded the character limit for author names.</p>
386    NameLengthExceededException(crate::types::error::NameLengthExceededException),
387    /// <p>The parent commit ID is not valid because it does not exist. The specified parent commit ID does not exist in the specified branch of the repository.</p>
388    ParentCommitDoesNotExistException(crate::types::error::ParentCommitDoesNotExistException),
389    /// <p>The file could not be added because the provided parent commit ID is not the current tip of the specified branch. To view the full commit ID of the current head of the branch, use <code>GetBranch</code>.</p>
390    ParentCommitIdOutdatedException(crate::types::error::ParentCommitIdOutdatedException),
391    /// <p>A parent commit ID is required. To view the full commit ID of a branch in a repository, use <code>GetBranch</code> or a Git command (for example, git pull or git log).</p>
392    ParentCommitIdRequiredException(crate::types::error::ParentCommitIdRequiredException),
393    /// <p>The folderPath for a location cannot be null.</p>
394    PathRequiredException(crate::types::error::PathRequiredException),
395    /// <p>The specified repository does not exist.</p>
396    RepositoryDoesNotExistException(crate::types::error::RepositoryDoesNotExistException),
397    /// <p>A repository name is required, but was not specified.</p>
398    RepositoryNameRequiredException(crate::types::error::RepositoryNameRequiredException),
399    /// <p>The file was not added or updated because the content of the file is exactly the same as the content of that file in the repository and branch that you specified.</p>
400    SameFileContentException(crate::types::error::SameFileContentException),
401    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
402    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
403    variable wildcard pattern and check `.code()`:
404     \
405    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
406     \
407    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-PutFileError) for what information is available for the error.")]
408    Unhandled(crate::error::sealed_unhandled::Unhandled),
409}
410impl PutFileError {
411    /// Creates the `PutFileError::Unhandled` variant from any error type.
412    pub fn unhandled(
413        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
414    ) -> Self {
415        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
416            source: err.into(),
417            meta: ::std::default::Default::default(),
418        })
419    }
420
421    /// Creates the `PutFileError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
422    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
423        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
424            source: err.clone().into(),
425            meta: err,
426        })
427    }
428    ///
429    /// Returns error metadata, which includes the error code, message,
430    /// request ID, and potentially additional information.
431    ///
432    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
433        match self {
434            Self::BranchDoesNotExistException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
435            Self::BranchNameIsTagNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
436            Self::BranchNameRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
437            Self::CommitMessageLengthExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
438            Self::DirectoryNameConflictsWithFileNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
439            Self::EncryptionIntegrityChecksFailedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
440            Self::EncryptionKeyAccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
441            Self::EncryptionKeyDisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
442            Self::EncryptionKeyNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
443            Self::EncryptionKeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
444            Self::FileContentRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
445            Self::FileContentSizeLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
446            Self::FileNameConflictsWithDirectoryNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
447            Self::FilePathConflictsWithSubmodulePathException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
448            Self::FolderContentSizeLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
449            Self::InvalidBranchNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
450            Self::InvalidDeletionParameterException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
451            Self::InvalidEmailException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
452            Self::InvalidFileModeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
453            Self::InvalidParentCommitIdException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
454            Self::InvalidPathException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
455            Self::InvalidRepositoryNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
456            Self::NameLengthExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
457            Self::ParentCommitDoesNotExistException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
458            Self::ParentCommitIdOutdatedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
459            Self::ParentCommitIdRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
460            Self::PathRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
461            Self::RepositoryDoesNotExistException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
462            Self::RepositoryNameRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
463            Self::SameFileContentException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
464            Self::Unhandled(e) => &e.meta,
465        }
466    }
467    /// Returns `true` if the error kind is `PutFileError::BranchDoesNotExistException`.
468    pub fn is_branch_does_not_exist_exception(&self) -> bool {
469        matches!(self, Self::BranchDoesNotExistException(_))
470    }
471    /// Returns `true` if the error kind is `PutFileError::BranchNameIsTagNameException`.
472    pub fn is_branch_name_is_tag_name_exception(&self) -> bool {
473        matches!(self, Self::BranchNameIsTagNameException(_))
474    }
475    /// Returns `true` if the error kind is `PutFileError::BranchNameRequiredException`.
476    pub fn is_branch_name_required_exception(&self) -> bool {
477        matches!(self, Self::BranchNameRequiredException(_))
478    }
479    /// Returns `true` if the error kind is `PutFileError::CommitMessageLengthExceededException`.
480    pub fn is_commit_message_length_exceeded_exception(&self) -> bool {
481        matches!(self, Self::CommitMessageLengthExceededException(_))
482    }
483    /// Returns `true` if the error kind is `PutFileError::DirectoryNameConflictsWithFileNameException`.
484    pub fn is_directory_name_conflicts_with_file_name_exception(&self) -> bool {
485        matches!(self, Self::DirectoryNameConflictsWithFileNameException(_))
486    }
487    /// Returns `true` if the error kind is `PutFileError::EncryptionIntegrityChecksFailedException`.
488    pub fn is_encryption_integrity_checks_failed_exception(&self) -> bool {
489        matches!(self, Self::EncryptionIntegrityChecksFailedException(_))
490    }
491    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyAccessDeniedException`.
492    pub fn is_encryption_key_access_denied_exception(&self) -> bool {
493        matches!(self, Self::EncryptionKeyAccessDeniedException(_))
494    }
495    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyDisabledException`.
496    pub fn is_encryption_key_disabled_exception(&self) -> bool {
497        matches!(self, Self::EncryptionKeyDisabledException(_))
498    }
499    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyNotFoundException`.
500    pub fn is_encryption_key_not_found_exception(&self) -> bool {
501        matches!(self, Self::EncryptionKeyNotFoundException(_))
502    }
503    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyUnavailableException`.
504    pub fn is_encryption_key_unavailable_exception(&self) -> bool {
505        matches!(self, Self::EncryptionKeyUnavailableException(_))
506    }
507    /// Returns `true` if the error kind is `PutFileError::FileContentRequiredException`.
508    pub fn is_file_content_required_exception(&self) -> bool {
509        matches!(self, Self::FileContentRequiredException(_))
510    }
511    /// Returns `true` if the error kind is `PutFileError::FileContentSizeLimitExceededException`.
512    pub fn is_file_content_size_limit_exceeded_exception(&self) -> bool {
513        matches!(self, Self::FileContentSizeLimitExceededException(_))
514    }
515    /// Returns `true` if the error kind is `PutFileError::FileNameConflictsWithDirectoryNameException`.
516    pub fn is_file_name_conflicts_with_directory_name_exception(&self) -> bool {
517        matches!(self, Self::FileNameConflictsWithDirectoryNameException(_))
518    }
519    /// Returns `true` if the error kind is `PutFileError::FilePathConflictsWithSubmodulePathException`.
520    pub fn is_file_path_conflicts_with_submodule_path_exception(&self) -> bool {
521        matches!(self, Self::FilePathConflictsWithSubmodulePathException(_))
522    }
523    /// Returns `true` if the error kind is `PutFileError::FolderContentSizeLimitExceededException`.
524    pub fn is_folder_content_size_limit_exceeded_exception(&self) -> bool {
525        matches!(self, Self::FolderContentSizeLimitExceededException(_))
526    }
527    /// Returns `true` if the error kind is `PutFileError::InvalidBranchNameException`.
528    pub fn is_invalid_branch_name_exception(&self) -> bool {
529        matches!(self, Self::InvalidBranchNameException(_))
530    }
531    /// Returns `true` if the error kind is `PutFileError::InvalidDeletionParameterException`.
532    pub fn is_invalid_deletion_parameter_exception(&self) -> bool {
533        matches!(self, Self::InvalidDeletionParameterException(_))
534    }
535    /// Returns `true` if the error kind is `PutFileError::InvalidEmailException`.
536    pub fn is_invalid_email_exception(&self) -> bool {
537        matches!(self, Self::InvalidEmailException(_))
538    }
539    /// Returns `true` if the error kind is `PutFileError::InvalidFileModeException`.
540    pub fn is_invalid_file_mode_exception(&self) -> bool {
541        matches!(self, Self::InvalidFileModeException(_))
542    }
543    /// Returns `true` if the error kind is `PutFileError::InvalidParentCommitIdException`.
544    pub fn is_invalid_parent_commit_id_exception(&self) -> bool {
545        matches!(self, Self::InvalidParentCommitIdException(_))
546    }
547    /// Returns `true` if the error kind is `PutFileError::InvalidPathException`.
548    pub fn is_invalid_path_exception(&self) -> bool {
549        matches!(self, Self::InvalidPathException(_))
550    }
551    /// Returns `true` if the error kind is `PutFileError::InvalidRepositoryNameException`.
552    pub fn is_invalid_repository_name_exception(&self) -> bool {
553        matches!(self, Self::InvalidRepositoryNameException(_))
554    }
555    /// Returns `true` if the error kind is `PutFileError::NameLengthExceededException`.
556    pub fn is_name_length_exceeded_exception(&self) -> bool {
557        matches!(self, Self::NameLengthExceededException(_))
558    }
559    /// Returns `true` if the error kind is `PutFileError::ParentCommitDoesNotExistException`.
560    pub fn is_parent_commit_does_not_exist_exception(&self) -> bool {
561        matches!(self, Self::ParentCommitDoesNotExistException(_))
562    }
563    /// Returns `true` if the error kind is `PutFileError::ParentCommitIdOutdatedException`.
564    pub fn is_parent_commit_id_outdated_exception(&self) -> bool {
565        matches!(self, Self::ParentCommitIdOutdatedException(_))
566    }
567    /// Returns `true` if the error kind is `PutFileError::ParentCommitIdRequiredException`.
568    pub fn is_parent_commit_id_required_exception(&self) -> bool {
569        matches!(self, Self::ParentCommitIdRequiredException(_))
570    }
571    /// Returns `true` if the error kind is `PutFileError::PathRequiredException`.
572    pub fn is_path_required_exception(&self) -> bool {
573        matches!(self, Self::PathRequiredException(_))
574    }
575    /// Returns `true` if the error kind is `PutFileError::RepositoryDoesNotExistException`.
576    pub fn is_repository_does_not_exist_exception(&self) -> bool {
577        matches!(self, Self::RepositoryDoesNotExistException(_))
578    }
579    /// Returns `true` if the error kind is `PutFileError::RepositoryNameRequiredException`.
580    pub fn is_repository_name_required_exception(&self) -> bool {
581        matches!(self, Self::RepositoryNameRequiredException(_))
582    }
583    /// Returns `true` if the error kind is `PutFileError::SameFileContentException`.
584    pub fn is_same_file_content_exception(&self) -> bool {
585        matches!(self, Self::SameFileContentException(_))
586    }
587}
588impl ::std::error::Error for PutFileError {
589    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
590        match self {
591            Self::BranchDoesNotExistException(_inner) => ::std::option::Option::Some(_inner),
592            Self::BranchNameIsTagNameException(_inner) => ::std::option::Option::Some(_inner),
593            Self::BranchNameRequiredException(_inner) => ::std::option::Option::Some(_inner),
594            Self::CommitMessageLengthExceededException(_inner) => ::std::option::Option::Some(_inner),
595            Self::DirectoryNameConflictsWithFileNameException(_inner) => ::std::option::Option::Some(_inner),
596            Self::EncryptionIntegrityChecksFailedException(_inner) => ::std::option::Option::Some(_inner),
597            Self::EncryptionKeyAccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
598            Self::EncryptionKeyDisabledException(_inner) => ::std::option::Option::Some(_inner),
599            Self::EncryptionKeyNotFoundException(_inner) => ::std::option::Option::Some(_inner),
600            Self::EncryptionKeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
601            Self::FileContentRequiredException(_inner) => ::std::option::Option::Some(_inner),
602            Self::FileContentSizeLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
603            Self::FileNameConflictsWithDirectoryNameException(_inner) => ::std::option::Option::Some(_inner),
604            Self::FilePathConflictsWithSubmodulePathException(_inner) => ::std::option::Option::Some(_inner),
605            Self::FolderContentSizeLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
606            Self::InvalidBranchNameException(_inner) => ::std::option::Option::Some(_inner),
607            Self::InvalidDeletionParameterException(_inner) => ::std::option::Option::Some(_inner),
608            Self::InvalidEmailException(_inner) => ::std::option::Option::Some(_inner),
609            Self::InvalidFileModeException(_inner) => ::std::option::Option::Some(_inner),
610            Self::InvalidParentCommitIdException(_inner) => ::std::option::Option::Some(_inner),
611            Self::InvalidPathException(_inner) => ::std::option::Option::Some(_inner),
612            Self::InvalidRepositoryNameException(_inner) => ::std::option::Option::Some(_inner),
613            Self::NameLengthExceededException(_inner) => ::std::option::Option::Some(_inner),
614            Self::ParentCommitDoesNotExistException(_inner) => ::std::option::Option::Some(_inner),
615            Self::ParentCommitIdOutdatedException(_inner) => ::std::option::Option::Some(_inner),
616            Self::ParentCommitIdRequiredException(_inner) => ::std::option::Option::Some(_inner),
617            Self::PathRequiredException(_inner) => ::std::option::Option::Some(_inner),
618            Self::RepositoryDoesNotExistException(_inner) => ::std::option::Option::Some(_inner),
619            Self::RepositoryNameRequiredException(_inner) => ::std::option::Option::Some(_inner),
620            Self::SameFileContentException(_inner) => ::std::option::Option::Some(_inner),
621            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
622        }
623    }
624}
625impl ::std::fmt::Display for PutFileError {
626    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
627        match self {
628            Self::BranchDoesNotExistException(_inner) => _inner.fmt(f),
629            Self::BranchNameIsTagNameException(_inner) => _inner.fmt(f),
630            Self::BranchNameRequiredException(_inner) => _inner.fmt(f),
631            Self::CommitMessageLengthExceededException(_inner) => _inner.fmt(f),
632            Self::DirectoryNameConflictsWithFileNameException(_inner) => _inner.fmt(f),
633            Self::EncryptionIntegrityChecksFailedException(_inner) => _inner.fmt(f),
634            Self::EncryptionKeyAccessDeniedException(_inner) => _inner.fmt(f),
635            Self::EncryptionKeyDisabledException(_inner) => _inner.fmt(f),
636            Self::EncryptionKeyNotFoundException(_inner) => _inner.fmt(f),
637            Self::EncryptionKeyUnavailableException(_inner) => _inner.fmt(f),
638            Self::FileContentRequiredException(_inner) => _inner.fmt(f),
639            Self::FileContentSizeLimitExceededException(_inner) => _inner.fmt(f),
640            Self::FileNameConflictsWithDirectoryNameException(_inner) => _inner.fmt(f),
641            Self::FilePathConflictsWithSubmodulePathException(_inner) => _inner.fmt(f),
642            Self::FolderContentSizeLimitExceededException(_inner) => _inner.fmt(f),
643            Self::InvalidBranchNameException(_inner) => _inner.fmt(f),
644            Self::InvalidDeletionParameterException(_inner) => _inner.fmt(f),
645            Self::InvalidEmailException(_inner) => _inner.fmt(f),
646            Self::InvalidFileModeException(_inner) => _inner.fmt(f),
647            Self::InvalidParentCommitIdException(_inner) => _inner.fmt(f),
648            Self::InvalidPathException(_inner) => _inner.fmt(f),
649            Self::InvalidRepositoryNameException(_inner) => _inner.fmt(f),
650            Self::NameLengthExceededException(_inner) => _inner.fmt(f),
651            Self::ParentCommitDoesNotExistException(_inner) => _inner.fmt(f),
652            Self::ParentCommitIdOutdatedException(_inner) => _inner.fmt(f),
653            Self::ParentCommitIdRequiredException(_inner) => _inner.fmt(f),
654            Self::PathRequiredException(_inner) => _inner.fmt(f),
655            Self::RepositoryDoesNotExistException(_inner) => _inner.fmt(f),
656            Self::RepositoryNameRequiredException(_inner) => _inner.fmt(f),
657            Self::SameFileContentException(_inner) => _inner.fmt(f),
658            Self::Unhandled(_inner) => {
659                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
660                    write!(f, "unhandled error ({code})")
661                } else {
662                    f.write_str("unhandled error")
663                }
664            }
665        }
666    }
667}
668impl ::aws_smithy_types::retry::ProvideErrorKind for PutFileError {
669    fn code(&self) -> ::std::option::Option<&str> {
670        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
671    }
672    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
673        ::std::option::Option::None
674    }
675}
676impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for PutFileError {
677    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
678        match self {
679            Self::BranchDoesNotExistException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
680            Self::BranchNameIsTagNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
681            Self::BranchNameRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
682            Self::CommitMessageLengthExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
683            Self::DirectoryNameConflictsWithFileNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
684            Self::EncryptionIntegrityChecksFailedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
685            Self::EncryptionKeyAccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
686            Self::EncryptionKeyDisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
687            Self::EncryptionKeyNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
688            Self::EncryptionKeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
689            Self::FileContentRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
690            Self::FileContentSizeLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
691            Self::FileNameConflictsWithDirectoryNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
692            Self::FilePathConflictsWithSubmodulePathException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
693            Self::FolderContentSizeLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
694            Self::InvalidBranchNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
695            Self::InvalidDeletionParameterException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
696            Self::InvalidEmailException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
697            Self::InvalidFileModeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
698            Self::InvalidParentCommitIdException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
699            Self::InvalidPathException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
700            Self::InvalidRepositoryNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
701            Self::NameLengthExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
702            Self::ParentCommitDoesNotExistException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
703            Self::ParentCommitIdOutdatedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
704            Self::ParentCommitIdRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
705            Self::PathRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
706            Self::RepositoryDoesNotExistException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
707            Self::RepositoryNameRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
708            Self::SameFileContentException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
709            Self::Unhandled(_inner) => &_inner.meta,
710        }
711    }
712}
713impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for PutFileError {
714    fn create_unhandled_error(
715        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
716        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
717    ) -> Self {
718        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
719            source,
720            meta: meta.unwrap_or_default(),
721        })
722    }
723}
724impl ::aws_types::request_id::RequestId for crate::operation::put_file::PutFileError {
725    fn request_id(&self) -> Option<&str> {
726        self.meta().request_id()
727    }
728}
729
730pub use crate::operation::put_file::_put_file_input::PutFileInput;
731
732pub use crate::operation::put_file::_put_file_output::PutFileOutput;
733
734mod _put_file_input;
735
736mod _put_file_output;
737
738/// Builders
739pub mod builders;