Skip to main content

unitycatalog_common/models/_gen/
unitycatalog.functions.v1.rs

1// @generated
2// This file is @generated by prost-build.
3/// Information about a single function parameter.
4#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
5#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6pub struct FunctionParameterInfo {
7    /// Name of parameter.
8    #[prost(string, tag="1")]
9    pub name: ::prost::alloc::string::String,
10    /// Full data type specification as SQL/catalogString text.
11    #[prost(string, tag="2")]
12    pub type_text: ::prost::alloc::string::String,
13    /// Full data type specification, JSON-serialized.
14    #[prost(string, optional, tag="3")]
15    pub type_json: ::core::option::Option<::prost::alloc::string::String>,
16    /// Data type name.
17    #[prost(enumeration="super::super::tables::v1::ColumnTypeName", tag="4")]
18    pub type_name: i32,
19    /// Digits of precision; required for DecimalTypes.
20    #[prost(int32, optional, tag="5")]
21    pub type_precision: ::core::option::Option<i32>,
22    /// Digits to right of decimal; required for DecimalTypes.
23    #[prost(int32, optional, tag="6")]
24    pub type_scale: ::core::option::Option<i32>,
25    /// Format of IntervalType.
26    #[prost(string, optional, tag="7")]
27    pub type_interval_type: ::core::option::Option<::prost::alloc::string::String>,
28    /// Ordinal position of column (starting at position 0).
29    #[prost(int32, optional, tag="8")]
30    pub position: ::core::option::Option<i32>,
31    /// The mode of the function parameter.
32    #[prost(enumeration="ParameterMode", tag="9")]
33    pub parameter_mode: i32,
34    /// The type of function parameter.
35    #[prost(enumeration="FunctionParameterType", tag="10")]
36    pub parameter_type: i32,
37    /// Default value of the parameter.
38    #[prost(string, optional, tag="11")]
39    pub parameter_default: ::core::option::Option<::prost::alloc::string::String>,
40    /// User-provided free-form text description.
41    #[prost(string, optional, tag="12")]
42    pub comment: ::core::option::Option<::prost::alloc::string::String>,
43}
44/// A collection of function parameters.
45#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
46#[derive(Clone, PartialEq, ::prost::Message)]
47pub struct FunctionParameterInfos {
48    /// The parameters of the function.
49    #[prost(message, repeated, tag="1")]
50    pub parameters: ::prost::alloc::vec::Vec<FunctionParameterInfo>,
51}
52/// A User-Defined Function (UDF) registered under a catalog + schema hierarchy.
53#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct Function {
56    /// Name of function, relative to parent schema.
57    #[prost(string, tag="1")]
58    pub name: ::prost::alloc::string::String,
59    /// Name of parent catalog.
60    #[prost(string, tag="2")]
61    pub catalog_name: ::prost::alloc::string::String,
62    /// Name of parent schema.
63    #[prost(string, tag="3")]
64    pub schema_name: ::prost::alloc::string::String,
65    /// The three-level (fully qualified) name of the function.
66    ///
67    /// Format: catalog_name.schema_name.function_name
68    #[prost(string, tag="4")]
69    pub full_name: ::prost::alloc::string::String,
70    /// Full data type specification of the return type of the function.
71    #[prost(string, tag="5")]
72    pub data_type: ::prost::alloc::string::String,
73    /// Full data type specification as SQL/catalogString text.
74    #[prost(string, tag="6")]
75    pub full_data_type: ::prost::alloc::string::String,
76    /// The array of function parameter infos.
77    #[prost(message, optional, tag="7")]
78    pub input_params: ::core::option::Option<FunctionParameterInfos>,
79    /// The return type of the function in JSON format.
80    #[prost(string, optional, tag="8")]
81    pub return_params: ::core::option::Option<::prost::alloc::string::String>,
82    /// The language of the function routine body.
83    #[prost(string, optional, tag="9")]
84    pub routine_body_language: ::core::option::Option<::prost::alloc::string::String>,
85    /// Function body.
86    #[prost(string, optional, tag="10")]
87    pub routine_definition: ::core::option::Option<::prost::alloc::string::String>,
88    /// Function dependencies (in JSON form).
89    #[prost(string, optional, tag="11")]
90    pub routine_dependencies: ::core::option::Option<::prost::alloc::string::String>,
91    /// The parameter-passing style.
92    #[prost(enumeration="ParameterStyle", tag="12")]
93    pub parameter_style: i32,
94    /// Indicates whether the function is deterministic.
95    #[prost(bool, tag="13")]
96    pub is_deterministic: bool,
97    /// SQL data access information.
98    #[prost(enumeration="SqlDataAccess", tag="14")]
99    pub sql_data_access: i32,
100    /// Indicates whether the function is null-calling.
101    #[prost(bool, tag="15")]
102    pub is_null_call: bool,
103    /// The security type of the function.
104    #[prost(enumeration="SecurityType", tag="16")]
105    pub security_type: i32,
106    /// The type of the function (SCALAR or TABLE).
107    #[prost(string, optional, tag="17")]
108    pub specific_name: ::core::option::Option<::prost::alloc::string::String>,
109    /// The routine body.
110    #[prost(enumeration="RoutineBody", tag="18")]
111    pub routine_body: i32,
112    /// User-provided free-form text description.
113    #[prost(string, optional, tag="19")]
114    pub comment: ::core::option::Option<::prost::alloc::string::String>,
115    /// A map of key-value properties attached to the securable.
116    #[prost(map="string, string", tag="20")]
117    pub properties: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
118    /// Username of current owner of the function.
119    #[prost(string, optional, tag="21")]
120    pub owner: ::core::option::Option<::prost::alloc::string::String>,
121    /// Unique identifier for the function.
122    #[prost(string, optional, tag="22")]
123    pub function_id: ::core::option::Option<::prost::alloc::string::String>,
124    /// Time at which this function was created, in epoch milliseconds.
125    #[prost(int64, optional, tag="1000")]
126    pub created_at: ::core::option::Option<i64>,
127    /// Username of function creator.
128    #[prost(string, optional, tag="1001")]
129    pub created_by: ::core::option::Option<::prost::alloc::string::String>,
130    /// Time at which this function was last updated, in epoch milliseconds.
131    #[prost(int64, optional, tag="1002")]
132    pub updated_at: ::core::option::Option<i64>,
133    /// Username of user who last modified the function.
134    #[prost(string, optional, tag="1003")]
135    pub updated_by: ::core::option::Option<::prost::alloc::string::String>,
136}
137/// Determines whether the function body is interpreted as SQL or as an external function.
138#[cfg_attr(feature = "python", ::pyo3::pyclass)]
139#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
140#[repr(i32)]
141pub enum RoutineBody {
142    Unspecified = 0,
143    /// The function is defined in SQL.
144    Sql = 1,
145    /// The function is defined externally.
146    External = 2,
147}
148impl RoutineBody {
149    /// String value of the enum field names used in the ProtoBuf definition.
150    ///
151    /// The values are not transformed in any way and thus are considered stable
152    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
153    pub fn as_str_name(&self) -> &'static str {
154        match self {
155            Self::Unspecified => "ROUTINE_BODY_UNSPECIFIED",
156            Self::Sql => "SQL",
157            Self::External => "EXTERNAL",
158        }
159    }
160    /// Creates an enum from field names used in the ProtoBuf definition.
161    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
162        match value {
163            "ROUTINE_BODY_UNSPECIFIED" => Some(Self::Unspecified),
164            "SQL" => Some(Self::Sql),
165            "EXTERNAL" => Some(Self::External),
166            _ => None,
167        }
168    }
169}
170/// The parameter-passing style.
171#[cfg_attr(feature = "python", ::pyo3::pyclass)]
172#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
173#[repr(i32)]
174pub enum ParameterStyle {
175    Unspecified = 0,
176    /// The parameters are passed positionally (S = SQL).
177    S = 1,
178}
179impl ParameterStyle {
180    /// String value of the enum field names used in the ProtoBuf definition.
181    ///
182    /// The values are not transformed in any way and thus are considered stable
183    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
184    pub fn as_str_name(&self) -> &'static str {
185        match self {
186            Self::Unspecified => "PARAMETER_STYLE_UNSPECIFIED",
187            Self::S => "S",
188        }
189    }
190    /// Creates an enum from field names used in the ProtoBuf definition.
191    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
192        match value {
193            "PARAMETER_STYLE_UNSPECIFIED" => Some(Self::Unspecified),
194            "S" => Some(Self::S),
195            _ => None,
196        }
197    }
198}
199/// The security type of the function.
200#[cfg_attr(feature = "python", ::pyo3::pyclass)]
201#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
202#[repr(i32)]
203pub enum SecurityType {
204    Unspecified = 0,
205    /// The function runs as the invoking user (DEFINER = standard SQL semantics).
206    Definer = 1,
207}
208impl SecurityType {
209    /// String value of the enum field names used in the ProtoBuf definition.
210    ///
211    /// The values are not transformed in any way and thus are considered stable
212    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
213    pub fn as_str_name(&self) -> &'static str {
214        match self {
215            Self::Unspecified => "SECURITY_TYPE_UNSPECIFIED",
216            Self::Definer => "DEFINER",
217        }
218    }
219    /// Creates an enum from field names used in the ProtoBuf definition.
220    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
221        match value {
222            "SECURITY_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
223            "DEFINER" => Some(Self::Definer),
224            _ => None,
225        }
226    }
227}
228/// Information about the SQL data access capability of the function.
229#[cfg_attr(feature = "python", ::pyo3::pyclass)]
230#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
231#[repr(i32)]
232pub enum SqlDataAccess {
233    Unspecified = 0,
234    /// Function contains no SQL.
235    ContainsSql = 1,
236    /// Function reads from SQL tables or views.
237    ReadsSqlData = 2,
238    /// Function does not use SQL and does not access data.
239    NoSql = 3,
240}
241impl SqlDataAccess {
242    /// String value of the enum field names used in the ProtoBuf definition.
243    ///
244    /// The values are not transformed in any way and thus are considered stable
245    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
246    pub fn as_str_name(&self) -> &'static str {
247        match self {
248            Self::Unspecified => "SQL_DATA_ACCESS_UNSPECIFIED",
249            Self::ContainsSql => "CONTAINS_SQL",
250            Self::ReadsSqlData => "READS_SQL_DATA",
251            Self::NoSql => "NO_SQL",
252        }
253    }
254    /// Creates an enum from field names used in the ProtoBuf definition.
255    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
256        match value {
257            "SQL_DATA_ACCESS_UNSPECIFIED" => Some(Self::Unspecified),
258            "CONTAINS_SQL" => Some(Self::ContainsSql),
259            "READS_SQL_DATA" => Some(Self::ReadsSqlData),
260            "NO_SQL" => Some(Self::NoSql),
261            _ => None,
262        }
263    }
264}
265/// The mode of the function parameter.
266#[cfg_attr(feature = "python", ::pyo3::pyclass)]
267#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
268#[repr(i32)]
269pub enum ParameterMode {
270    Unspecified = 0,
271    /// Input parameter.
272    In = 1,
273}
274impl ParameterMode {
275    /// String value of the enum field names used in the ProtoBuf definition.
276    ///
277    /// The values are not transformed in any way and thus are considered stable
278    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
279    pub fn as_str_name(&self) -> &'static str {
280        match self {
281            Self::Unspecified => "PARAMETER_MODE_UNSPECIFIED",
282            Self::In => "IN",
283        }
284    }
285    /// Creates an enum from field names used in the ProtoBuf definition.
286    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
287        match value {
288            "PARAMETER_MODE_UNSPECIFIED" => Some(Self::Unspecified),
289            "IN" => Some(Self::In),
290            _ => None,
291        }
292    }
293}
294/// The type of the function parameter.
295#[cfg_attr(feature = "python", ::pyo3::pyclass)]
296#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
297#[repr(i32)]
298pub enum FunctionParameterType {
299    Unspecified = 0,
300    /// A named column parameter.
301    Column = 1,
302    /// A named parameter (default).
303    Param = 2,
304}
305impl FunctionParameterType {
306    /// String value of the enum field names used in the ProtoBuf definition.
307    ///
308    /// The values are not transformed in any way and thus are considered stable
309    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
310    pub fn as_str_name(&self) -> &'static str {
311        match self {
312            Self::Unspecified => "FUNCTION_PARAMETER_TYPE_UNSPECIFIED",
313            Self::Column => "COLUMN",
314            Self::Param => "PARAM",
315        }
316    }
317    /// Creates an enum from field names used in the ProtoBuf definition.
318    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
319        match value {
320            "FUNCTION_PARAMETER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
321            "COLUMN" => Some(Self::Column),
322            "PARAM" => Some(Self::Param),
323            _ => None,
324        }
325    }
326}
327/// List functions in a schema
328#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
329#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
330pub struct ListFunctionsRequest {
331    /// Name of parent catalog for functions of interest.
332    #[prost(string, tag="1")]
333    pub catalog_name: ::prost::alloc::string::String,
334    /// Parent schema of functions.
335    #[prost(string, tag="2")]
336    pub schema_name: ::prost::alloc::string::String,
337    /// The maximum number of results per page that should be returned.
338    #[prost(int32, optional, tag="3")]
339    pub max_results: ::core::option::Option<i32>,
340    /// Opaque pagination token to go to next page based on previous query.
341    #[prost(string, optional, tag="4")]
342    pub page_token: ::core::option::Option<::prost::alloc::string::String>,
343    /// Whether to include functions in the response for which the principal can only access selective metadata for.
344    #[prost(bool, optional, tag="5")]
345    pub include_browse: ::core::option::Option<bool>,
346}
347/// List functions response.
348#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
349#[derive(Clone, PartialEq, ::prost::Message)]
350pub struct ListFunctionsResponse {
351    /// The functions returned.
352    #[prost(message, repeated, tag="1")]
353    pub functions: ::prost::alloc::vec::Vec<Function>,
354    /// The next_page_token value to include in the next List request.
355    #[prost(string, optional, tag="2")]
356    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
357}
358/// Create a new function
359#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
360#[derive(Clone, PartialEq, ::prost::Message)]
361pub struct CreateFunctionRequest {
362    /// Name of function, relative to parent schema.
363    #[prost(string, tag="1")]
364    pub name: ::prost::alloc::string::String,
365    /// Name of parent catalog.
366    #[prost(string, tag="2")]
367    pub catalog_name: ::prost::alloc::string::String,
368    /// Name of parent schema.
369    #[prost(string, tag="3")]
370    pub schema_name: ::prost::alloc::string::String,
371    /// Full data type specification of the return type of the function.
372    #[prost(string, tag="4")]
373    pub data_type: ::prost::alloc::string::String,
374    /// Full data type specification as SQL/catalogString text.
375    #[prost(string, tag="5")]
376    pub full_data_type: ::prost::alloc::string::String,
377    /// The array of function parameter infos.
378    #[prost(message, optional, tag="6")]
379    pub input_params: ::core::option::Option<FunctionParameterInfos>,
380    /// The parameter-passing style.
381    #[prost(enumeration="ParameterStyle", tag="7")]
382    pub parameter_style: i32,
383    /// Indicates whether the function is deterministic.
384    #[prost(bool, tag="8")]
385    pub is_deterministic: bool,
386    /// SQL data access information.
387    #[prost(enumeration="SqlDataAccess", tag="9")]
388    pub sql_data_access: i32,
389    /// Indicates whether the function is null-calling.
390    #[prost(bool, tag="10")]
391    pub is_null_call: bool,
392    /// The security type of the function.
393    #[prost(enumeration="SecurityType", tag="11")]
394    pub security_type: i32,
395    /// The routine body.
396    #[prost(enumeration="RoutineBody", tag="12")]
397    pub routine_body: i32,
398    /// Function body.
399    #[prost(string, optional, tag="13")]
400    pub routine_definition: ::core::option::Option<::prost::alloc::string::String>,
401    /// The language of the function routine body.
402    #[prost(string, optional, tag="14")]
403    pub routine_body_language: ::core::option::Option<::prost::alloc::string::String>,
404    /// User-provided free-form text description.
405    #[prost(string, optional, tag="15")]
406    pub comment: ::core::option::Option<::prost::alloc::string::String>,
407    /// A map of key-value properties attached to the securable.
408    #[prost(map="string, string", tag="16")]
409    pub properties: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
410}
411/// Get a function
412#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
413#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
414pub struct GetFunctionRequest {
415    /// The fully-qualified name of the function (three-level name: catalog.schema.function).
416    #[prost(string, tag="1")]
417    pub name: ::prost::alloc::string::String,
418}
419/// Update a function
420#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
421#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
422pub struct UpdateFunctionRequest {
423    /// The fully-qualified name of the function (three-level name: catalog.schema.function).
424    #[prost(string, tag="1")]
425    pub name: ::prost::alloc::string::String,
426    /// Username of new owner of the function.
427    #[prost(string, optional, tag="2")]
428    pub owner: ::core::option::Option<::prost::alloc::string::String>,
429}
430/// Delete a function
431#[cfg_attr(feature = "python", ::pyo3::pyclass(get_all, set_all))]
432#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
433pub struct DeleteFunctionRequest {
434    /// The fully-qualified name of the function (three-level name: catalog.schema.function).
435    #[prost(string, tag="1")]
436    pub name: ::prost::alloc::string::String,
437    /// Force deletion even if the function is not empty.
438    #[prost(bool, optional, tag="2")]
439    pub force: ::core::option::Option<bool>,
440}
441include!("unitycatalog.functions.v1.serde.rs");
442// @@protoc_insertion_point(module)