@@ -45,7 +45,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
4545}
4646
4747func configureFlags (cmd * cobra.Command ) {
48- cmd .Flags ().String ("name" , "" , "the name of the security group" )
48+ cmd .Flags ().String ("name" , "" , "the name of the security group. Must be <= 63 chars " )
4949 cmd .Flags ().String ("description" , "" , "an optional description of the security group. Must be <= 127 chars" )
5050 cmd .Flags ().Bool ("stateful" , false , "create a stateful or a stateless security group" )
5151 cmd .Flags ().StringSlice ("labels" , nil , "a list of labels in the form <key>=<value>" )
@@ -95,6 +95,13 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
9595 if globalFlags .ProjectId == "" {
9696 return nil , & errors.ProjectIdError {}
9797 }
98+ name := flags .FlagToStringValue (p , cmd , "name" )
99+ if len (name ) >= 64 {
100+ return nil , & errors.ArgValidationError {
101+ Arg : "invalid name" ,
102+ Details : "name exceeds 63 characters in length" ,
103+ }
104+ }
98105
99106 labels := make (map [string ]any )
100107 for _ , label := range flags .FlagToStringSliceValue (p , cmd , "labels" ) {
@@ -117,7 +124,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
117124 }
118125 model := inputModel {
119126 GlobalFlagModel : globalFlags ,
120- Name : flags . FlagToStringValue ( p , cmd , " name" ) ,
127+ Name : name ,
121128
122129 Labels : labels ,
123130 Description : description ,
0 commit comments