aws_sdk_networkfirewall/operation/create_firewall_policy/_create_firewall_policy_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 CreateFirewallPolicyOutput {
6 /// <p>A token used for optimistic locking. Network Firewall returns a token to your requests that access the firewall policy. The token marks the state of the policy resource at the time of the request.</p>
7 /// <p>To make changes to the policy, you provide the token in your request. Network Firewall uses the token to ensure that the policy hasn't changed since you last retrieved it. If it has changed, the operation fails with an <code>InvalidTokenException</code>. If this happens, retrieve the firewall policy again to get a current copy of it with current token. Reapply your changes as needed, then try the operation again using the new token.</p>
8 pub update_token: ::std::string::String,
9 /// <p>The high-level properties of a firewall policy. This, along with the <code>FirewallPolicy</code>, define the policy. You can retrieve all objects for a firewall policy by calling <code>DescribeFirewallPolicy</code>.</p>
10 pub firewall_policy_response: ::std::option::Option<crate::types::FirewallPolicyResponse>,
11 _request_id: Option<String>,
12}
13impl CreateFirewallPolicyOutput {
14 /// <p>A token used for optimistic locking. Network Firewall returns a token to your requests that access the firewall policy. The token marks the state of the policy resource at the time of the request.</p>
15 /// <p>To make changes to the policy, you provide the token in your request. Network Firewall uses the token to ensure that the policy hasn't changed since you last retrieved it. If it has changed, the operation fails with an <code>InvalidTokenException</code>. If this happens, retrieve the firewall policy again to get a current copy of it with current token. Reapply your changes as needed, then try the operation again using the new token.</p>
16 pub fn update_token(&self) -> &str {
17 use std::ops::Deref;
18 self.update_token.deref()
19 }
20 /// <p>The high-level properties of a firewall policy. This, along with the <code>FirewallPolicy</code>, define the policy. You can retrieve all objects for a firewall policy by calling <code>DescribeFirewallPolicy</code>.</p>
21 pub fn firewall_policy_response(&self) -> ::std::option::Option<&crate::types::FirewallPolicyResponse> {
22 self.firewall_policy_response.as_ref()
23 }
24}
25impl ::aws_types::request_id::RequestId for CreateFirewallPolicyOutput {
26 fn request_id(&self) -> Option<&str> {
27 self._request_id.as_deref()
28 }
29}
30impl CreateFirewallPolicyOutput {
31 /// Creates a new builder-style object to manufacture [`CreateFirewallPolicyOutput`](crate::operation::create_firewall_policy::CreateFirewallPolicyOutput).
32 pub fn builder() -> crate::operation::create_firewall_policy::builders::CreateFirewallPolicyOutputBuilder {
33 crate::operation::create_firewall_policy::builders::CreateFirewallPolicyOutputBuilder::default()
34 }
35}
36
37/// A builder for [`CreateFirewallPolicyOutput`](crate::operation::create_firewall_policy::CreateFirewallPolicyOutput).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct CreateFirewallPolicyOutputBuilder {
41 pub(crate) update_token: ::std::option::Option<::std::string::String>,
42 pub(crate) firewall_policy_response: ::std::option::Option<crate::types::FirewallPolicyResponse>,
43 _request_id: Option<String>,
44}
45impl CreateFirewallPolicyOutputBuilder {
46 /// <p>A token used for optimistic locking. Network Firewall returns a token to your requests that access the firewall policy. The token marks the state of the policy resource at the time of the request.</p>
47 /// <p>To make changes to the policy, you provide the token in your request. Network Firewall uses the token to ensure that the policy hasn't changed since you last retrieved it. If it has changed, the operation fails with an <code>InvalidTokenException</code>. If this happens, retrieve the firewall policy again to get a current copy of it with current token. Reapply your changes as needed, then try the operation again using the new token.</p>
48 /// This field is required.
49 pub fn update_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
50 self.update_token = ::std::option::Option::Some(input.into());
51 self
52 }
53 /// <p>A token used for optimistic locking. Network Firewall returns a token to your requests that access the firewall policy. The token marks the state of the policy resource at the time of the request.</p>
54 /// <p>To make changes to the policy, you provide the token in your request. Network Firewall uses the token to ensure that the policy hasn't changed since you last retrieved it. If it has changed, the operation fails with an <code>InvalidTokenException</code>. If this happens, retrieve the firewall policy again to get a current copy of it with current token. Reapply your changes as needed, then try the operation again using the new token.</p>
55 pub fn set_update_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
56 self.update_token = input;
57 self
58 }
59 /// <p>A token used for optimistic locking. Network Firewall returns a token to your requests that access the firewall policy. The token marks the state of the policy resource at the time of the request.</p>
60 /// <p>To make changes to the policy, you provide the token in your request. Network Firewall uses the token to ensure that the policy hasn't changed since you last retrieved it. If it has changed, the operation fails with an <code>InvalidTokenException</code>. If this happens, retrieve the firewall policy again to get a current copy of it with current token. Reapply your changes as needed, then try the operation again using the new token.</p>
61 pub fn get_update_token(&self) -> &::std::option::Option<::std::string::String> {
62 &self.update_token
63 }
64 /// <p>The high-level properties of a firewall policy. This, along with the <code>FirewallPolicy</code>, define the policy. You can retrieve all objects for a firewall policy by calling <code>DescribeFirewallPolicy</code>.</p>
65 /// This field is required.
66 pub fn firewall_policy_response(mut self, input: crate::types::FirewallPolicyResponse) -> Self {
67 self.firewall_policy_response = ::std::option::Option::Some(input);
68 self
69 }
70 /// <p>The high-level properties of a firewall policy. This, along with the <code>FirewallPolicy</code>, define the policy. You can retrieve all objects for a firewall policy by calling <code>DescribeFirewallPolicy</code>.</p>
71 pub fn set_firewall_policy_response(mut self, input: ::std::option::Option<crate::types::FirewallPolicyResponse>) -> Self {
72 self.firewall_policy_response = input;
73 self
74 }
75 /// <p>The high-level properties of a firewall policy. This, along with the <code>FirewallPolicy</code>, define the policy. You can retrieve all objects for a firewall policy by calling <code>DescribeFirewallPolicy</code>.</p>
76 pub fn get_firewall_policy_response(&self) -> &::std::option::Option<crate::types::FirewallPolicyResponse> {
77 &self.firewall_policy_response
78 }
79 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
80 self._request_id = Some(request_id.into());
81 self
82 }
83
84 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
85 self._request_id = request_id;
86 self
87 }
88 /// Consumes the builder and constructs a [`CreateFirewallPolicyOutput`](crate::operation::create_firewall_policy::CreateFirewallPolicyOutput).
89 /// This method will fail if any of the following fields are not set:
90 /// - [`update_token`](crate::operation::create_firewall_policy::builders::CreateFirewallPolicyOutputBuilder::update_token)
91 pub fn build(
92 self,
93 ) -> ::std::result::Result<crate::operation::create_firewall_policy::CreateFirewallPolicyOutput, ::aws_smithy_types::error::operation::BuildError>
94 {
95 ::std::result::Result::Ok(crate::operation::create_firewall_policy::CreateFirewallPolicyOutput {
96 update_token: self.update_token.ok_or_else(|| {
97 ::aws_smithy_types::error::operation::BuildError::missing_field(
98 "update_token",
99 "update_token was not specified but it is required when building CreateFirewallPolicyOutput",
100 )
101 })?,
102 firewall_policy_response: self.firewall_policy_response,
103 _request_id: self._request_id,
104 })
105 }
106}