aws-sdk-devopsagent 1.4.0

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

/// Represents a complete Webhook with all its properties, and unique identifier.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Webhook {
    /// Webhook endpoint URL.
    pub webhook_url: ::std::string::String,
    /// Webhook authentication type.
    pub webhook_type: ::std::option::Option<crate::types::WebhookType>,
    /// The unique identifier of the Webhook
    pub webhook_id: ::std::string::String,
}
impl Webhook {
    /// Webhook endpoint URL.
    pub fn webhook_url(&self) -> &str {
        use std::ops::Deref;
        self.webhook_url.deref()
    }
    /// Webhook authentication type.
    pub fn webhook_type(&self) -> ::std::option::Option<&crate::types::WebhookType> {
        self.webhook_type.as_ref()
    }
    /// The unique identifier of the Webhook
    pub fn webhook_id(&self) -> &str {
        use std::ops::Deref;
        self.webhook_id.deref()
    }
}
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_url: ::std::option::Option<::std::string::String>,
    pub(crate) webhook_type: ::std::option::Option<crate::types::WebhookType>,
    pub(crate) webhook_id: ::std::option::Option<::std::string::String>,
}
impl WebhookBuilder {
    /// Webhook endpoint URL.
    /// 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
    }
    /// Webhook endpoint URL.
    pub fn set_webhook_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.webhook_url = input;
        self
    }
    /// Webhook endpoint URL.
    pub fn get_webhook_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.webhook_url
    }
    /// Webhook authentication type.
    pub fn webhook_type(mut self, input: crate::types::WebhookType) -> Self {
        self.webhook_type = ::std::option::Option::Some(input);
        self
    }
    /// Webhook authentication type.
    pub fn set_webhook_type(mut self, input: ::std::option::Option<crate::types::WebhookType>) -> Self {
        self.webhook_type = input;
        self
    }
    /// Webhook authentication type.
    pub fn get_webhook_type(&self) -> &::std::option::Option<crate::types::WebhookType> {
        &self.webhook_type
    }
    /// The unique identifier of the Webhook
    /// 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
    }
    /// The unique identifier of the Webhook
    pub fn set_webhook_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.webhook_id = input;
        self
    }
    /// The unique identifier of the Webhook
    pub fn get_webhook_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.webhook_id
    }
    /// Consumes the builder and constructs a [`Webhook`](crate::types::Webhook).
    /// This method will fail if any of the following fields are not set:
    /// - [`webhook_url`](crate::types::builders::WebhookBuilder::webhook_url)
    /// - [`webhook_id`](crate::types::builders::WebhookBuilder::webhook_id)
    pub fn build(self) -> ::std::result::Result<crate::types::Webhook, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::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",
                )
            })?,
            webhook_type: self.webhook_type,
            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",
                )
            })?,
        })
    }
}