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