Skip to main content

aws_sdk_cloudwatchevents/types/
_event_bus.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An event bus receives events from a source and routes them to rules associated with that event bus. Your account's default event bus receives events from Amazon Web Services services. A custom event bus can receive events from your custom applications and services. A partner event bus receives events from an event source created by an SaaS partner. These events come from the partners services or applications.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct EventBus {
7    /// <p>The name of the event bus.</p>
8    pub name: ::std::option::Option<::std::string::String>,
9    /// <p>The ARN of the event bus.</p>
10    pub arn: ::std::option::Option<::std::string::String>,
11    /// <p>The permissions policy of the event bus, describing which other Amazon Web Services accounts can write events to this event bus.</p>
12    pub policy: ::std::option::Option<::std::string::String>,
13}
14impl EventBus {
15    /// <p>The name of the event bus.</p>
16    pub fn name(&self) -> ::std::option::Option<&str> {
17        self.name.as_deref()
18    }
19    /// <p>The ARN of the event bus.</p>
20    pub fn arn(&self) -> ::std::option::Option<&str> {
21        self.arn.as_deref()
22    }
23    /// <p>The permissions policy of the event bus, describing which other Amazon Web Services accounts can write events to this event bus.</p>
24    pub fn policy(&self) -> ::std::option::Option<&str> {
25        self.policy.as_deref()
26    }
27}
28impl EventBus {
29    /// Creates a new builder-style object to manufacture [`EventBus`](crate::types::EventBus).
30    pub fn builder() -> crate::types::builders::EventBusBuilder {
31        crate::types::builders::EventBusBuilder::default()
32    }
33}
34
35/// A builder for [`EventBus`](crate::types::EventBus).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct EventBusBuilder {
39    pub(crate) name: ::std::option::Option<::std::string::String>,
40    pub(crate) arn: ::std::option::Option<::std::string::String>,
41    pub(crate) policy: ::std::option::Option<::std::string::String>,
42}
43impl EventBusBuilder {
44    /// <p>The name of the event bus.</p>
45    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46        self.name = ::std::option::Option::Some(input.into());
47        self
48    }
49    /// <p>The name of the event bus.</p>
50    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.name = input;
52        self
53    }
54    /// <p>The name of the event bus.</p>
55    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
56        &self.name
57    }
58    /// <p>The ARN of the event bus.</p>
59    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
60        self.arn = ::std::option::Option::Some(input.into());
61        self
62    }
63    /// <p>The ARN of the event bus.</p>
64    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
65        self.arn = input;
66        self
67    }
68    /// <p>The ARN of the event bus.</p>
69    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
70        &self.arn
71    }
72    /// <p>The permissions policy of the event bus, describing which other Amazon Web Services accounts can write events to this event bus.</p>
73    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.policy = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p>The permissions policy of the event bus, describing which other Amazon Web Services accounts can write events to this event bus.</p>
78    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.policy = input;
80        self
81    }
82    /// <p>The permissions policy of the event bus, describing which other Amazon Web Services accounts can write events to this event bus.</p>
83    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
84        &self.policy
85    }
86    /// Consumes the builder and constructs a [`EventBus`](crate::types::EventBus).
87    pub fn build(self) -> crate::types::EventBus {
88        crate::types::EventBus {
89            name: self.name,
90            arn: self.arn,
91            policy: self.policy,
92        }
93    }
94}