@@ -7,6 +7,7 @@ use std::{num::ParseIntError, str::FromStr};
77
88use snafu:: { OptionExt , ResultExt , Snafu } ;
99use stackable_operator:: {
10+ attributed_string_type,
1011 client:: Client ,
1112 kube:: runtime:: reflector:: { Lookup , ObjectRef } ,
1213 v2:: controller_utils:: get_namespace,
@@ -71,18 +72,17 @@ pub enum Error {
7172 } ,
7273}
7374
74- /// TODO: Use a typed String from operator-rs similar to [`stackable_operator::v2::types::operator::ClusterName`].
75- #[ derive( Clone , Debug , Eq , Ord , PartialEq , PartialOrd ) ]
76- pub struct TrinoCatalogName ( pub String ) ;
77- impl AsRef < str > for TrinoCatalogName {
78- fn as_ref ( & self ) -> & str {
79- & self . 0
80- }
81- }
82- impl std:: fmt:: Display for TrinoCatalogName {
83- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
84- self . 0 . fmt ( f)
85- }
75+ attributed_string_type ! {
76+ TrinoCatalogName ,
77+ "The name of a TrinoCluster" ,
78+ "lakehouse" ,
79+ // Suffixes are added to produce resource names.
80+ //
81+ // 40 characters for catalog names should be sufficient and still allow the operators to append
82+ // custom suffixes to build resource names.
83+ ( max_length = 40 ) ,
84+ is_rfc_1035_label_name,
85+ is_valid_label_value
8686}
8787
8888type Result < T , E = Error > = std:: result:: Result < T , E > ;
0 commit comments