aws-sdk-appsync 1.111.0

AWS SDK for AWS AppSync
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Describes an AppSync API. You can use <code>Api</code> for an AppSync API with your preferred configuration, such as an Event API that provides real-time message publishing and message subscriptions over WebSockets.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Api {
    /// <p>The <code>Api</code> ID.</p>
    pub api_id: ::std::option::Option<::std::string::String>,
    /// <p>The name of the <code>Api</code>.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The owner contact information for the <code>Api</code></p>
    pub owner_contact: ::std::option::Option<::std::string::String>,
    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    /// <p>The DNS records for the API. This will include an HTTP and a real-time endpoint.</p>
    pub dns: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    /// <p>The Amazon Resource Name (ARN) for the <code>Api</code>.</p>
    pub api_arn: ::std::option::Option<::std::string::String>,
    /// <p>The date and time that the <code>Api</code> was created.</p>
    pub created: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>A flag indicating whether to use X-Ray tracing for this <code>Api</code>.</p>
    pub xray_enabled: bool,
    /// <p>The Amazon Resource Name (ARN) of the WAF web access control list (web ACL) associated with this <code>Api</code>, if one exists.</p>
    pub waf_web_acl_arn: ::std::option::Option<::std::string::String>,
    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
    pub event_config: ::std::option::Option<crate::types::EventConfig>,
}
impl Api {
    /// <p>The <code>Api</code> ID.</p>
    pub fn api_id(&self) -> ::std::option::Option<&str> {
        self.api_id.as_deref()
    }
    /// <p>The name of the <code>Api</code>.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The owner contact information for the <code>Api</code></p>
    pub fn owner_contact(&self) -> ::std::option::Option<&str> {
        self.owner_contact.as_deref()
    }
    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.tags.as_ref()
    }
    /// <p>The DNS records for the API. This will include an HTTP and a real-time endpoint.</p>
    pub fn dns(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.dns.as_ref()
    }
    /// <p>The Amazon Resource Name (ARN) for the <code>Api</code>.</p>
    pub fn api_arn(&self) -> ::std::option::Option<&str> {
        self.api_arn.as_deref()
    }
    /// <p>The date and time that the <code>Api</code> was created.</p>
    pub fn created(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.created.as_ref()
    }
    /// <p>A flag indicating whether to use X-Ray tracing for this <code>Api</code>.</p>
    pub fn xray_enabled(&self) -> bool {
        self.xray_enabled
    }
    /// <p>The Amazon Resource Name (ARN) of the WAF web access control list (web ACL) associated with this <code>Api</code>, if one exists.</p>
    pub fn waf_web_acl_arn(&self) -> ::std::option::Option<&str> {
        self.waf_web_acl_arn.as_deref()
    }
    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
    pub fn event_config(&self) -> ::std::option::Option<&crate::types::EventConfig> {
        self.event_config.as_ref()
    }
}
impl Api {
    /// Creates a new builder-style object to manufacture [`Api`](crate::types::Api).
    pub fn builder() -> crate::types::builders::ApiBuilder {
        crate::types::builders::ApiBuilder::default()
    }
}

/// A builder for [`Api`](crate::types::Api).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ApiBuilder {
    pub(crate) api_id: ::std::option::Option<::std::string::String>,
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) owner_contact: ::std::option::Option<::std::string::String>,
    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) dns: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) api_arn: ::std::option::Option<::std::string::String>,
    pub(crate) created: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) xray_enabled: ::std::option::Option<bool>,
    pub(crate) waf_web_acl_arn: ::std::option::Option<::std::string::String>,
    pub(crate) event_config: ::std::option::Option<crate::types::EventConfig>,
}
impl ApiBuilder {
    /// <p>The <code>Api</code> ID.</p>
    pub fn api_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.api_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The <code>Api</code> ID.</p>
    pub fn set_api_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.api_id = input;
        self
    }
    /// <p>The <code>Api</code> ID.</p>
    pub fn get_api_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.api_id
    }
    /// <p>The name of the <code>Api</code>.</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the <code>Api</code>.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the <code>Api</code>.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>The owner contact information for the <code>Api</code></p>
    pub fn owner_contact(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.owner_contact = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The owner contact information for the <code>Api</code></p>
    pub fn set_owner_contact(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.owner_contact = input;
        self
    }
    /// <p>The owner contact information for the <code>Api</code></p>
    pub fn get_owner_contact(&self) -> &::std::option::Option<::std::string::String> {
        &self.owner_contact
    }
    /// Adds a key-value pair to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.tags.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.tags = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.tags = input;
        self
    }
    /// <p>A map with keys of <code>TagKey</code> objects and values of <code>TagValue</code> objects.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.tags
    }
    /// Adds a key-value pair to `dns`.
    ///
    /// To override the contents of this collection use [`set_dns`](Self::set_dns).
    ///
    /// <p>The DNS records for the API. This will include an HTTP and a real-time endpoint.</p>
    pub fn dns(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.dns.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.dns = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The DNS records for the API. This will include an HTTP and a real-time endpoint.</p>
    pub fn set_dns(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.dns = input;
        self
    }
    /// <p>The DNS records for the API. This will include an HTTP and a real-time endpoint.</p>
    pub fn get_dns(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.dns
    }
    /// <p>The Amazon Resource Name (ARN) for the <code>Api</code>.</p>
    pub fn api_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.api_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) for the <code>Api</code>.</p>
    pub fn set_api_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.api_arn = input;
        self
    }
    /// <p>The Amazon Resource Name (ARN) for the <code>Api</code>.</p>
    pub fn get_api_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.api_arn
    }
    /// <p>The date and time that the <code>Api</code> was created.</p>
    pub fn created(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.created = ::std::option::Option::Some(input);
        self
    }
    /// <p>The date and time that the <code>Api</code> was created.</p>
    pub fn set_created(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.created = input;
        self
    }
    /// <p>The date and time that the <code>Api</code> was created.</p>
    pub fn get_created(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.created
    }
    /// <p>A flag indicating whether to use X-Ray tracing for this <code>Api</code>.</p>
    pub fn xray_enabled(mut self, input: bool) -> Self {
        self.xray_enabled = ::std::option::Option::Some(input);
        self
    }
    /// <p>A flag indicating whether to use X-Ray tracing for this <code>Api</code>.</p>
    pub fn set_xray_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
        self.xray_enabled = input;
        self
    }
    /// <p>A flag indicating whether to use X-Ray tracing for this <code>Api</code>.</p>
    pub fn get_xray_enabled(&self) -> &::std::option::Option<bool> {
        &self.xray_enabled
    }
    /// <p>The Amazon Resource Name (ARN) of the WAF web access control list (web ACL) associated with this <code>Api</code>, if one exists.</p>
    pub fn waf_web_acl_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.waf_web_acl_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the WAF web access control list (web ACL) associated with this <code>Api</code>, if one exists.</p>
    pub fn set_waf_web_acl_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.waf_web_acl_arn = input;
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the WAF web access control list (web ACL) associated with this <code>Api</code>, if one exists.</p>
    pub fn get_waf_web_acl_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.waf_web_acl_arn
    }
    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
    pub fn event_config(mut self, input: crate::types::EventConfig) -> Self {
        self.event_config = ::std::option::Option::Some(input);
        self
    }
    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
    pub fn set_event_config(mut self, input: ::std::option::Option<crate::types::EventConfig>) -> Self {
        self.event_config = input;
        self
    }
    /// <p>The Event API configuration. This includes the default authorization configuration for connecting, publishing, and subscribing to an Event API.</p>
    pub fn get_event_config(&self) -> &::std::option::Option<crate::types::EventConfig> {
        &self.event_config
    }
    /// Consumes the builder and constructs a [`Api`](crate::types::Api).
    pub fn build(self) -> crate::types::Api {
        crate::types::Api {
            api_id: self.api_id,
            name: self.name,
            owner_contact: self.owner_contact,
            tags: self.tags,
            dns: self.dns,
            api_arn: self.api_arn,
            created: self.created,
            xray_enabled: self.xray_enabled.unwrap_or_default(),
            waf_web_acl_arn: self.waf_web_acl_arn,
            event_config: self.event_config,
        }
    }
}