Skip to main content

aws_sdk_glue/types/
_code_gen_node.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents a node in a directed acyclic graph (DAG)</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CodeGenNode {
7    /// <p>A node identifier that is unique within the node's graph.</p>
8    pub id: ::std::string::String,
9    /// <p>The type of node that this is.</p>
10    pub node_type: ::std::string::String,
11    /// <p>Properties of the node, in the form of name-value pairs.</p>
12    pub args: ::std::vec::Vec<crate::types::CodeGenNodeArg>,
13    /// <p>The line number of the node.</p>
14    pub line_number: i32,
15}
16impl CodeGenNode {
17    /// <p>A node identifier that is unique within the node's graph.</p>
18    pub fn id(&self) -> &str {
19        use std::ops::Deref;
20        self.id.deref()
21    }
22    /// <p>The type of node that this is.</p>
23    pub fn node_type(&self) -> &str {
24        use std::ops::Deref;
25        self.node_type.deref()
26    }
27    /// <p>Properties of the node, in the form of name-value pairs.</p>
28    pub fn args(&self) -> &[crate::types::CodeGenNodeArg] {
29        use std::ops::Deref;
30        self.args.deref()
31    }
32    /// <p>The line number of the node.</p>
33    pub fn line_number(&self) -> i32 {
34        self.line_number
35    }
36}
37impl CodeGenNode {
38    /// Creates a new builder-style object to manufacture [`CodeGenNode`](crate::types::CodeGenNode).
39    pub fn builder() -> crate::types::builders::CodeGenNodeBuilder {
40        crate::types::builders::CodeGenNodeBuilder::default()
41    }
42}
43
44/// A builder for [`CodeGenNode`](crate::types::CodeGenNode).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
46#[non_exhaustive]
47pub struct CodeGenNodeBuilder {
48    pub(crate) id: ::std::option::Option<::std::string::String>,
49    pub(crate) node_type: ::std::option::Option<::std::string::String>,
50    pub(crate) args: ::std::option::Option<::std::vec::Vec<crate::types::CodeGenNodeArg>>,
51    pub(crate) line_number: ::std::option::Option<i32>,
52}
53impl CodeGenNodeBuilder {
54    /// <p>A node identifier that is unique within the node's graph.</p>
55    /// This field is required.
56    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
57        self.id = ::std::option::Option::Some(input.into());
58        self
59    }
60    /// <p>A node identifier that is unique within the node's graph.</p>
61    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.id = input;
63        self
64    }
65    /// <p>A node identifier that is unique within the node's graph.</p>
66    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
67        &self.id
68    }
69    /// <p>The type of node that this is.</p>
70    /// This field is required.
71    pub fn node_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
72        self.node_type = ::std::option::Option::Some(input.into());
73        self
74    }
75    /// <p>The type of node that this is.</p>
76    pub fn set_node_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
77        self.node_type = input;
78        self
79    }
80    /// <p>The type of node that this is.</p>
81    pub fn get_node_type(&self) -> &::std::option::Option<::std::string::String> {
82        &self.node_type
83    }
84    /// Appends an item to `args`.
85    ///
86    /// To override the contents of this collection use [`set_args`](Self::set_args).
87    ///
88    /// <p>Properties of the node, in the form of name-value pairs.</p>
89    pub fn args(mut self, input: crate::types::CodeGenNodeArg) -> Self {
90        let mut v = self.args.unwrap_or_default();
91        v.push(input);
92        self.args = ::std::option::Option::Some(v);
93        self
94    }
95    /// <p>Properties of the node, in the form of name-value pairs.</p>
96    pub fn set_args(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CodeGenNodeArg>>) -> Self {
97        self.args = input;
98        self
99    }
100    /// <p>Properties of the node, in the form of name-value pairs.</p>
101    pub fn get_args(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CodeGenNodeArg>> {
102        &self.args
103    }
104    /// <p>The line number of the node.</p>
105    pub fn line_number(mut self, input: i32) -> Self {
106        self.line_number = ::std::option::Option::Some(input);
107        self
108    }
109    /// <p>The line number of the node.</p>
110    pub fn set_line_number(mut self, input: ::std::option::Option<i32>) -> Self {
111        self.line_number = input;
112        self
113    }
114    /// <p>The line number of the node.</p>
115    pub fn get_line_number(&self) -> &::std::option::Option<i32> {
116        &self.line_number
117    }
118    /// Consumes the builder and constructs a [`CodeGenNode`](crate::types::CodeGenNode).
119    /// This method will fail if any of the following fields are not set:
120    /// - [`id`](crate::types::builders::CodeGenNodeBuilder::id)
121    /// - [`node_type`](crate::types::builders::CodeGenNodeBuilder::node_type)
122    /// - [`args`](crate::types::builders::CodeGenNodeBuilder::args)
123    pub fn build(self) -> ::std::result::Result<crate::types::CodeGenNode, ::aws_smithy_types::error::operation::BuildError> {
124        ::std::result::Result::Ok(crate::types::CodeGenNode {
125            id: self.id.ok_or_else(|| {
126                ::aws_smithy_types::error::operation::BuildError::missing_field(
127                    "id",
128                    "id was not specified but it is required when building CodeGenNode",
129                )
130            })?,
131            node_type: self.node_type.ok_or_else(|| {
132                ::aws_smithy_types::error::operation::BuildError::missing_field(
133                    "node_type",
134                    "node_type was not specified but it is required when building CodeGenNode",
135                )
136            })?,
137            args: self.args.ok_or_else(|| {
138                ::aws_smithy_types::error::operation::BuildError::missing_field(
139                    "args",
140                    "args was not specified but it is required when building CodeGenNode",
141                )
142            })?,
143            line_number: self.line_number.unwrap_or_default(),
144        })
145    }
146}