use new sherpadoc rename mechanism to remove some typename stuttering

the stuttering was introduced to make the same type name declared in multiple
packages, and used in the admin sherpa api, unique. with sherpadoc's new
rename, we can make them unique when generating the api definition/docs, and
the Go code can use nicer names.
This commit is contained in:
Mechiel Lukkien
2024-04-19 10:51:24 +02:00
parent 962575f21b
commit ec967ef321
18 changed files with 73 additions and 83 deletions

View File

@ -1603,7 +1603,7 @@ func (Admin) MTASTSPolicies(ctx context.Context) (records []mtastsdb.PolicyRecor
// TLSReports returns TLS reports overlapping with period start/end, for the given
// policy domain (or all domains if empty). The reports are sorted first by period
// end (most recent first), then by policy domain.
func (Admin) TLSReports(ctx context.Context, start, end time.Time, policyDomain string) (reports []tlsrptdb.TLSReportRecord) {
func (Admin) TLSReports(ctx context.Context, start, end time.Time, policyDomain string) (reports []tlsrptdb.Record) {
var polDom dns.Domain
if policyDomain != "" {
var err error
@ -1625,7 +1625,7 @@ func (Admin) TLSReports(ctx context.Context, start, end time.Time, policyDomain
}
// TLSReportID returns a single TLS report.
func (Admin) TLSReportID(ctx context.Context, domain string, reportID int64) tlsrptdb.TLSReportRecord {
func (Admin) TLSReportID(ctx context.Context, domain string, reportID int64) tlsrptdb.Record {
record, err := tlsrptdb.RecordID(ctx, reportID)
if err == nil && record.Domain != domain {
err = bstore.ErrAbsent
@ -2384,13 +2384,13 @@ func (Admin) TLSRPTSuppressAdd(ctx context.Context, reportingAddress string, unt
addr, err := smtp.ParseAddress(reportingAddress)
xcheckuserf(ctx, err, "parsing reporting address")
ba := tlsrptdb.TLSRPTSuppressAddress{ReportingAddress: addr.String(), Until: until, Comment: comment}
ba := tlsrptdb.SuppressAddress{ReportingAddress: addr.String(), Until: until, Comment: comment}
err = tlsrptdb.SuppressAdd(ctx, &ba)
xcheckf(ctx, err, "adding address to suppresslist")
}
// TLSRPTSuppressList returns all reporting addresses on the suppress list.
func (Admin) TLSRPTSuppressList(ctx context.Context) []tlsrptdb.TLSRPTSuppressAddress {
func (Admin) TLSRPTSuppressList(ctx context.Context) []tlsrptdb.SuppressAddress {
l, err := tlsrptdb.SuppressList(ctx)
xcheckf(ctx, err, "listing reporting addresses in suppresslist")
return l

View File

@ -2947,7 +2947,7 @@
},
{
"Name": "STSMX",
"Docs": "STSMX is an allowlisted MX host name/pattern.\ntodo: find a way to name this just STSMX without getting duplicate names for \"MX\" in the sherpa api.",
"Docs": "MX is an allowlisted MX host name/pattern.",
"Fields": [
{
"Name": "Wildcard",
@ -4041,7 +4041,7 @@
},
{
"Name": "TLSReportRecord",
"Docs": "TLSReportRecord is a TLS report as a database record, including information\nabout the sender.\n\ntodo: should be named just Record, but it would cause a sherpa type name conflict.",
"Docs": "Record is a TLS report as a database record, including information\nabout the sender.",
"Fields": [
{
"Name": "ID",
@ -6802,7 +6802,7 @@
},
{
"Name": "TLSRPTSuppressAddress",
"Docs": "TLSRPTSuppressAddress is a reporting address for which outgoing TLS reports\nwill be suppressed for a period.",
"Docs": "SuppressAddress is a reporting address for which outgoing TLS reports\nwill be suppressed for a period.",
"Fields": [
{
"Name": "ID",

View File

@ -221,8 +221,7 @@ export interface Policy {
Extensions?: Pair[] | null
}
// STSMX is an allowlisted MX host name/pattern.
// todo: find a way to name this just STSMX without getting duplicate names for "MX" in the sherpa api.
// MX is an allowlisted MX host name/pattern.
export interface STSMX {
Wildcard: boolean // "*." wildcard, e.g. if a subdomain matches. A wildcard must match exactly one label. *.example.com matches mail.example.com, but not example.com, and not foor.bar.example.com.
Domain: Domain
@ -425,10 +424,8 @@ export interface PolicyRecord {
PolicyText: string // Text that make up the policy, as retrieved. We didn't store this in the past. If empty, policy can be reconstructed from Policy field. Needed by TLSRPT.
}
// TLSReportRecord is a TLS report as a database record, including information
// Record is a TLS report as a database record, including information
// about the sender.
//
// todo: should be named just Record, but it would cause a sherpa type name conflict.
export interface TLSReportRecord {
ID: number
Domain: string // Policy domain to which the TLS report applies. Unicode.
@ -995,7 +992,7 @@ export interface TLSResult {
Results?: Result[] | null // Results is updated for each TLS attempt.
}
// TLSRPTSuppressAddress is a reporting address for which outgoing TLS reports
// SuppressAddress is a reporting address for which outgoing TLS reports
// will be suppressed for a period.
export interface TLSRPTSuppressAddress {
ID: number