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 or firewall policy. Use this to share rule groups and firewall policies 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>Use this operation to create or update a resource policy for your rule group or firewall policy. In the policy, you specify the accounts that you want to share the resource with and the operations that you want the accounts to be able to perform.</p>
27/// <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 rule group or firewall policy.</p>
28/// <ul>
29/// <li>
30/// <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>
31/// <li>
32/// <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>
33/// </ul>
34/// <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>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct PutResourcePolicyFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::put_resource_policy::PutResourcePolicyOutput,
44        crate::operation::put_resource_policy::PutResourcePolicyError,
45    > for PutResourcePolicyFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::put_resource_policy::PutResourcePolicyOutput,
53            crate::operation::put_resource_policy::PutResourcePolicyError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl PutResourcePolicyFluentBuilder {
60    /// Creates a new `PutResourcePolicyFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the PutResourcePolicy as a reference.
69    pub fn as_input(&self) -> &crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::put_resource_policy::PutResourcePolicyOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::put_resource_policy::PutResourcePolicyError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::put_resource_policy::PutResourcePolicy::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::put_resource_policy::PutResourcePolicy::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::put_resource_policy::PutResourcePolicyOutput,
106        crate::operation::put_resource_policy::PutResourcePolicyError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>The Amazon Resource Name (ARN) of the account that you want to share rule groups and firewall policies with.</p>
121    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.resource_arn(input.into());
123        self
124    }
125    /// <p>The Amazon Resource Name (ARN) of the account that you want to share rule groups and firewall policies with.</p>
126    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.inner = self.inner.set_resource_arn(input);
128        self
129    }
130    /// <p>The Amazon Resource Name (ARN) of the account that you want to share rule groups and firewall policies with.</p>
131    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
132        self.inner.get_resource_arn()
133    }
134    /// <p>The IAM policy statement that lists the accounts that you want to share your rule group or firewall policy with and the operations that you want the accounts to be able to perform.</p>
135    /// <p>For a rule group resource, you can specify the following operations in the Actions section of the statement:</p>
136    /// <ul>
137    /// <li>
138    /// <p>network-firewall:CreateFirewallPolicy</p></li>
139    /// <li>
140    /// <p>network-firewall:UpdateFirewallPolicy</p></li>
141    /// <li>
142    /// <p>network-firewall:ListRuleGroups</p></li>
143    /// </ul>
144    /// <p>For a firewall policy resource, you can specify the following operations in the Actions section of the statement:</p>
145    /// <ul>
146    /// <li>
147    /// <p>network-firewall:AssociateFirewallPolicy</p></li>
148    /// <li>
149    /// <p>network-firewall:ListFirewallPolicies</p></li>
150    /// </ul>
151    /// <p>In the Resource section of the statement, you specify the ARNs for the rule groups and firewall policies that you want to share with the account that you specified in <code>Arn</code>.</p>
152    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.inner = self.inner.policy(input.into());
154        self
155    }
156    /// <p>The IAM policy statement that lists the accounts that you want to share your rule group or firewall policy with and the operations that you want the accounts to be able to perform.</p>
157    /// <p>For a rule group resource, you can specify the following operations in the Actions section of the statement:</p>
158    /// <ul>
159    /// <li>
160    /// <p>network-firewall:CreateFirewallPolicy</p></li>
161    /// <li>
162    /// <p>network-firewall:UpdateFirewallPolicy</p></li>
163    /// <li>
164    /// <p>network-firewall:ListRuleGroups</p></li>
165    /// </ul>
166    /// <p>For a firewall policy resource, you can specify the following operations in the Actions section of the statement:</p>
167    /// <ul>
168    /// <li>
169    /// <p>network-firewall:AssociateFirewallPolicy</p></li>
170    /// <li>
171    /// <p>network-firewall:ListFirewallPolicies</p></li>
172    /// </ul>
173    /// <p>In the Resource section of the statement, you specify the ARNs for the rule groups and firewall policies that you want to share with the account that you specified in <code>Arn</code>.</p>
174    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175        self.inner = self.inner.set_policy(input);
176        self
177    }
178    /// <p>The IAM policy statement that lists the accounts that you want to share your rule group or firewall policy with and the operations that you want the accounts to be able to perform.</p>
179    /// <p>For a rule group resource, you can specify the following operations in the Actions section of the statement:</p>
180    /// <ul>
181    /// <li>
182    /// <p>network-firewall:CreateFirewallPolicy</p></li>
183    /// <li>
184    /// <p>network-firewall:UpdateFirewallPolicy</p></li>
185    /// <li>
186    /// <p>network-firewall:ListRuleGroups</p></li>
187    /// </ul>
188    /// <p>For a firewall policy resource, you can specify the following operations in the Actions section of the statement:</p>
189    /// <ul>
190    /// <li>
191    /// <p>network-firewall:AssociateFirewallPolicy</p></li>
192    /// <li>
193    /// <p>network-firewall:ListFirewallPolicies</p></li>
194    /// </ul>
195    /// <p>In the Resource section of the statement, you specify the ARNs for the rule groups and firewall policies that you want to share with the account that you specified in <code>Arn</code>.</p>
196    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
197        self.inner.get_policy()
198    }
199}