aws_sdk_codecommit/operation/get_file/
_get_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 GetFileOutput {
6    /// <p>The full commit ID of the commit that contains the content returned by GetFile.</p>
7    pub commit_id: ::std::string::String,
8    /// <p>The blob ID of the object that represents the file content.</p>
9    pub blob_id: ::std::string::String,
10    /// <p>The fully qualified path to the specified file. Returns the name and extension of the file.</p>
11    pub file_path: ::std::string::String,
12    /// <p>The extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values.</p><note>
13    /// <p>The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See the supported return values.</p>
14    /// </note>
15    pub file_mode: crate::types::FileModeTypeEnum,
16    /// <p>The size of the contents of the file, in bytes.</p>
17    pub file_size: i64,
18    /// <p>The base-64 encoded binary data object that represents the content of the file.</p>
19    pub file_content: ::aws_smithy_types::Blob,
20    _request_id: Option<String>,
21}
22impl GetFileOutput {
23    /// <p>The full commit ID of the commit that contains the content returned by GetFile.</p>
24    pub fn commit_id(&self) -> &str {
25        use std::ops::Deref;
26        self.commit_id.deref()
27    }
28    /// <p>The blob ID of the object that represents the file content.</p>
29    pub fn blob_id(&self) -> &str {
30        use std::ops::Deref;
31        self.blob_id.deref()
32    }
33    /// <p>The fully qualified path to the specified file. Returns the name and extension of the file.</p>
34    pub fn file_path(&self) -> &str {
35        use std::ops::Deref;
36        self.file_path.deref()
37    }
38    /// <p>The extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values.</p><note>
39    /// <p>The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See the supported return values.</p>
40    /// </note>
41    pub fn file_mode(&self) -> &crate::types::FileModeTypeEnum {
42        &self.file_mode
43    }
44    /// <p>The size of the contents of the file, in bytes.</p>
45    pub fn file_size(&self) -> i64 {
46        self.file_size
47    }
48    /// <p>The base-64 encoded binary data object that represents the content of the file.</p>
49    pub fn file_content(&self) -> &::aws_smithy_types::Blob {
50        &self.file_content
51    }
52}
53impl ::aws_types::request_id::RequestId for GetFileOutput {
54    fn request_id(&self) -> Option<&str> {
55        self._request_id.as_deref()
56    }
57}
58impl GetFileOutput {
59    /// Creates a new builder-style object to manufacture [`GetFileOutput`](crate::operation::get_file::GetFileOutput).
60    pub fn builder() -> crate::operation::get_file::builders::GetFileOutputBuilder {
61        crate::operation::get_file::builders::GetFileOutputBuilder::default()
62    }
63}
64
65/// A builder for [`GetFileOutput`](crate::operation::get_file::GetFileOutput).
66#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
67#[non_exhaustive]
68pub struct GetFileOutputBuilder {
69    pub(crate) commit_id: ::std::option::Option<::std::string::String>,
70    pub(crate) blob_id: ::std::option::Option<::std::string::String>,
71    pub(crate) file_path: ::std::option::Option<::std::string::String>,
72    pub(crate) file_mode: ::std::option::Option<crate::types::FileModeTypeEnum>,
73    pub(crate) file_size: ::std::option::Option<i64>,
74    pub(crate) file_content: ::std::option::Option<::aws_smithy_types::Blob>,
75    _request_id: Option<String>,
76}
77impl GetFileOutputBuilder {
78    /// <p>The full commit ID of the commit that contains the content returned by GetFile.</p>
79    /// This field is required.
80    pub fn commit_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.commit_id = ::std::option::Option::Some(input.into());
82        self
83    }
84    /// <p>The full commit ID of the commit that contains the content returned by GetFile.</p>
85    pub fn set_commit_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86        self.commit_id = input;
87        self
88    }
89    /// <p>The full commit ID of the commit that contains the content returned by GetFile.</p>
90    pub fn get_commit_id(&self) -> &::std::option::Option<::std::string::String> {
91        &self.commit_id
92    }
93    /// <p>The blob ID of the object that represents the file content.</p>
94    /// This field is required.
95    pub fn blob_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
96        self.blob_id = ::std::option::Option::Some(input.into());
97        self
98    }
99    /// <p>The blob ID of the object that represents the file content.</p>
100    pub fn set_blob_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
101        self.blob_id = input;
102        self
103    }
104    /// <p>The blob ID of the object that represents the file content.</p>
105    pub fn get_blob_id(&self) -> &::std::option::Option<::std::string::String> {
106        &self.blob_id
107    }
108    /// <p>The fully qualified path to the specified file. Returns the name and extension of the file.</p>
109    /// This field is required.
110    pub fn file_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.file_path = ::std::option::Option::Some(input.into());
112        self
113    }
114    /// <p>The fully qualified path to the specified file. Returns the name and extension of the file.</p>
115    pub fn set_file_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.file_path = input;
117        self
118    }
119    /// <p>The fully qualified path to the specified file. Returns the name and extension of the file.</p>
120    pub fn get_file_path(&self) -> &::std::option::Option<::std::string::String> {
121        &self.file_path
122    }
123    /// <p>The extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values.</p><note>
124    /// <p>The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See the supported return values.</p>
125    /// </note>
126    /// This field is required.
127    pub fn file_mode(mut self, input: crate::types::FileModeTypeEnum) -> Self {
128        self.file_mode = ::std::option::Option::Some(input);
129        self
130    }
131    /// <p>The extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values.</p><note>
132    /// <p>The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See the supported return values.</p>
133    /// </note>
134    pub fn set_file_mode(mut self, input: ::std::option::Option<crate::types::FileModeTypeEnum>) -> Self {
135        self.file_mode = input;
136        self
137    }
138    /// <p>The extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values.</p><note>
139    /// <p>The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See the supported return values.</p>
140    /// </note>
141    pub fn get_file_mode(&self) -> &::std::option::Option<crate::types::FileModeTypeEnum> {
142        &self.file_mode
143    }
144    /// <p>The size of the contents of the file, in bytes.</p>
145    /// This field is required.
146    pub fn file_size(mut self, input: i64) -> Self {
147        self.file_size = ::std::option::Option::Some(input);
148        self
149    }
150    /// <p>The size of the contents of the file, in bytes.</p>
151    pub fn set_file_size(mut self, input: ::std::option::Option<i64>) -> Self {
152        self.file_size = input;
153        self
154    }
155    /// <p>The size of the contents of the file, in bytes.</p>
156    pub fn get_file_size(&self) -> &::std::option::Option<i64> {
157        &self.file_size
158    }
159    /// <p>The base-64 encoded binary data object that represents the content of the file.</p>
160    /// This field is required.
161    pub fn file_content(mut self, input: ::aws_smithy_types::Blob) -> Self {
162        self.file_content = ::std::option::Option::Some(input);
163        self
164    }
165    /// <p>The base-64 encoded binary data object that represents the content of the file.</p>
166    pub fn set_file_content(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
167        self.file_content = input;
168        self
169    }
170    /// <p>The base-64 encoded binary data object that represents the content of the file.</p>
171    pub fn get_file_content(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
172        &self.file_content
173    }
174    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
175        self._request_id = Some(request_id.into());
176        self
177    }
178
179    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
180        self._request_id = request_id;
181        self
182    }
183    /// Consumes the builder and constructs a [`GetFileOutput`](crate::operation::get_file::GetFileOutput).
184    /// This method will fail if any of the following fields are not set:
185    /// - [`commit_id`](crate::operation::get_file::builders::GetFileOutputBuilder::commit_id)
186    /// - [`blob_id`](crate::operation::get_file::builders::GetFileOutputBuilder::blob_id)
187    /// - [`file_path`](crate::operation::get_file::builders::GetFileOutputBuilder::file_path)
188    /// - [`file_mode`](crate::operation::get_file::builders::GetFileOutputBuilder::file_mode)
189    /// - [`file_content`](crate::operation::get_file::builders::GetFileOutputBuilder::file_content)
190    pub fn build(self) -> ::std::result::Result<crate::operation::get_file::GetFileOutput, ::aws_smithy_types::error::operation::BuildError> {
191        ::std::result::Result::Ok(crate::operation::get_file::GetFileOutput {
192            commit_id: self.commit_id.ok_or_else(|| {
193                ::aws_smithy_types::error::operation::BuildError::missing_field(
194                    "commit_id",
195                    "commit_id was not specified but it is required when building GetFileOutput",
196                )
197            })?,
198            blob_id: self.blob_id.ok_or_else(|| {
199                ::aws_smithy_types::error::operation::BuildError::missing_field(
200                    "blob_id",
201                    "blob_id was not specified but it is required when building GetFileOutput",
202                )
203            })?,
204            file_path: self.file_path.ok_or_else(|| {
205                ::aws_smithy_types::error::operation::BuildError::missing_field(
206                    "file_path",
207                    "file_path was not specified but it is required when building GetFileOutput",
208                )
209            })?,
210            file_mode: self.file_mode.ok_or_else(|| {
211                ::aws_smithy_types::error::operation::BuildError::missing_field(
212                    "file_mode",
213                    "file_mode was not specified but it is required when building GetFileOutput",
214                )
215            })?,
216            file_size: self.file_size.unwrap_or_default(),
217            file_content: self.file_content.ok_or_else(|| {
218                ::aws_smithy_types::error::operation::BuildError::missing_field(
219                    "file_content",
220                    "file_content was not specified but it is required when building GetFileOutput",
221                )
222            })?,
223            _request_id: self._request_id,
224        })
225    }
226}