Skip to content

Commit cdb948a

Browse files
authored
dns: add support for enum marshall status for certificate (#1881)
1 parent c5e0d4b commit cdb948a

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

internal/namespaces/domain/v2beta1/custom.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ func GetCommands() *core.Commands {
2222
))
2323

2424
human.RegisterMarshalerFunc(domain.DNSZoneStatus(""), human.EnumMarshalFunc(zoneStatusMarshalSpecs))
25+
human.RegisterMarshalerFunc(domain.SSLCertificateStatus(""), human.EnumMarshalFunc(certificateStatusMarshalSpecs))
2526
return cmds
2627
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package domain
2+
3+
import (
4+
"github.com/fatih/color"
5+
"github.com/scaleway/scaleway-cli/internal/human"
6+
domain "github.com/scaleway/scaleway-sdk-go/api/domain/v2beta1"
7+
)
8+
9+
// certificateStatusMarshalSpecs marshals a domain.SSLCertificateStatus.
10+
var (
11+
certificateStatusMarshalSpecs = human.EnumMarshalSpecs{
12+
domain.SSLCertificateStatusError: &human.EnumMarshalSpec{Attribute: color.FgRed},
13+
domain.SSLCertificateStatusNew: &human.EnumMarshalSpec{Attribute: color.FgBlue},
14+
domain.SSLCertificateStatusPending: &human.EnumMarshalSpec{Attribute: color.FgBlue},
15+
domain.SSLCertificateStatusSuccess: &human.EnumMarshalSpec{Attribute: color.FgGreen},
16+
domain.SSLCertificateStatusUnknown: &human.EnumMarshalSpec{Attribute: color.Faint},
17+
}
18+
)

0 commit comments

Comments
 (0)