aws_sdk_networkfirewall/operation/put_resource_policy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_resource_policy::_put_resource_policy_output::PutResourcePolicyOutputBuilder;
3
4pub use crate::operation::put_resource_policy::_put_resource_policy_input::PutResourcePolicyInputBuilder;
5
6impl crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::put_resource_policy::PutResourcePolicyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_resource_policy::PutResourcePolicyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_resource_policy();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutResourcePolicy`.
24///
25/// <p>Creates or updates an IAM policy for your rule group, firewall policy, or firewall. Use this to share these resources between accounts. This operation works in conjunction with the Amazon Web Services Resource Access Manager (RAM) service to manage resource sharing for Network Firewall.</p>
26/// <p>For information about using sharing with Network Firewall resources, see <a href="https://docs.aws.amazon.com/network-firewall/latest/developerguide/sharing.html">Sharing Network Firewall resources</a> in the <i>Network Firewall Developer Guide</i>.</p>
27/// <p>Use this operation to create or update a resource policy for your Network Firewall rule group, firewall policy, or firewall. In the resource policy, you specify the accounts that you want to share the Network Firewall resource with and the operations that you want the accounts to be able to perform.</p>
28/// <p>When you add an account in the resource policy, you then run the following Resource Access Manager (RAM) operations to access and accept the shared resource.</p>
29/// <ul>
30/// <li>
31/// <p><a href="https://docs.aws.amazon.com/ram/latest/APIReference/API_GetResourceShareInvitations.html">GetResourceShareInvitations</a> - Returns the Amazon Resource Names (ARNs) of the resource share invitations.</p></li>
32/// <li>
33/// <p><a href="https://docs.aws.amazon.com/ram/latest/APIReference/API_AcceptResourceShareInvitation.html">AcceptResourceShareInvitation</a> - Accepts the share invitation for a specified resource share.</p></li>
34/// </ul>
35/// <p>For additional information about resource sharing using RAM, see <a href="https://docs.aws.amazon.com/ram/latest/userguide/what-is.html">Resource Access Manager User Guide</a>.</p>
36#[derive(::std::clone::Clone, ::std::fmt::Debug)]
37pub struct PutResourcePolicyFluentBuilder {
38    handle: ::std::sync::Arc<crate::client::Handle>,
39    inner: crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder,
40    config_override: ::std::option::Option<crate::config::Builder>,
41}
42impl
43    crate::client::customize::internal::CustomizableSend<
44        crate::operation::put_resource_policy::PutResourcePolicyOutput,
45        crate::operation::put_resource_policy::PutResourcePolicyError,
46    > for PutResourcePolicyFluentBuilder
47{
48    fn send(
49        self,
50        config_override: crate::config::Builder,
51    ) -> crate::client::customize::internal::BoxFuture<
52        crate::client::customize::internal::SendResult<
53            crate::operation::put_resource_policy::PutResourcePolicyOutput,
54            crate::operation::put_resource_policy::PutResourcePolicyError,
55        >,
56    > {
57        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
58    }
59}
60impl PutResourcePolicyFluentBuilder {
61    /// Creates a new `PutResourcePolicyFluentBuilder`.
62    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
63        Self {
64            handle,
65            inner: ::std::default::Default::default(),
66            config_override: ::std::option::Option::None,
67        }
68    }
69    /// Access the PutResourcePolicy as a reference.
70    pub fn as_input(&self) -> &crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder {
71        &self.inner
72    }
73    /// Sends the request and returns the response.
74    ///
75    /// If an error occurs, an `SdkError` will be returned with additional details that
76    /// can be matched against.
77    ///
78    /// By default, any retryable failures will be retried twice. Retry behavior
79    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
80    /// set when configuring the client.
81    pub async fn send(
82        self,
83    ) -> ::std::result::Result<
84        crate::operation::put_resource_policy::PutResourcePolicyOutput,
85        ::aws_smithy_runtime_api::client::result::SdkError<
86            crate::operation::put_resource_policy::PutResourcePolicyError,
87            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
88        >,
89    > {
90        let input = self
91            .inner
92            .build()
93            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
94        let runtime_plugins = crate::operation::put_resource_policy::PutResourcePolicy::operation_runtime_plugins(
95            self.handle.runtime_plugins.clone(),
96            &self.handle.conf,
97            self.config_override,
98        );
99        crate::operation::put_resource_policy::PutResourcePolicy::orchestrate(&runtime_plugins, input).await
100    }
101
102    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
103    pub fn customize(
104        self,
105    ) -> crate::client::customize::CustomizableOperation<
106        crate::operation::put_resource_policy::PutResourcePolicyOutput,
107        crate::operation::put_resource_policy::PutResourcePolicyError,
108        Self,
109    > {
110        crate::client::customize::CustomizableOperation::new(self)
111    }
112    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
113        self.set_config_override(::std::option::Option::Some(config_override.into()));
114        self
115    }
116
117    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
118        self.config_override = config_override;
119        self
120    }
121    /// <p>The Amazon Resource Name (ARN) of the account that you want to share your Network Firewall resources with.</p>
122    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.resource_arn(input.into());
124        self
125    }
126    /// <p>The Amazon Resource Name (ARN) of the account that you want to share your Network Firewall resources with.</p>
127    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128        self.inner = self.inner.set_resource_arn(input);
129        self
130    }
131    /// <p>The Amazon Resource Name (ARN) of the account that you want to share your Network Firewall resources with.</p>
132    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
133        self.inner.get_resource_arn()
134    }
135    /// <p>The IAM policy statement that lists the accounts that you want to share your Network Firewall resources with and the operations that you want the accounts to be able to perform.</p>
136    /// <p>For a rule group resource, you can specify the following operations in the Actions section of the statement:</p>
137    /// <ul>
138    /// <li>
139    /// <p>network-firewall:CreateFirewallPolicy</p></li>
140    /// <li>
141    /// <p>network-firewall:UpdateFirewallPolicy</p></li>
142    /// <li>
143    /// <p>network-firewall:ListRuleGroups</p></li>
144    /// </ul>
145    /// <p>For a firewall policy resource, you can specify the following operations in the Actions section of the statement:</p>
146    /// <ul>
147    /// <li>
148    /// <p>network-firewall:AssociateFirewallPolicy</p></li>
149    /// <li>
150    /// <p>network-firewall:ListFirewallPolicies</p></li>
151    /// </ul>
152    /// <p>For a firewall resource, you can specify the following operations in the Actions section of the statement:</p>
153    /// <ul>
154    /// <li>
155    /// <p>network-firewall:CreateVpcEndpointAssociation</p></li>
156    /// <li>
157    /// <p>network-firewall:DescribeFirewallMetadata</p></li>
158    /// <li>
159    /// <p>network-firewall:ListFirewalls</p></li>
160    /// </ul>
161    /// <p>In the Resource section of the statement, you specify the ARNs for the Network Firewall resources that you want to share with the account that you specified in <code>Arn</code>.</p>
162    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.inner = self.inner.policy(input.into());
164        self
165    }
166    /// <p>The IAM policy statement that lists the accounts that you want to share your Network Firewall resources with and the operations that you want the accounts to be able to perform.</p>
167    /// <p>For a rule group resource, you can specify the following operations in the Actions section of the statement:</p>
168    /// <ul>
169    /// <li>
170    /// <p>network-firewall:CreateFirewallPolicy</p></li>
171    /// <li>
172    /// <p>network-firewall:UpdateFirewallPolicy</p></li>
173    /// <li>
174    /// <p>network-firewall:ListRuleGroups</p></li>
175    /// </ul>
176    /// <p>For a firewall policy resource, you can specify the following operations in the Actions section of the statement:</p>
177    /// <ul>
178    /// <li>
179    /// <p>network-firewall:AssociateFirewallPolicy</p></li>
180    /// <li>
181    /// <p>network-firewall:ListFirewallPolicies</p></li>
182    /// </ul>
183    /// <p>For a firewall resource, you can specify the following operations in the Actions section of the statement:</p>
184    /// <ul>
185    /// <li>
186    /// <p>network-firewall:CreateVpcEndpointAssociation</p></li>
187    /// <li>
188    /// <p>network-firewall:DescribeFirewallMetadata</p></li>
189    /// <li>
190    /// <p>network-firewall:ListFirewalls</p></li>
191    /// </ul>
192    /// <p>In the Resource section of the statement, you specify the ARNs for the Network Firewall resources that you want to share with the account that you specified in <code>Arn</code>.</p>
193    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.inner = self.inner.set_policy(input);
195        self
196    }
197    /// <p>The IAM policy statement that lists the accounts that you want to share your Network Firewall resources with and the operations that you want the accounts to be able to perform.</p>
198    /// <p>For a rule group resource, you can specify the following operations in the Actions section of the statement:</p>
199    /// <ul>
200    /// <li>
201    /// <p>network-firewall:CreateFirewallPolicy</p></li>
202    /// <li>
203    /// <p>network-firewall:UpdateFirewallPolicy</p></li>
204    /// <li>
205    /// <p>network-firewall:ListRuleGroups</p></li>
206    /// </ul>
207    /// <p>For a firewall policy resource, you can specify the following operations in the Actions section of the statement:</p>
208    /// <ul>
209    /// <li>
210    /// <p>network-firewall:AssociateFirewallPolicy</p></li>
211    /// <li>
212    /// <p>network-firewall:ListFirewallPolicies</p></li>
213    /// </ul>
214    /// <p>For a firewall resource, you can specify the following operations in the Actions section of the statement:</p>
215    /// <ul>
216    /// <li>
217    /// <p>network-firewall:CreateVpcEndpointAssociation</p></li>
218    /// <li>
219    /// <p>network-firewall:DescribeFirewallMetadata</p></li>
220    /// <li>
221    /// <p>network-firewall:ListFirewalls</p></li>
222    /// </ul>
223    /// <p>In the Resource section of the statement, you specify the ARNs for the Network Firewall resources that you want to share with the account that you specified in <code>Arn</code>.</p>
224    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
225        self.inner.get_policy()
226    }
227}