aws-sdk-amplify 1.111.0

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

/// <p>Describes a webhook that connects repository events to an Amplify app.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Webhook {
    /// <p>The Amazon Resource Name (ARN) for the webhook.</p>
    pub webhook_arn: ::std::string::String,
    /// <p>The ID of the webhook.</p>
    pub webhook_id: ::std::string::String,
    /// <p>The URL of the webhook.</p>
    pub webhook_url: ::std::string::String,
    /// <p>The unique ID of an Amplify app.</p>
    pub app_id: ::std::option::Option<::std::string::String>,
    /// <p>The name for a branch that is part of an Amplify app.</p>
    pub branch_name: ::std::string::String,
    /// <p>The description for a webhook.</p>
    pub description: ::std::string::String,
    /// <p>A timestamp of when Amplify created the webhook in your Git repository.</p>
    pub create_time: ::aws_smithy_types::DateTime,
    /// <p>A timestamp of when Amplify updated the webhook in your Git repository.</p>
    pub update_time: ::aws_smithy_types::DateTime,
}
impl Webhook {
    /// <p>The Amazon Resource Name (ARN) for the webhook.</p>
    pub fn webhook_arn(&self) -> &str {
        use std::ops::Deref;
        self.webhook_arn.deref()
    }
    /// <p>The ID of the webhook.</p>
    pub fn webhook_id(&self) -> &str {
        use std::ops::Deref;
        self.webhook_id.deref()
    }
    /// <p>The URL of the webhook.</p>
    pub fn webhook_url(&self) -> &str {
        use std::ops::Deref;
        self.webhook_url.deref()
    }
    /// <p>The unique ID of an Amplify app.</p>
    pub fn app_id(&self) -> ::std::option::Option<&str> {
        self.app_id.as_deref()
    }
    /// <p>The name for a branch that is part of an Amplify app.</p>
    pub fn branch_name(&self) -> &str {
        use std::ops::Deref;
        self.branch_name.deref()
    }
    /// <p>The description for a webhook.</p>
    pub fn description(&self) -> &str {
        use std::ops::Deref;
        self.description.deref()
    }
    /// <p>A timestamp of when Amplify created the webhook in your Git repository.</p>
    pub fn create_time(&self) -> &::aws_smithy_types::DateTime {
        &self.create_time
    }
    /// <p>A timestamp of when Amplify updated the webhook in your Git repository.</p>
    pub fn update_time(&self) -> &::aws_smithy_types::DateTime {
        &self.update_time
    }
}
impl Webhook {
    /// Creates a new builder-style object to manufacture [`Webhook`](crate::types::Webhook).
    pub fn builder() -> crate::types::builders::WebhookBuilder {
        crate::types::builders::WebhookBuilder::default()
    }
}

/// A builder for [`Webhook`](crate::types::Webhook).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct WebhookBuilder {
    pub(crate) webhook_arn: ::std::option::Option<::std::string::String>,
    pub(crate) webhook_id: ::std::option::Option<::std::string::String>,
    pub(crate) webhook_url: ::std::option::Option<::std::string::String>,
    pub(crate) app_id: ::std::option::Option<::std::string::String>,
    pub(crate) branch_name: ::std::option::Option<::std::string::String>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
    pub(crate) create_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) update_time: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl WebhookBuilder {
    /// <p>The Amazon Resource Name (ARN) for the webhook.</p>
    /// This field is required.
    pub fn webhook_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.webhook_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) for the webhook.</p>
    pub fn set_webhook_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.webhook_arn = input;
        self
    }
    /// <p>The Amazon Resource Name (ARN) for the webhook.</p>
    pub fn get_webhook_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.webhook_arn
    }
    /// <p>The ID of the webhook.</p>
    /// This field is required.
    pub fn webhook_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.webhook_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the webhook.</p>
    pub fn set_webhook_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.webhook_id = input;
        self
    }
    /// <p>The ID of the webhook.</p>
    pub fn get_webhook_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.webhook_id
    }
    /// <p>The URL of the webhook.</p>
    /// This field is required.
    pub fn webhook_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.webhook_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The URL of the webhook.</p>
    pub fn set_webhook_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.webhook_url = input;
        self
    }
    /// <p>The URL of the webhook.</p>
    pub fn get_webhook_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.webhook_url
    }
    /// <p>The unique ID of an Amplify app.</p>
    pub fn app_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.app_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique ID of an Amplify app.</p>
    pub fn set_app_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.app_id = input;
        self
    }
    /// <p>The unique ID of an Amplify app.</p>
    pub fn get_app_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_id
    }
    /// <p>The name for a branch that is part of an Amplify app.</p>
    /// This field is required.
    pub fn branch_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.branch_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name for a branch that is part of an Amplify app.</p>
    pub fn set_branch_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.branch_name = input;
        self
    }
    /// <p>The name for a branch that is part of an Amplify app.</p>
    pub fn get_branch_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.branch_name
    }
    /// <p>The description for a webhook.</p>
    /// This field is required.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The description for a webhook.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>The description for a webhook.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// <p>A timestamp of when Amplify created the webhook in your Git repository.</p>
    /// This field is required.
    pub fn create_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.create_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>A timestamp of when Amplify created the webhook in your Git repository.</p>
    pub fn set_create_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.create_time = input;
        self
    }
    /// <p>A timestamp of when Amplify created the webhook in your Git repository.</p>
    pub fn get_create_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.create_time
    }
    /// <p>A timestamp of when Amplify updated the webhook in your Git repository.</p>
    /// This field is required.
    pub fn update_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.update_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>A timestamp of when Amplify updated the webhook in your Git repository.</p>
    pub fn set_update_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.update_time = input;
        self
    }
    /// <p>A timestamp of when Amplify updated the webhook in your Git repository.</p>
    pub fn get_update_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.update_time
    }
    /// Consumes the builder and constructs a [`Webhook`](crate::types::Webhook).
    /// This method will fail if any of the following fields are not set:
    /// - [`webhook_arn`](crate::types::builders::WebhookBuilder::webhook_arn)
    /// - [`webhook_id`](crate::types::builders::WebhookBuilder::webhook_id)
    /// - [`webhook_url`](crate::types::builders::WebhookBuilder::webhook_url)
    /// - [`branch_name`](crate::types::builders::WebhookBuilder::branch_name)
    /// - [`description`](crate::types::builders::WebhookBuilder::description)
    /// - [`create_time`](crate::types::builders::WebhookBuilder::create_time)
    /// - [`update_time`](crate::types::builders::WebhookBuilder::update_time)
    pub fn build(self) -> ::std::result::Result<crate::types::Webhook, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Webhook {
            webhook_arn: self.webhook_arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "webhook_arn",
                    "webhook_arn was not specified but it is required when building Webhook",
                )
            })?,
            webhook_id: self.webhook_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "webhook_id",
                    "webhook_id was not specified but it is required when building Webhook",
                )
            })?,
            webhook_url: self.webhook_url.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "webhook_url",
                    "webhook_url was not specified but it is required when building Webhook",
                )
            })?,
            app_id: self.app_id,
            branch_name: self.branch_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "branch_name",
                    "branch_name was not specified but it is required when building Webhook",
                )
            })?,
            description: self.description.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "description",
                    "description was not specified but it is required when building Webhook",
                )
            })?,
            create_time: self.create_time.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "create_time",
                    "create_time was not specified but it is required when building Webhook",
                )
            })?,
            update_time: self.update_time.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "update_time",
                    "update_time was not specified but it is required when building Webhook",
                )
            })?,
        })
    }
}