Skip to content

Commit a30a450

Browse files
authored
feat(tem): add auto-configuration state in domain validation (scaleway#2237)
1 parent 341bb81 commit a30a450

File tree

1 file changed

+60
-2
lines changed

1 file changed

+60
-2
lines changed

api/tem/v1alpha1/tem_sdk.go

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,48 @@ var (
3939
_ = namegenerator.GetRandomName
4040
)
4141

42+
type DomainLastStatusAutoconfigStateReason string
43+
44+
const (
45+
// If not specified, the auto-configuration state is unknown by default.
46+
DomainLastStatusAutoconfigStateReasonUnknownReason = DomainLastStatusAutoconfigStateReason("unknown_reason")
47+
// The token doesn't have the necessary permissions to manage the domain's DNS records.
48+
DomainLastStatusAutoconfigStateReasonPermissionDenied = DomainLastStatusAutoconfigStateReason("permission_denied")
49+
// The domain does not exist or isn't manageable by the token.
50+
DomainLastStatusAutoconfigStateReasonDomainNotFound = DomainLastStatusAutoconfigStateReason("domain_not_found")
51+
)
52+
53+
func (enum DomainLastStatusAutoconfigStateReason) String() string {
54+
if enum == "" {
55+
// return default value if empty
56+
return "unknown_reason"
57+
}
58+
return string(enum)
59+
}
60+
61+
func (enum DomainLastStatusAutoconfigStateReason) Values() []DomainLastStatusAutoconfigStateReason {
62+
return []DomainLastStatusAutoconfigStateReason{
63+
"unknown_reason",
64+
"permission_denied",
65+
"domain_not_found",
66+
}
67+
}
68+
69+
func (enum DomainLastStatusAutoconfigStateReason) MarshalJSON() ([]byte, error) {
70+
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
71+
}
72+
73+
func (enum *DomainLastStatusAutoconfigStateReason) UnmarshalJSON(data []byte) error {
74+
tmp := ""
75+
76+
if err := json.Unmarshal(data, &tmp); err != nil {
77+
return err
78+
}
79+
80+
*enum = DomainLastStatusAutoconfigStateReason(DomainLastStatusAutoconfigStateReason(tmp).String())
81+
return nil
82+
}
83+
4284
type DomainLastStatusRecordStatus string
4385

4486
const (
@@ -769,6 +811,19 @@ type Email struct {
769811
Flags []EmailFlag `json:"flags"`
770812
}
771813

814+
// DomainLastStatusAutoconfigState: domain last status autoconfig state.
815+
type DomainLastStatusAutoconfigState struct {
816+
// Enabled: enable or disable the auto-configuration of domain DNS records.
817+
Enabled bool `json:"enabled"`
818+
819+
// Autoconfigurable: whether the domain can be auto-configured or not.
820+
Autoconfigurable bool `json:"autoconfigurable"`
821+
822+
// Reason: the reason that the domain cannot be auto-configurable.
823+
// Default value: unknown_reason
824+
Reason *DomainLastStatusAutoconfigStateReason `json:"reason"`
825+
}
826+
772827
// DomainLastStatusDkimRecord: domain last status dkim record.
773828
type DomainLastStatusDkimRecord struct {
774829
// Status: status of the DKIM record's configuration.
@@ -952,11 +1007,11 @@ type UpdateProjectSettingsRequestUpdatePeriodicReport struct {
9521007
// Enabled: (Optional) Enable or disable periodic report notifications.
9531008
Enabled *bool `json:"enabled"`
9541009

955-
// Frequency: (Optional) At which frequency you receive periodic report notifications.
1010+
// Frequency: (Optional) Frequency at which you receive periodic report notifications.
9561011
// Default value: unknown_frequency
9571012
Frequency *ProjectSettingsPeriodicReportFrequency `json:"frequency"`
9581013

959-
// SendingHour: (Optional) At which hour you receive periodic report notifications.
1014+
// SendingHour: (Optional) Hour at which you receive periodic report notifications.
9601015
SendingHour *uint32 `json:"sending_hour"`
9611016

9621017
// SendingDay: (Optional) On which day you receive periodic report notifications (1-7 weekly, 1-28 monthly).
@@ -1090,6 +1145,9 @@ type DomainLastStatus struct {
10901145

10911146
// DmarcRecord: the DMARC record verification data.
10921147
DmarcRecord *DomainLastStatusDmarcRecord `json:"dmarc_record"`
1148+
1149+
// AutoconfigState: the verification state of domain auto-configuration.
1150+
AutoconfigState *DomainLastStatusAutoconfigState `json:"autoconfig_state"`
10931151
}
10941152

10951153
// GetDomainLastStatusRequest: get domain last status request.

0 commit comments

Comments
 (0)