aws-sdk-accessanalyzer 1.106.0

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

/// <p>A position in a policy.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Position {
    /// <p>The line of the position, starting from 1.</p>
    pub line: i32,
    /// <p>The column of the position, starting from 0.</p>
    pub column: i32,
    /// <p>The offset within the policy that corresponds to the position, starting from 0.</p>
    pub offset: i32,
}
impl Position {
    /// <p>The line of the position, starting from 1.</p>
    pub fn line(&self) -> i32 {
        self.line
    }
    /// <p>The column of the position, starting from 0.</p>
    pub fn column(&self) -> i32 {
        self.column
    }
    /// <p>The offset within the policy that corresponds to the position, starting from 0.</p>
    pub fn offset(&self) -> i32 {
        self.offset
    }
}
impl Position {
    /// Creates a new builder-style object to manufacture [`Position`](crate::types::Position).
    pub fn builder() -> crate::types::builders::PositionBuilder {
        crate::types::builders::PositionBuilder::default()
    }
}

/// A builder for [`Position`](crate::types::Position).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PositionBuilder {
    pub(crate) line: ::std::option::Option<i32>,
    pub(crate) column: ::std::option::Option<i32>,
    pub(crate) offset: ::std::option::Option<i32>,
}
impl PositionBuilder {
    /// <p>The line of the position, starting from 1.</p>
    /// This field is required.
    pub fn line(mut self, input: i32) -> Self {
        self.line = ::std::option::Option::Some(input);
        self
    }
    /// <p>The line of the position, starting from 1.</p>
    pub fn set_line(mut self, input: ::std::option::Option<i32>) -> Self {
        self.line = input;
        self
    }
    /// <p>The line of the position, starting from 1.</p>
    pub fn get_line(&self) -> &::std::option::Option<i32> {
        &self.line
    }
    /// <p>The column of the position, starting from 0.</p>
    /// This field is required.
    pub fn column(mut self, input: i32) -> Self {
        self.column = ::std::option::Option::Some(input);
        self
    }
    /// <p>The column of the position, starting from 0.</p>
    pub fn set_column(mut self, input: ::std::option::Option<i32>) -> Self {
        self.column = input;
        self
    }
    /// <p>The column of the position, starting from 0.</p>
    pub fn get_column(&self) -> &::std::option::Option<i32> {
        &self.column
    }
    /// <p>The offset within the policy that corresponds to the position, starting from 0.</p>
    /// This field is required.
    pub fn offset(mut self, input: i32) -> Self {
        self.offset = ::std::option::Option::Some(input);
        self
    }
    /// <p>The offset within the policy that corresponds to the position, starting from 0.</p>
    pub fn set_offset(mut self, input: ::std::option::Option<i32>) -> Self {
        self.offset = input;
        self
    }
    /// <p>The offset within the policy that corresponds to the position, starting from 0.</p>
    pub fn get_offset(&self) -> &::std::option::Option<i32> {
        &self.offset
    }
    /// Consumes the builder and constructs a [`Position`](crate::types::Position).
    /// This method will fail if any of the following fields are not set:
    /// - [`line`](crate::types::builders::PositionBuilder::line)
    /// - [`column`](crate::types::builders::PositionBuilder::column)
    /// - [`offset`](crate::types::builders::PositionBuilder::offset)
    pub fn build(self) -> ::std::result::Result<crate::types::Position, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Position {
            line: self.line.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "line",
                    "line was not specified but it is required when building Position",
                )
            })?,
            column: self.column.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "column",
                    "column was not specified but it is required when building Position",
                )
            })?,
            offset: self.offset.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "offset",
                    "offset was not specified but it is required when building Position",
                )
            })?,
        })
    }
}