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
141        ::std::borrow::Cow::Owned(rcb)
142    }
143}
144
145#[derive(Debug)]
146struct PutFileTelemetryInputCaptureInterceptor;
147
148#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
149impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutFileTelemetryInputCaptureInterceptor {
150    fn name(&self) -> &'static str {
151        "PutFileTelemetryInputCaptureInterceptor"
152    }
153
154    fn read_before_execution(
155        &self,
156        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
157            '_,
158            ::aws_smithy_runtime_api::client::interceptors::context::Input,
159            ::aws_smithy_runtime_api::client::interceptors::context::Output,
160            ::aws_smithy_runtime_api::client::interceptors::context::Error,
161        >,
162        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
163    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
164        // Nothing to do unless the customer opted in by naming members to record.
165        let ::std::option::Option::Some(requested) = cfg
166            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
167            .filter(|r| !r.is_empty())
168        else {
169            return ::std::result::Result::Ok(());
170        };
171
172        let ::std::option::Option::Some(input) = context.input().downcast_ref::<PutFileInput>() else {
173            // A mismatched input is not this interceptor's concern; skip quietly.
174            return ::std::result::Result::Ok(());
175        };
176
177        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
178        if requested.should_capture("repositoryName") {
179            if let ::std::option::Option::Some(value) = input.repository_name.as_deref() {
180                captured.insert("repositoryName", value);
181            }
182        }
183        if requested.should_capture("branchName") {
184            if let ::std::option::Option::Some(value) = input.branch_name.as_deref() {
185                captured.insert("branchName", value);
186            }
187        }
188        if requested.should_capture("filePath") {
189            if let ::std::option::Option::Some(value) = input.file_path.as_deref() {
190                captured.insert("filePath", value);
191            }
192        }
193        if requested.should_capture("parentCommitId") {
194            if let ::std::option::Option::Some(value) = input.parent_commit_id.as_deref() {
195                captured.insert("parentCommitId", value);
196            }
197        }
198        if requested.should_capture("commitMessage") {
199            if let ::std::option::Option::Some(value) = input.commit_message.as_deref() {
200                captured.insert("commitMessage", value);
201            }
202        }
203        if requested.should_capture("name") {
204            if let ::std::option::Option::Some(value) = input.name.as_deref() {
205                captured.insert("name", value);
206            }
207        }
208        if requested.should_capture("email") {
209            if let ::std::option::Option::Some(value) = input.email.as_deref() {
210                captured.insert("email", value);
211            }
212        }
213
214        cfg.interceptor_state().store_put(captured);
215        ::std::result::Result::Ok(())
216    }
217}
218#[derive(Debug)]
219struct PutFileResponseDeserializer;
220impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutFileResponseDeserializer {
221    fn deserialize_nonstreaming_with_config(
222        &self,
223        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
224        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
225    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
226        let (success, status) = (response.status().is_success(), response.status().as_u16());
227        let headers = response.headers();
228        let body = response.body().bytes().expect("body loaded");
229        #[allow(unused_mut)]
230        let mut force_error = false;
231        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
232        let parse_result = if !success && status != 200 || force_error {
233            crate::protocol_serde::shape_put_file::de_put_file_http_error(status, headers, body)
234        } else {
235            crate::protocol_serde::shape_put_file::de_put_file_http_response(status, headers, body)
236        };
237        crate::protocol_serde::type_erase_result(parse_result)
238    }
239}
240#[derive(Debug)]
241struct PutFileRequestSerializer;
242impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutFileRequestSerializer {
243    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
244    fn serialize_input(
245        &self,
246        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
247        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
248    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
249        let input = input.downcast::<crate::operation::put_file::PutFileInput>().expect("correct type");
250        let _header_serialization_settings = _cfg
251            .load::<crate::serialization_settings::HeaderSerializationSettings>()
252            .cloned()
253            .unwrap_or_default();
254        let mut request_builder = {
255            #[allow(clippy::uninlined_format_args)]
256            fn uri_base(
257                _input: &crate::operation::put_file::PutFileInput,
258                output: &mut ::std::string::String,
259            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
260                use ::std::fmt::Write as _;
261                ::std::write!(output, "/").expect("formatting should succeed");
262                ::std::result::Result::Ok(())
263            }
264            #[allow(clippy::unnecessary_wraps)]
265            fn update_http_builder(
266                input: &crate::operation::put_file::PutFileInput,
267                builder: ::http_1x::request::Builder,
268            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
269                let mut uri = ::std::string::String::new();
270                uri_base(input, &mut uri)?;
271                ::std::result::Result::Ok(builder.method("POST").uri(uri))
272            }
273            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
274            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
275            builder = _header_serialization_settings.set_default_header(
276                builder,
277                ::http_1x::header::HeaderName::from_static("x-amz-target"),
278                "CodeCommit_20150413.PutFile",
279            );
280            builder
281        };
282        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_put_file::ser_put_file_input(&input)?);
283        if let Some(content_length) = body.content_length() {
284            let content_length = content_length.to_string();
285            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
286        }
287        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
288    }
289}
290#[derive(Debug)]
291struct PutFileEndpointParamsInterceptor;
292
293#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
294impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutFileEndpointParamsInterceptor {
295    fn name(&self) -> &'static str {
296        "PutFileEndpointParamsInterceptor"
297    }
298
299    fn read_before_execution(
300        &self,
301        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
302            '_,
303            ::aws_smithy_runtime_api::client::interceptors::context::Input,
304            ::aws_smithy_runtime_api::client::interceptors::context::Output,
305            ::aws_smithy_runtime_api::client::interceptors::context::Error,
306        >,
307        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
308    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
309        let _input = context
310            .input()
311            .downcast_ref::<PutFileInput>()
312            .ok_or("failed to downcast to PutFileInput")?;
313
314        let params = crate::config::endpoint::Params::builder()
315            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
316            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
317            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
318            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
319            .build()
320            .map_err(|err| {
321                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
322            })?;
323        cfg.interceptor_state()
324            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
325        ::std::result::Result::Ok(())
326    }
327}
328
329// The get_* functions below are generated from JMESPath expressions in the
330// operationContextParams trait. They target the operation's input shape.
331
332/// Error type for the `PutFileError` operation.
333#[non_exhaustive]
334#[derive(::std::fmt::Debug)]
335pub enum PutFileError {
336    /// <p>The specified branch does not exist.</p>
337    BranchDoesNotExistException(crate::types::error::BranchDoesNotExistException),
338    /// <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>
339    BranchNameIsTagNameException(crate::types::error::BranchNameIsTagNameException),
340    /// <p>A branch name is required, but was not specified.</p>
341    BranchNameRequiredException(crate::types::error::BranchNameRequiredException),
342    /// <p>The commit message is too long. Provide a shorter string.</p>
343    CommitMessageLengthExceededException(crate::types::error::CommitMessageLengthExceededException),
344    /// <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>
345    DirectoryNameConflictsWithFileNameException(crate::types::error::DirectoryNameConflictsWithFileNameException),
346    /// <p>An encryption integrity check failed.</p>
347    EncryptionIntegrityChecksFailedException(crate::types::error::EncryptionIntegrityChecksFailedException),
348    /// <p>An encryption key could not be accessed.</p>
349    EncryptionKeyAccessDeniedException(crate::types::error::EncryptionKeyAccessDeniedException),
350    /// <p>The encryption key is disabled.</p>
351    EncryptionKeyDisabledException(crate::types::error::EncryptionKeyDisabledException),
352    /// <p>No encryption key was found.</p>
353    EncryptionKeyNotFoundException(crate::types::error::EncryptionKeyNotFoundException),
354    /// <p>The encryption key is not available.</p>
355    EncryptionKeyUnavailableException(crate::types::error::EncryptionKeyUnavailableException),
356    /// <p>The file cannot be added because it is empty. Empty files cannot be added to the repository with this API.</p>
357    FileContentRequiredException(crate::types::error::FileContentRequiredException),
358    /// <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>
359    FileContentSizeLimitExceededException(crate::types::error::FileContentSizeLimitExceededException),
360    /// <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>
361    FileNameConflictsWithDirectoryNameException(crate::types::error::FileNameConflictsWithDirectoryNameException),
362    /// <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>
363    FilePathConflictsWithSubmodulePathException(crate::types::error::FilePathConflictsWithSubmodulePathException),
364    /// <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>
365    FolderContentSizeLimitExceededException(crate::types::error::FolderContentSizeLimitExceededException),
366    /// <p>The specified reference name is not valid.</p>
367    InvalidBranchNameException(crate::types::error::InvalidBranchNameException),
368    /// <p>The specified deletion parameter is not valid.</p>
369    InvalidDeletionParameterException(crate::types::error::InvalidDeletionParameterException),
370    /// <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>
371    InvalidEmailException(crate::types::error::InvalidEmailException),
372    /// <p>The specified file mode permission is not valid. For a list of valid file mode permissions, see <code>PutFile</code>.</p>
373    InvalidFileModeException(crate::types::error::InvalidFileModeException),
374    /// <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>
375    InvalidParentCommitIdException(crate::types::error::InvalidParentCommitIdException),
376    /// <p>The specified path is not valid.</p>
377    InvalidPathException(crate::types::error::InvalidPathException),
378    /// <p>A specified repository name is not valid.</p><note>
379    /// <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>
380    /// </note>
381    InvalidRepositoryNameException(crate::types::error::InvalidRepositoryNameException),
382    /// <p>The user name is not valid because it has exceeded the character limit for author names.</p>
383    NameLengthExceededException(crate::types::error::NameLengthExceededException),
384    /// <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>
385    ParentCommitDoesNotExistException(crate::types::error::ParentCommitDoesNotExistException),
386    /// <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>
387    ParentCommitIdOutdatedException(crate::types::error::ParentCommitIdOutdatedException),
388    /// <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>
389    ParentCommitIdRequiredException(crate::types::error::ParentCommitIdRequiredException),
390    /// <p>The folderPath for a location cannot be null.</p>
391    PathRequiredException(crate::types::error::PathRequiredException),
392    /// <p>The specified repository does not exist.</p>
393    RepositoryDoesNotExistException(crate::types::error::RepositoryDoesNotExistException),
394    /// <p>A repository name is required, but was not specified.</p>
395    RepositoryNameRequiredException(crate::types::error::RepositoryNameRequiredException),
396    /// <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>
397    SameFileContentException(crate::types::error::SameFileContentException),
398    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
399    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
400    variable wildcard pattern and check `.code()`:
401     \
402    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
403     \
404    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-PutFileError) for what information is available for the error.")]
405    Unhandled(crate::error::sealed_unhandled::Unhandled),
406}
407impl PutFileError {
408    /// Creates the `PutFileError::Unhandled` variant from any error type.
409    pub fn unhandled(
410        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
411    ) -> Self {
412        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
413            source: err.into(),
414            meta: ::std::default::Default::default(),
415        })
416    }
417
418    /// Creates the `PutFileError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
419    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
420        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
421            source: err.clone().into(),
422            meta: err,
423        })
424    }
425    ///
426    /// Returns error metadata, which includes the error code, message,
427    /// request ID, and potentially additional information.
428    ///
429    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
430        match self {
431            Self::BranchDoesNotExistException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
432            Self::BranchNameIsTagNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
433            Self::BranchNameRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
434            Self::CommitMessageLengthExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
435            Self::DirectoryNameConflictsWithFileNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
436            Self::EncryptionIntegrityChecksFailedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
437            Self::EncryptionKeyAccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
438            Self::EncryptionKeyDisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
439            Self::EncryptionKeyNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
440            Self::EncryptionKeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
441            Self::FileContentRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
442            Self::FileContentSizeLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
443            Self::FileNameConflictsWithDirectoryNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
444            Self::FilePathConflictsWithSubmodulePathException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
445            Self::FolderContentSizeLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
446            Self::InvalidBranchNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
447            Self::InvalidDeletionParameterException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
448            Self::InvalidEmailException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
449            Self::InvalidFileModeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
450            Self::InvalidParentCommitIdException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
451            Self::InvalidPathException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
452            Self::InvalidRepositoryNameException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
453            Self::NameLengthExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
454            Self::ParentCommitDoesNotExistException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
455            Self::ParentCommitIdOutdatedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
456            Self::ParentCommitIdRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
457            Self::PathRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
458            Self::RepositoryDoesNotExistException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
459            Self::RepositoryNameRequiredException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
460            Self::SameFileContentException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
461            Self::Unhandled(e) => &e.meta,
462        }
463    }
464    /// Returns `true` if the error kind is `PutFileError::BranchDoesNotExistException`.
465    pub fn is_branch_does_not_exist_exception(&self) -> bool {
466        matches!(self, Self::BranchDoesNotExistException(_))
467    }
468    /// Returns `true` if the error kind is `PutFileError::BranchNameIsTagNameException`.
469    pub fn is_branch_name_is_tag_name_exception(&self) -> bool {
470        matches!(self, Self::BranchNameIsTagNameException(_))
471    }
472    /// Returns `true` if the error kind is `PutFileError::BranchNameRequiredException`.
473    pub fn is_branch_name_required_exception(&self) -> bool {
474        matches!(self, Self::BranchNameRequiredException(_))
475    }
476    /// Returns `true` if the error kind is `PutFileError::CommitMessageLengthExceededException`.
477    pub fn is_commit_message_length_exceeded_exception(&self) -> bool {
478        matches!(self, Self::CommitMessageLengthExceededException(_))
479    }
480    /// Returns `true` if the error kind is `PutFileError::DirectoryNameConflictsWithFileNameException`.
481    pub fn is_directory_name_conflicts_with_file_name_exception(&self) -> bool {
482        matches!(self, Self::DirectoryNameConflictsWithFileNameException(_))
483    }
484    /// Returns `true` if the error kind is `PutFileError::EncryptionIntegrityChecksFailedException`.
485    pub fn is_encryption_integrity_checks_failed_exception(&self) -> bool {
486        matches!(self, Self::EncryptionIntegrityChecksFailedException(_))
487    }
488    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyAccessDeniedException`.
489    pub fn is_encryption_key_access_denied_exception(&self) -> bool {
490        matches!(self, Self::EncryptionKeyAccessDeniedException(_))
491    }
492    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyDisabledException`.
493    pub fn is_encryption_key_disabled_exception(&self) -> bool {
494        matches!(self, Self::EncryptionKeyDisabledException(_))
495    }
496    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyNotFoundException`.
497    pub fn is_encryption_key_not_found_exception(&self) -> bool {
498        matches!(self, Self::EncryptionKeyNotFoundException(_))
499    }
500    /// Returns `true` if the error kind is `PutFileError::EncryptionKeyUnavailableException`.
501    pub fn is_encryption_key_unavailable_exception(&self) -> bool {
502        matches!(self, Self::EncryptionKeyUnavailableException(_))
503    }
504    /// Returns `true` if the error kind is `PutFileError::FileContentRequiredException`.
505    pub fn is_file_content_required_exception(&self) -> bool {
506        matches!(self, Self::FileContentRequiredException(_))
507    }
508    /// Returns `true` if the error kind is `PutFileError::FileContentSizeLimitExceededException`.
509    pub fn is_file_content_size_limit_exceeded_exception(&self) -> bool {
510        matches!(self, Self::FileContentSizeLimitExceededException(_))
511    }
512    /// Returns `true` if the error kind is `PutFileError::FileNameConflictsWithDirectoryNameException`.
513    pub fn is_file_name_conflicts_with_directory_name_exception(&self) -> bool {
514        matches!(self, Self::FileNameConflictsWithDirectoryNameException(_))
515    }
516    /// Returns `true` if the error kind is `PutFileError::FilePathConflictsWithSubmodulePathException`.
517    pub fn is_file_path_conflicts_with_submodule_path_exception(&self) -> bool {
518        matches!(self, Self::FilePathConflictsWithSubmodulePathException(_))
519    }
520    /// Returns `true` if the error kind is `PutFileError::FolderContentSizeLimitExceededException`.
521    pub fn is_folder_content_size_limit_exceeded_exception(&self) -> bool {
522        matches!(self, Self::FolderContentSizeLimitExceededException(_))
523    }
524    /// Returns `true` if the error kind is `PutFileError::InvalidBranchNameException`.
525    pub fn is_invalid_branch_name_exception(&self) -> bool {
526        matches!(self, Self::InvalidBranchNameException(_))
527    }
528    /// Returns `true` if the error kind is `PutFileError::InvalidDeletionParameterException`.
529    pub fn is_invalid_deletion_parameter_exception(&self) -> bool {
530        matches!(self, Self::InvalidDeletionParameterException(_))
531    }
532    /// Returns `true` if the error kind is `PutFileError::InvalidEmailException`.
533    pub fn is_invalid_email_exception(&self) -> bool {
534        matches!(self, Self::InvalidEmailException(_))
535    }
536    /// Returns `true` if the error kind is `PutFileError::InvalidFileModeException`.
537    pub fn is_invalid_file_mode_exception(&self) -> bool {
538        matches!(self, Self::InvalidFileModeException(_))
539    }
540    /// Returns `true` if the error kind is `PutFileError::InvalidParentCommitIdException`.
541    pub fn is_invalid_parent_commit_id_exception(&self) -> bool {
542        matches!(self, Self::InvalidParentCommitIdException(_))
543    }
544    /// Returns `true` if the error kind is `PutFileError::InvalidPathException`.
545    pub fn is_invalid_path_exception(&self) -> bool {
546        matches!(self, Self::InvalidPathException(_))
547    }
548    /// Returns `true` if the error kind is `PutFileError::InvalidRepositoryNameException`.
549    pub fn is_invalid_repository_name_exception(&self) -> bool {
550        matches!(self, Self::InvalidRepositoryNameException(_))
551    }
552    /// Returns `true` if the error kind is `PutFileError::NameLengthExceededException`.
553    pub fn is_name_length_exceeded_exception(&self) -> bool {
554        matches!(self, Self::NameLengthExceededException(_))
555    }
556    /// Returns `true` if the error kind is `PutFileError::ParentCommitDoesNotExistException`.
557    pub fn is_parent_commit_does_not_exist_exception(&self) -> bool {
558        matches!(self, Self::ParentCommitDoesNotExistException(_))
559    }
560    /// Returns `true` if the error kind is `PutFileError::ParentCommitIdOutdatedException`.
561    pub fn is_parent_commit_id_outdated_exception(&self) -> bool {
562        matches!(self, Self::ParentCommitIdOutdatedException(_))
563    }
564    /// Returns `true` if the error kind is `PutFileError::ParentCommitIdRequiredException`.
565    pub fn is_parent_commit_id_required_exception(&self) -> bool {
566        matches!(self, Self::ParentCommitIdRequiredException(_))
567    }
568    /// Returns `true` if the error kind is `PutFileError::PathRequiredException`.
569    pub fn is_path_required_exception(&self) -> bool {
570        matches!(self, Self::PathRequiredException(_))
571    }
572    /// Returns `true` if the error kind is `PutFileError::RepositoryDoesNotExistException`.
573    pub fn is_repository_does_not_exist_exception(&self) -> bool {
574        matches!(self, Self::RepositoryDoesNotExistException(_))
575    }
576    /// Returns `true` if the error kind is `PutFileError::RepositoryNameRequiredException`.
577    pub fn is_repository_name_required_exception(&self) -> bool {
578        matches!(self, Self::RepositoryNameRequiredException(_))
579    }
580    /// Returns `true` if the error kind is `PutFileError::SameFileContentException`.
581    pub fn is_same_file_content_exception(&self) -> bool {
582        matches!(self, Self::SameFileContentException(_))
583    }
584}
585impl ::std::error::Error for PutFileError {
586    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
587        match self {
588            Self::BranchDoesNotExistException(_inner) => ::std::option::Option::Some(_inner),
589            Self::BranchNameIsTagNameException(_inner) => ::std::option::Option::Some(_inner),
590            Self::BranchNameRequiredException(_inner) => ::std::option::Option::Some(_inner),
591            Self::CommitMessageLengthExceededException(_inner) => ::std::option::Option::Some(_inner),
592            Self::DirectoryNameConflictsWithFileNameException(_inner) => ::std::option::Option::Some(_inner),
593            Self::EncryptionIntegrityChecksFailedException(_inner) => ::std::option::Option::Some(_inner),
594            Self::EncryptionKeyAccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
595            Self::EncryptionKeyDisabledException(_inner) => ::std::option::Option::Some(_inner),
596            Self::EncryptionKeyNotFoundException(_inner) => ::std::option::Option::Some(_inner),
597            Self::EncryptionKeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
598            Self::FileContentRequiredException(_inner) => ::std::option::Option::Some(_inner),
599            Self::FileContentSizeLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
600            Self::FileNameConflictsWithDirectoryNameException(_inner) => ::std::option::Option::Some(_inner),
601            Self::FilePathConflictsWithSubmodulePathException(_inner) => ::std::option::Option::Some(_inner),
602            Self::FolderContentSizeLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
603            Self::InvalidBranchNameException(_inner) => ::std::option::Option::Some(_inner),
604            Self::InvalidDeletionParameterException(_inner) => ::std::option::Option::Some(_inner),
605            Self::InvalidEmailException(_inner) => ::std::option::Option::Some(_inner),
606            Self::InvalidFileModeException(_inner) => ::std::option::Option::Some(_inner),
607            Self::InvalidParentCommitIdException(_inner) => ::std::option::Option::Some(_inner),
608            Self::InvalidPathException(_inner) => ::std::option::Option::Some(_inner),
609            Self::InvalidRepositoryNameException(_inner) => ::std::option::Option::Some(_inner),
610            Self::NameLengthExceededException(_inner) => ::std::option::Option::Some(_inner),
611            Self::ParentCommitDoesNotExistException(_inner) => ::std::option::Option::Some(_inner),
612            Self::ParentCommitIdOutdatedException(_inner) => ::std::option::Option::Some(_inner),
613            Self::ParentCommitIdRequiredException(_inner) => ::std::option::Option::Some(_inner),
614            Self::PathRequiredException(_inner) => ::std::option::Option::Some(_inner),
615            Self::RepositoryDoesNotExistException(_inner) => ::std::option::Option::Some(_inner),
616            Self::RepositoryNameRequiredException(_inner) => ::std::option::Option::Some(_inner),
617            Self::SameFileContentException(_inner) => ::std::option::Option::Some(_inner),
618            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
619        }
620    }
621}
622impl ::std::fmt::Display for PutFileError {
623    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
624        match self {
625            Self::BranchDoesNotExistException(_inner) => _inner.fmt(f),
626            Self::BranchNameIsTagNameException(_inner) => _inner.fmt(f),
627            Self::BranchNameRequiredException(_inner) => _inner.fmt(f),
628            Self::CommitMessageLengthExceededException(_inner) => _inner.fmt(f),
629            Self::DirectoryNameConflictsWithFileNameException(_inner) => _inner.fmt(f),
630            Self::EncryptionIntegrityChecksFailedException(_inner) => _inner.fmt(f),
631            Self::EncryptionKeyAccessDeniedException(_inner) => _inner.fmt(f),
632            Self::EncryptionKeyDisabledException(_inner) => _inner.fmt(f),
633            Self::EncryptionKeyNotFoundException(_inner) => _inner.fmt(f),
634            Self::EncryptionKeyUnavailableException(_inner) => _inner.fmt(f),
635            Self::FileContentRequiredException(_inner) => _inner.fmt(f),
636            Self::FileContentSizeLimitExceededException(_inner) => _inner.fmt(f),
637            Self::FileNameConflictsWithDirectoryNameException(_inner) => _inner.fmt(f),
638            Self::FilePathConflictsWithSubmodulePathException(_inner) => _inner.fmt(f),
639            Self::FolderContentSizeLimitExceededException(_inner) => _inner.fmt(f),
640            Self::InvalidBranchNameException(_inner) => _inner.fmt(f),
641            Self::InvalidDeletionParameterException(_inner) => _inner.fmt(f),
642            Self::InvalidEmailException(_inner) => _inner.fmt(f),
643            Self::InvalidFileModeException(_inner) => _inner.fmt(f),
644            Self::InvalidParentCommitIdException(_inner) => _inner.fmt(f),
645            Self::InvalidPathException(_inner) => _inner.fmt(f),
646            Self::InvalidRepositoryNameException(_inner) => _inner.fmt(f),
647            Self::NameLengthExceededException(_inner) => _inner.fmt(f),
648            Self::ParentCommitDoesNotExistException(_inner) => _inner.fmt(f),
649            Self::ParentCommitIdOutdatedException(_inner) => _inner.fmt(f),
650            Self::ParentCommitIdRequiredException(_inner) => _inner.fmt(f),
651            Self::PathRequiredException(_inner) => _inner.fmt(f),
652            Self::RepositoryDoesNotExistException(_inner) => _inner.fmt(f),
653            Self::RepositoryNameRequiredException(_inner) => _inner.fmt(f),
654            Self::SameFileContentException(_inner) => _inner.fmt(f),
655            Self::Unhandled(_inner) => {
656                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
657                    write!(f, "unhandled error ({code})")
658                } else {
659                    f.write_str("unhandled error")
660                }
661            }
662        }
663    }
664}
665impl ::aws_smithy_types::retry::ProvideErrorKind for PutFileError {
666    fn code(&self) -> ::std::option::Option<&str> {
667        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
668    }
669    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
670        ::std::option::Option::None
671    }
672}
673impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for PutFileError {
674    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
675        match self {
676            Self::BranchDoesNotExistException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
677            Self::BranchNameIsTagNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
678            Self::BranchNameRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
679            Self::CommitMessageLengthExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
680            Self::DirectoryNameConflictsWithFileNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
681            Self::EncryptionIntegrityChecksFailedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
682            Self::EncryptionKeyAccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
683            Self::EncryptionKeyDisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
684            Self::EncryptionKeyNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
685            Self::EncryptionKeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
686            Self::FileContentRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
687            Self::FileContentSizeLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
688            Self::FileNameConflictsWithDirectoryNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
689            Self::FilePathConflictsWithSubmodulePathException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
690            Self::FolderContentSizeLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
691            Self::InvalidBranchNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
692            Self::InvalidDeletionParameterException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
693            Self::InvalidEmailException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
694            Self::InvalidFileModeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
695            Self::InvalidParentCommitIdException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
696            Self::InvalidPathException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
697            Self::InvalidRepositoryNameException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
698            Self::NameLengthExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
699            Self::ParentCommitDoesNotExistException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
700            Self::ParentCommitIdOutdatedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
701            Self::ParentCommitIdRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
702            Self::PathRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
703            Self::RepositoryDoesNotExistException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
704            Self::RepositoryNameRequiredException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
705            Self::SameFileContentException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
706            Self::Unhandled(_inner) => &_inner.meta,
707        }
708    }
709}
710impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for PutFileError {
711    fn create_unhandled_error(
712        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
713        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
714    ) -> Self {
715        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
716            source,
717            meta: meta.unwrap_or_default(),
718        })
719    }
720}
721impl ::aws_types::request_id::RequestId for crate::operation::put_file::PutFileError {
722    fn request_id(&self) -> Option<&str> {
723        self.meta().request_id()
724    }
725}
726
727pub use crate::operation::put_file::_put_file_input::PutFileInput;
728
729pub use crate::operation::put_file::_put_file_output::PutFileOutput;
730
731mod _put_file_input;
732
733mod _put_file_output;
734
735/// Builders
736pub mod builders;