aws_sdk_apigateway/operation/update_usage/_update_usage_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The PATCH request to grant a temporary extension to the remaining quota of a usage plan associated with a specified API key.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct UpdateUsageInput {
7 /// <p>The Id of the usage plan associated with the usage data.</p>
8 pub usage_plan_id: ::std::option::Option<::std::string::String>,
9 /// <p>The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.</p>
10 pub key_id: ::std::option::Option<::std::string::String>,
11 /// <p>For more information about supported patch operations, see <a href="https://docs.aws.amazon.com/apigateway/latest/api/patch-operations.html">Patch Operations</a>.</p>
12 pub patch_operations: ::std::option::Option<::std::vec::Vec<crate::types::PatchOperation>>,
13}
14impl UpdateUsageInput {
15 /// <p>The Id of the usage plan associated with the usage data.</p>
16 pub fn usage_plan_id(&self) -> ::std::option::Option<&str> {
17 self.usage_plan_id.as_deref()
18 }
19 /// <p>The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.</p>
20 pub fn key_id(&self) -> ::std::option::Option<&str> {
21 self.key_id.as_deref()
22 }
23 /// <p>For more information about supported patch operations, see <a href="https://docs.aws.amazon.com/apigateway/latest/api/patch-operations.html">Patch Operations</a>.</p>
24 ///
25 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.patch_operations.is_none()`.
26 pub fn patch_operations(&self) -> &[crate::types::PatchOperation] {
27 self.patch_operations.as_deref().unwrap_or_default()
28 }
29}
30impl UpdateUsageInput {
31 /// Creates a new builder-style object to manufacture [`UpdateUsageInput`](crate::operation::update_usage::UpdateUsageInput).
32 pub fn builder() -> crate::operation::update_usage::builders::UpdateUsageInputBuilder {
33 crate::operation::update_usage::builders::UpdateUsageInputBuilder::default()
34 }
35}
36
37/// A builder for [`UpdateUsageInput`](crate::operation::update_usage::UpdateUsageInput).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct UpdateUsageInputBuilder {
41 pub(crate) usage_plan_id: ::std::option::Option<::std::string::String>,
42 pub(crate) key_id: ::std::option::Option<::std::string::String>,
43 pub(crate) patch_operations: ::std::option::Option<::std::vec::Vec<crate::types::PatchOperation>>,
44}
45impl UpdateUsageInputBuilder {
46 /// <p>The Id of the usage plan associated with the usage data.</p>
47 /// This field is required.
48 pub fn usage_plan_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
49 self.usage_plan_id = ::std::option::Option::Some(input.into());
50 self
51 }
52 /// <p>The Id of the usage plan associated with the usage data.</p>
53 pub fn set_usage_plan_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
54 self.usage_plan_id = input;
55 self
56 }
57 /// <p>The Id of the usage plan associated with the usage data.</p>
58 pub fn get_usage_plan_id(&self) -> &::std::option::Option<::std::string::String> {
59 &self.usage_plan_id
60 }
61 /// <p>The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.</p>
62 /// This field is required.
63 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64 self.key_id = ::std::option::Option::Some(input.into());
65 self
66 }
67 /// <p>The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.</p>
68 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69 self.key_id = input;
70 self
71 }
72 /// <p>The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.</p>
73 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
74 &self.key_id
75 }
76 /// Appends an item to `patch_operations`.
77 ///
78 /// To override the contents of this collection use [`set_patch_operations`](Self::set_patch_operations).
79 ///
80 /// <p>For more information about supported patch operations, see <a href="https://docs.aws.amazon.com/apigateway/latest/api/patch-operations.html">Patch Operations</a>.</p>
81 pub fn patch_operations(mut self, input: crate::types::PatchOperation) -> Self {
82 let mut v = self.patch_operations.unwrap_or_default();
83 v.push(input);
84 self.patch_operations = ::std::option::Option::Some(v);
85 self
86 }
87 /// <p>For more information about supported patch operations, see <a href="https://docs.aws.amazon.com/apigateway/latest/api/patch-operations.html">Patch Operations</a>.</p>
88 pub fn set_patch_operations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PatchOperation>>) -> Self {
89 self.patch_operations = input;
90 self
91 }
92 /// <p>For more information about supported patch operations, see <a href="https://docs.aws.amazon.com/apigateway/latest/api/patch-operations.html">Patch Operations</a>.</p>
93 pub fn get_patch_operations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PatchOperation>> {
94 &self.patch_operations
95 }
96 /// Consumes the builder and constructs a [`UpdateUsageInput`](crate::operation::update_usage::UpdateUsageInput).
97 pub fn build(self) -> ::std::result::Result<crate::operation::update_usage::UpdateUsageInput, ::aws_smithy_types::error::operation::BuildError> {
98 ::std::result::Result::Ok(crate::operation::update_usage::UpdateUsageInput {
99 usage_plan_id: self.usage_plan_id,
100 key_id: self.key_id,
101 patch_operations: self.patch_operations,
102 })
103 }
104}