diff --git a/cmd/dbaas_user_reveal_kafka.go b/cmd/dbaas_user_reveal_kafka.go index 271295ac..93d6066f 100644 --- a/cmd/dbaas_user_reveal_kafka.go +++ b/cmd/dbaas_user_reveal_kafka.go @@ -2,6 +2,7 @@ package cmd import ( "context" + "time" "github.com/exoscale/cli/pkg/globalstate" "github.com/exoscale/cli/pkg/output" @@ -10,11 +11,16 @@ import ( ) type dbaasKafkaUserRevealOutput struct { - AccessKey string `json:"access-key,omitempty"` + AccessKey string `json:"access-key,omitempty"` + AccessCert string `json:"access-cert,omitempty"` + AccessCertExpiry time.Time `json:"access-cert-expiry,omitempty"` } func (o *dbaasKafkaUserRevealOutput) formatUser(t *table.Table) { + t.Append([]string{"Access Cert", o.AccessCert}) t.Append([]string{"Access Key", o.AccessKey}) + t.Append([]string{"Access Cert Expiry", o.AccessCertExpiry.String()}) + } func (c *dbaasUserRevealCmd) revealKafka(ctx context.Context) (output.Outputter, error) { @@ -32,7 +38,9 @@ func (c *dbaasUserRevealCmd) revealKafka(ctx context.Context) (output.Outputter, return &dbaasUserRevealOutput{ Password: s.Password, Kafka: &dbaasKafkaUserRevealOutput{ - AccessKey: s.AccessKey, + AccessKey: s.AccessKey, + AccessCert: s.AccessCert, + AccessCertExpiry: s.AccessCertExpiry, }, }, nil } diff --git a/cmd/dbaas_user_show.go b/cmd/dbaas_user_show.go index 65f1c34d..f4ef3856 100644 --- a/cmd/dbaas_user_show.go +++ b/cmd/dbaas_user_show.go @@ -15,7 +15,6 @@ type dbaasUserShowOutput struct { // Additional user info for some DBAAS Services MySQL *dbaasMysqlUserShowOutput `json:"mysql,omitempty"` - Kafka *dbaasKafkaUserShowOutput `json:"kafka,omitempty"` PG *dbaasPGUserShowOutput `json:"pg,omitempty"` } @@ -34,8 +33,6 @@ func (o *dbaasUserShowOutput) ToTable() { switch { case o.MySQL != nil: o.MySQL.formatUser(t) - case o.Kafka != nil: - o.Kafka.formatUser(t) case o.PG != nil: o.PG.formatUser(t) } diff --git a/cmd/dbaas_user_show_kafka.go b/cmd/dbaas_user_show_kafka.go index 2bf60810..5f8d1949 100644 --- a/cmd/dbaas_user_show_kafka.go +++ b/cmd/dbaas_user_show_kafka.go @@ -3,26 +3,12 @@ package cmd import ( "context" "fmt" - "time" "github.com/exoscale/cli/pkg/globalstate" "github.com/exoscale/cli/pkg/output" - "github.com/exoscale/cli/table" v3 "github.com/exoscale/egoscale/v3" ) -type dbaasKafkaUserShowOutput struct { - AccessKey string `json:"access-key,omitempty"` - AccessCert string `json:"access-cert,omitempty"` - AccessCertExpiry time.Time `json:"access-cert-expiry,omitempty"` -} - -func (o *dbaasKafkaUserShowOutput) formatUser(t *table.Table) { - t.Append([]string{"Access Key", o.AccessKey}) - t.Append([]string{"Access Cert", o.AccessCert}) - t.Append([]string{"Access Cert Expiry", o.AccessCertExpiry.String()}) -} - func (c *dbaasUserShowCmd) showKafka(ctx context.Context) (output.Outputter, error) { client, err := switchClientZoneV3(ctx, globalstate.EgoscaleV3Client, v3.ZoneName(c.Zone)) @@ -40,10 +26,6 @@ func (c *dbaasUserShowCmd) showKafka(ctx context.Context) (output.Outputter, err return &dbaasUserShowOutput{ Username: c.Username, Type: u.Type, - Kafka: &dbaasKafkaUserShowOutput{ - AccessCert: u.AccessCert, - AccessCertExpiry: u.AccessCertExpiry, - }, }, nil }