@@ -52,18 +52,16 @@ func runListCmd(cmd *cobra.Command, cfg rst.GetRSTCfg) error {
5252
5353 switch rst .WhichType () {
5454 case flex .RemoteStorageTarget_S3_case :
55- stringBuilder := strings.Builder {}
5655 rstType = "s3"
57- rst .GetS3 ().ProtoReflect ().Range (func (fd protoreflect.FieldDescriptor , v protoreflect.Value ) bool {
58- if string (fd .Name ()) == "secret_key" && ! cfg .ShowSecrets {
59- stringBuilder .WriteString (fmt .Sprintf ("%s: *****, " , fd .Name ()))
60- } else {
61- stringBuilder .WriteString (fmt .Sprintf ("%s: %s, " , fd .Name (), v ))
62- }
63- return true
64- })
65- // Get rid of the last comma+space in the printed configuration.
66- rstConfiguration = stringBuilder .String ()[:stringBuilder .Len ()- 2 ]
56+ rstConfiguration = formatS3RSTConfiguration (rst .GetS3 (), cfg .ShowSecrets )
57+ case flex .RemoteStorageTarget_Xtreemstore_case :
58+ rstType = "xtreemstore"
59+ xtreemstoreConfig := rst .GetXtreemstore ()
60+ if xtreemstoreConfig == nil {
61+ rstConfiguration = "xtreemstore configuration is not set"
62+ break
63+ }
64+ rstConfiguration = formatS3RSTConfiguration (xtreemstoreConfig .GetS3 (), cfg .ShowSecrets )
6765 default :
6866 if ! cfg .ShowSecrets {
6967 rstType = "unknown"
@@ -85,3 +83,25 @@ func runListCmd(cmd *cobra.Command, cfg rst.GetRSTCfg) error {
8583
8684 return nil
8785}
86+
87+ func formatS3RSTConfiguration (s3Config * flex.RemoteStorageTarget_S3 , showSecrets bool ) string {
88+ if s3Config == nil {
89+ return "s3 configuration is not set"
90+ }
91+
92+ stringBuilder := strings.Builder {}
93+ s3Config .ProtoReflect ().Range (func (fd protoreflect.FieldDescriptor , v protoreflect.Value ) bool {
94+ if string (fd .Name ()) == "secret_key" && ! showSecrets {
95+ fmt .Fprintf (& stringBuilder , "%s: *****, " , fd .Name ())
96+ } else {
97+ fmt .Fprintf (& stringBuilder , "%s: %s, " , fd .Name (), v )
98+ }
99+ return true
100+ })
101+
102+ if stringBuilder .Len () == 0 {
103+ return ""
104+ }
105+ // Get rid of the last comma+space in the printed configuration.
106+ return stringBuilder .String ()[:stringBuilder .Len ()- 2 ]
107+ }
0 commit comments