aws_sdk_codecommit/operation/put_file/
_put_file_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct PutFileOutput {
6    /// <p>The full SHA ID of the commit that contains this file change.</p>
7    pub commit_id: ::std::string::String,
8    /// <p>The ID of the blob, which is its SHA-1 pointer.</p>
9    pub blob_id: ::std::string::String,
10    /// <p>The full SHA-1 pointer of the tree information for the commit that contains this file change.</p>
11    pub tree_id: ::std::string::String,
12    _request_id: Option<String>,
13}
14impl PutFileOutput {
15    /// <p>The full SHA ID of the commit that contains this file change.</p>
16    pub fn commit_id(&self) -> &str {
17        use std::ops::Deref;
18        self.commit_id.deref()
19    }
20    /// <p>The ID of the blob, which is its SHA-1 pointer.</p>
21    pub fn blob_id(&self) -> &str {
22        use std::ops::Deref;
23        self.blob_id.deref()
24    }
25    /// <p>The full SHA-1 pointer of the tree information for the commit that contains this file change.</p>
26    pub fn tree_id(&self) -> &str {
27        use std::ops::Deref;
28        self.tree_id.deref()
29    }
30}
31impl ::aws_types::request_id::RequestId for PutFileOutput {
32    fn request_id(&self) -> Option<&str> {
33        self._request_id.as_deref()
34    }
35}
36impl PutFileOutput {
37    /// Creates a new builder-style object to manufacture [`PutFileOutput`](crate::operation::put_file::PutFileOutput).
38    pub fn builder() -> crate::operation::put_file::builders::PutFileOutputBuilder {
39        crate::operation::put_file::builders::PutFileOutputBuilder::default()
40    }
41}
42
43/// A builder for [`PutFileOutput`](crate::operation::put_file::PutFileOutput).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct PutFileOutputBuilder {
47    pub(crate) commit_id: ::std::option::Option<::std::string::String>,
48    pub(crate) blob_id: ::std::option::Option<::std::string::String>,
49    pub(crate) tree_id: ::std::option::Option<::std::string::String>,
50    _request_id: Option<String>,
51}
52impl PutFileOutputBuilder {
53    /// <p>The full SHA ID of the commit that contains this file change.</p>
54    /// This field is required.
55    pub fn commit_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.commit_id = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The full SHA ID of the commit that contains this file change.</p>
60    pub fn set_commit_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.commit_id = input;
62        self
63    }
64    /// <p>The full SHA ID of the commit that contains this file change.</p>
65    pub fn get_commit_id(&self) -> &::std::option::Option<::std::string::String> {
66        &self.commit_id
67    }
68    /// <p>The ID of the blob, which is its SHA-1 pointer.</p>
69    /// This field is required.
70    pub fn blob_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.blob_id = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The ID of the blob, which is its SHA-1 pointer.</p>
75    pub fn set_blob_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.blob_id = input;
77        self
78    }
79    /// <p>The ID of the blob, which is its SHA-1 pointer.</p>
80    pub fn get_blob_id(&self) -> &::std::option::Option<::std::string::String> {
81        &self.blob_id
82    }
83    /// <p>The full SHA-1 pointer of the tree information for the commit that contains this file change.</p>
84    /// This field is required.
85    pub fn tree_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
86        self.tree_id = ::std::option::Option::Some(input.into());
87        self
88    }
89    /// <p>The full SHA-1 pointer of the tree information for the commit that contains this file change.</p>
90    pub fn set_tree_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
91        self.tree_id = input;
92        self
93    }
94    /// <p>The full SHA-1 pointer of the tree information for the commit that contains this file change.</p>
95    pub fn get_tree_id(&self) -> &::std::option::Option<::std::string::String> {
96        &self.tree_id
97    }
98    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
99        self._request_id = Some(request_id.into());
100        self
101    }
102
103    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
104        self._request_id = request_id;
105        self
106    }
107    /// Consumes the builder and constructs a [`PutFileOutput`](crate::operation::put_file::PutFileOutput).
108    /// This method will fail if any of the following fields are not set:
109    /// - [`commit_id`](crate::operation::put_file::builders::PutFileOutputBuilder::commit_id)
110    /// - [`blob_id`](crate::operation::put_file::builders::PutFileOutputBuilder::blob_id)
111    /// - [`tree_id`](crate::operation::put_file::builders::PutFileOutputBuilder::tree_id)
112    pub fn build(self) -> ::std::result::Result<crate::operation::put_file::PutFileOutput, ::aws_smithy_types::error::operation::BuildError> {
113        ::std::result::Result::Ok(crate::operation::put_file::PutFileOutput {
114            commit_id: self.commit_id.ok_or_else(|| {
115                ::aws_smithy_types::error::operation::BuildError::missing_field(
116                    "commit_id",
117                    "commit_id was not specified but it is required when building PutFileOutput",
118                )
119            })?,
120            blob_id: self.blob_id.ok_or_else(|| {
121                ::aws_smithy_types::error::operation::BuildError::missing_field(
122                    "blob_id",
123                    "blob_id was not specified but it is required when building PutFileOutput",
124                )
125            })?,
126            tree_id: self.tree_id.ok_or_else(|| {
127                ::aws_smithy_types::error::operation::BuildError::missing_field(
128                    "tree_id",
129                    "tree_id was not specified but it is required when building PutFileOutput",
130                )
131            })?,
132            _request_id: self._request_id,
133        })
134    }
135}