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.

/// Output containing a list of service association webhooks.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ListWebhooksOutput {
    /// The list of association webhooks.
    pub webhooks: ::std::vec::Vec<crate::types::Webhook>,
    _request_id: Option<String>,
}
impl ListWebhooksOutput {
    /// The list of association webhooks.
    pub fn webhooks(&self) -> &[crate::types::Webhook] {
        use std::ops::Deref;
        self.webhooks.deref()
    }
}
impl ::aws_types::request_id::RequestId for ListWebhooksOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ListWebhooksOutput {
    /// Creates a new builder-style object to manufacture [`ListWebhooksOutput`](crate::operation::list_webhooks::ListWebhooksOutput).
    pub fn builder() -> crate::operation::list_webhooks::builders::ListWebhooksOutputBuilder {
        crate::operation::list_webhooks::builders::ListWebhooksOutputBuilder::default()
    }
}

/// A builder for [`ListWebhooksOutput`](crate::operation::list_webhooks::ListWebhooksOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ListWebhooksOutputBuilder {
    pub(crate) webhooks: ::std::option::Option<::std::vec::Vec<crate::types::Webhook>>,
    _request_id: Option<String>,
}
impl ListWebhooksOutputBuilder {
    /// Appends an item to `webhooks`.
    ///
    /// To override the contents of this collection use [`set_webhooks`](Self::set_webhooks).
    ///
    /// The list of association webhooks.
    pub fn webhooks(mut self, input: crate::types::Webhook) -> Self {
        let mut v = self.webhooks.unwrap_or_default();
        v.push(input);
        self.webhooks = ::std::option::Option::Some(v);
        self
    }
    /// The list of association webhooks.
    pub fn set_webhooks(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Webhook>>) -> Self {
        self.webhooks = input;
        self
    }
    /// The list of association webhooks.
    pub fn get_webhooks(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Webhook>> {
        &self.webhooks
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`ListWebhooksOutput`](crate::operation::list_webhooks::ListWebhooksOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`webhooks`](crate::operation::list_webhooks::builders::ListWebhooksOutputBuilder::webhooks)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::list_webhooks::ListWebhooksOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::list_webhooks::ListWebhooksOutput {
            webhooks: self.webhooks.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "webhooks",
                    "webhooks was not specified but it is required when building ListWebhooksOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}