service

package
v1.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAuditAction = fmt.Errorf("not a valid AuditAction, try [%s]", strings.Join(_AuditActionNames, ", "))
View Source
var ErrInvalidAuditResourceType = fmt.Errorf("not a valid AuditResourceType, try [%s]", strings.Join(_AuditResourceTypeNames, ", "))
View Source
var ErrInvalidAuditSource = fmt.Errorf("not a valid AuditSource, try [%s]", strings.Join(_AuditSourceNames, ", "))
View Source
var ErrInvalidDNSRecordStrategy = fmt.Errorf("not a valid DNSRecordStrategy, try [%s]", strings.Join(_DNSRecordStrategyNames, ", "))
View Source
var ErrInvalidDNSRecordType = fmt.Errorf("not a valid DNSRecordType, try [%s]", strings.Join(_DNSRecordTypeNames, ", "))
View Source
var ErrInvalidEventProtocol = fmt.Errorf("not a valid EventProtocol, try [%s]", strings.Join(_EventProtocolNames, ", "))
View Source
var ErrInvalidHTTPMethod = fmt.Errorf("not a valid HTTPMethod, try [%s]", strings.Join(_HTTPMethodNames, ", "))
View Source
var ErrInvalidProtoCategory = fmt.Errorf("not a valid ProtoCategory, try [%s]", strings.Join(_ProtoCategoryNames, ", "))

Functions

func AuditActionNames

func AuditActionNames() []string

AuditActionNames returns a list of possible string values of AuditAction.

func AuditResourceTypeNames

func AuditResourceTypeNames() []string

AuditResourceTypeNames returns a list of possible string values of AuditResourceType.

func AuditSourceNames

func AuditSourceNames() []string

AuditSourceNames returns a list of possible string values of AuditSource.

func DNSRecordStrategyNames

func DNSRecordStrategyNames() []string

DNSRecordStrategyNames returns a list of possible string values of DNSRecordStrategy.

func DNSRecordTypeNames

func DNSRecordTypeNames() []string

DNSRecordTypeNames returns a list of possible string values of DNSRecordType.

func EventProtocolNames

func EventProtocolNames() []string

EventProtocolNames returns a list of possible string values of EventProtocol.

func HTTPMethodNames

func HTTPMethodNames() []string

HTTPMethodNames returns a list of possible string values of HTTPMethod.

func ProtoCategoryNames

func ProtoCategoryNames() []string

ProtoCategoryNames returns a list of possible string values of ProtoCategory.

func WithCaller

func WithCaller(ctx context.Context, c Caller) context.Context

WithCaller returns a context carrying c. It should only be called by the auth boundary; everything else reads identity via CallerFrom.

Types

type AuditAction

type AuditAction string

ENUM(create, update, delete)

const (
	// AuditActionCreate is a AuditAction of type create.
	AuditActionCreate AuditAction = "create"
	// AuditActionUpdate is a AuditAction of type update.
	AuditActionUpdate AuditAction = "update"
	// AuditActionDelete is a AuditAction of type delete.
	AuditActionDelete AuditAction = "delete"
)

func AuditActionValues

func AuditActionValues() []AuditAction

AuditActionValues returns a list of the values for AuditAction

func ParseAuditAction

func ParseAuditAction(name string) (AuditAction, error)

ParseAuditAction attempts to convert a string to a AuditAction.

func (*AuditAction) Get

func (x *AuditAction) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (AuditAction) IsValid

func (x AuditAction) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (AuditAction) Ptr

func (x AuditAction) Ptr() *AuditAction

func (*AuditAction) Set

func (x *AuditAction) Set(val string) error

Set implements the Golang flag.Value interface func.

func (AuditAction) String

func (x AuditAction) String() string

String implements the Stringer interface.

func (*AuditAction) Type

func (x *AuditAction) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type AuditRecord

type AuditRecord struct {
	ID           int64             `json:"id"`
	UUID         string            `json:"uuid"`
	CreatedAt    time.Time         `json:"createdAt"`
	Action       AuditAction       `json:"action"`
	ResourceType AuditResourceType `json:"resourceType"`
	Source       AuditSource       `json:"source"`
	ActorID      *int64            `json:"actorId,omitempty"`
	ActorName    string            `json:"actorName,omitempty"`
	ActorMeta    map[string]any    `json:"actorMetadata"`
	Resource     json.RawMessage   `json:"resource"`
}

type AuditRecordsGet

type AuditRecordsGet interface {
	AuditRecordsGet(context.Context, AuditRecordsGetInput) (*AuditRecordsGetOutput, error)
}

type AuditRecordsGetInput

type AuditRecordsGetInput struct {
	ID int64
}

func (AuditRecordsGetInput) Validate

func (in AuditRecordsGetInput) Validate() v.Problems

type AuditRecordsGetOutput

type AuditRecordsGetOutput AuditRecord

type AuditRecordsList

type AuditRecordsList interface {
	AuditRecordsList(context.Context, AuditRecordsListInput) (AuditRecordsListOutput, error)
}

type AuditRecordsListInput

type AuditRecordsListInput struct {
	ActorID      *int64
	ActorName    string
	ResourceType AuditResourceType
	Action       AuditAction
	From         *time.Time
	To           *time.Time
	Page         uint
	PerPage      uint
}

type AuditRecordsListOutput

type AuditRecordsListOutput []AuditRecord

type AuditResourceType

type AuditResourceType string

ENUM(payload, user, dns_record, http_route)

const (
	// AuditResourceTypePayload is a AuditResourceType of type payload.
	AuditResourceTypePayload AuditResourceType = "payload"
	// AuditResourceTypeUser is a AuditResourceType of type user.
	AuditResourceTypeUser AuditResourceType = "user"
	// AuditResourceTypeDnsRecord is a AuditResourceType of type dns_record.
	AuditResourceTypeDnsRecord AuditResourceType = "dns_record"
	// AuditResourceTypeHttpRoute is a AuditResourceType of type http_route.
	AuditResourceTypeHttpRoute AuditResourceType = "http_route"
)

func AuditResourceTypeValues

func AuditResourceTypeValues() []AuditResourceType

AuditResourceTypeValues returns a list of the values for AuditResourceType

func ParseAuditResourceType

func ParseAuditResourceType(name string) (AuditResourceType, error)

ParseAuditResourceType attempts to convert a string to a AuditResourceType.

func (*AuditResourceType) Get

func (x *AuditResourceType) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (AuditResourceType) IsValid

func (x AuditResourceType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (AuditResourceType) Ptr

func (*AuditResourceType) Set

func (x *AuditResourceType) Set(val string) error

Set implements the Golang flag.Value interface func.

func (AuditResourceType) String

func (x AuditResourceType) String() string

String implements the Stringer interface.

func (*AuditResourceType) Type

func (x *AuditResourceType) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type AuditSource

type AuditSource string

ENUM(api, telegram, lark, slack)

const (
	// AuditSourceApi is a AuditSource of type api.
	AuditSourceApi AuditSource = "api"
	// AuditSourceTelegram is a AuditSource of type telegram.
	AuditSourceTelegram AuditSource = "telegram"
	// AuditSourceLark is a AuditSource of type lark.
	AuditSourceLark AuditSource = "lark"
	// AuditSourceSlack is a AuditSource of type slack.
	AuditSourceSlack AuditSource = "slack"
)

func AuditSourceValues

func AuditSourceValues() []AuditSource

AuditSourceValues returns a list of the values for AuditSource

func ParseAuditSource

func ParseAuditSource(name string) (AuditSource, error)

ParseAuditSource attempts to convert a string to a AuditSource.

func (*AuditSource) Get

func (x *AuditSource) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (AuditSource) IsValid

func (x AuditSource) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (AuditSource) Ptr

func (x AuditSource) Ptr() *AuditSource

func (*AuditSource) Set

func (x *AuditSource) Set(val string) error

Set implements the Golang flag.Value interface func.

func (AuditSource) String

func (x AuditSource) String() string

String implements the Stringer interface.

func (*AuditSource) Type

func (x *AuditSource) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type AuthContextByAPIToken

type AuthContextByAPIToken interface {
	AuthContextByAPIToken(context.Context, string) (context.Context, error)
}

type AuthContextByLarkID

type AuthContextByLarkID interface {
	AuthContextByLarkID(context.Context, string) (context.Context, error)
}

type AuthContextBySlackID

type AuthContextBySlackID interface {
	AuthContextBySlackID(context.Context, string) (context.Context, error)
}

type AuthContextByTelegramID

type AuthContextByTelegramID interface {
	AuthContextByTelegramID(context.Context, int64) (context.Context, error)
}

type Caller

type Caller struct {
	UserID   int64
	UserName string
	IsAdmin  bool
	Source   AuditSource

	TelegramID *int64
	LarkID     *string
	SlackID    *string
}

Caller is the authenticated identity behind a request. It is minted by the auth boundary (see dbsvc.AuthContextBy*) and carried through the request context. It holds everything downstream needs about the actor — including the name and social IDs — so consumers like auditsvc don't have to re-query the user from the database.

func CallerFrom

func CallerFrom(ctx context.Context) (Caller, bool)

CallerFrom returns the authenticated caller, if the context carries one.

type DNSRecord

type DNSRecord struct {
	Index            int64             `json:"index"`
	PayloadSubdomain string            `json:"payloadSubdomain"`
	Name             string            `json:"name"`
	Type             DNSRecordType     `json:"type"`
	TTL              int               `json:"ttl"`
	Values           []string          `json:"values"`
	Strategy         DNSRecordStrategy `json:"strategy"`
	CreatedAt        time.Time         `json:"createdAt"`
}

type DNSRecordStrategy

type DNSRecordStrategy string

ENUM(all, round-robin, rebind)

const (
	// DNSRecordStrategyAll is a DNSRecordStrategy of type all.
	DNSRecordStrategyAll DNSRecordStrategy = "all"
	// DNSRecordStrategyRoundRobin is a DNSRecordStrategy of type round-robin.
	DNSRecordStrategyRoundRobin DNSRecordStrategy = "round-robin"
	// DNSRecordStrategyRebind is a DNSRecordStrategy of type rebind.
	DNSRecordStrategyRebind DNSRecordStrategy = "rebind"
)

func DNSRecordStrategyValues

func DNSRecordStrategyValues() []DNSRecordStrategy

DNSRecordStrategyValues returns a list of the values for DNSRecordStrategy

func ParseDNSRecordStrategy

func ParseDNSRecordStrategy(name string) (DNSRecordStrategy, error)

ParseDNSRecordStrategy attempts to convert a string to a DNSRecordStrategy.

func (*DNSRecordStrategy) Get

func (x *DNSRecordStrategy) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (DNSRecordStrategy) IsValid

func (x DNSRecordStrategy) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (DNSRecordStrategy) Ptr

func (*DNSRecordStrategy) Set

func (x *DNSRecordStrategy) Set(val string) error

Set implements the Golang flag.Value interface func.

func (DNSRecordStrategy) String

func (x DNSRecordStrategy) String() string

String implements the Stringer interface.

func (*DNSRecordStrategy) Type

func (x *DNSRecordStrategy) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type DNSRecordType

type DNSRecordType string

ENUM(A, AAAA, MX, TXT, CNAME, NS, CAA)

const (
	// DNSRecordTypeA is a DNSRecordType of type A.
	DNSRecordTypeA DNSRecordType = "A"
	// DNSRecordTypeAAAA is a DNSRecordType of type AAAA.
	DNSRecordTypeAAAA DNSRecordType = "AAAA"
	// DNSRecordTypeMX is a DNSRecordType of type MX.
	DNSRecordTypeMX DNSRecordType = "MX"
	// DNSRecordTypeTXT is a DNSRecordType of type TXT.
	DNSRecordTypeTXT DNSRecordType = "TXT"
	// DNSRecordTypeCNAME is a DNSRecordType of type CNAME.
	DNSRecordTypeCNAME DNSRecordType = "CNAME"
	// DNSRecordTypeNS is a DNSRecordType of type NS.
	DNSRecordTypeNS DNSRecordType = "NS"
	// DNSRecordTypeCAA is a DNSRecordType of type CAA.
	DNSRecordTypeCAA DNSRecordType = "CAA"
)

func DNSRecordTypeValues

func DNSRecordTypeValues() []DNSRecordType

DNSRecordTypeValues returns a list of the values for DNSRecordType

func ParseDNSRecordType

func ParseDNSRecordType(name string) (DNSRecordType, error)

ParseDNSRecordType attempts to convert a string to a DNSRecordType.

func (*DNSRecordType) Get

func (x *DNSRecordType) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (DNSRecordType) IsValid

func (x DNSRecordType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (DNSRecordType) Ptr

func (x DNSRecordType) Ptr() *DNSRecordType

func (*DNSRecordType) Set

func (x *DNSRecordType) Set(val string) error

Set implements the Golang flag.Value interface func.

func (DNSRecordType) String

func (x DNSRecordType) String() string

String implements the Stringer interface.

func (*DNSRecordType) Type

func (x *DNSRecordType) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type DNSRecordsClear

type DNSRecordsClear interface {
	DNSRecordsClear(context.Context, DNSRecordsClearInput) (DNSRecordsClearOutput, error)
}

type DNSRecordsClearInput

type DNSRecordsClearInput struct {
	PayloadName string
	Name        string
}

func (DNSRecordsClearInput) Validate

func (in DNSRecordsClearInput) Validate() v.Problems

type DNSRecordsClearOutput

type DNSRecordsClearOutput []DNSRecord

type DNSRecordsCreate

type DNSRecordsCreate interface {
	DNSRecordsCreate(context.Context, DNSRecordsCreateInput) (*DNSRecordsCreateOutput, error)
}

type DNSRecordsCreateInput

type DNSRecordsCreateInput struct {
	PayloadName string
	Name        string
	TTL         int
	Type        DNSRecordType
	Values      []string
	Strategy    DNSRecordStrategy
}

func (DNSRecordsCreateInput) Validate

func (in DNSRecordsCreateInput) Validate() v.Problems

type DNSRecordsCreateOutput

type DNSRecordsCreateOutput DNSRecord

type DNSRecordsDelete

type DNSRecordsDelete interface {
	DNSRecordsDelete(context.Context, DNSRecordsDeleteInput) (*DNSRecordsDeleteOutput, error)
}

type DNSRecordsDeleteInput

type DNSRecordsDeleteInput struct {
	PayloadName string
	Index       int64
}

func (DNSRecordsDeleteInput) Validate

func (in DNSRecordsDeleteInput) Validate() v.Problems

type DNSRecordsDeleteOutput

type DNSRecordsDeleteOutput DNSRecord

type DNSRecordsList

type DNSRecordsList interface {
	DNSRecordsList(context.Context, DNSRecordsListInput) (DNSRecordsListOutput, error)
}

type DNSRecordsListInput

type DNSRecordsListInput struct {
	PayloadName string
}

func (DNSRecordsListInput) Validate

func (in DNSRecordsListInput) Validate() v.Problems

type DNSRecordsListOutput

type DNSRecordsListOutput []DNSRecord

type Error

type Error struct {
	Kind     ErrorKind
	Message  string
	Problems map[string]string // field -> problem; validation only
}

func BadRequestf

func BadRequestf(format string, a ...any) Error

func Conflictf

func Conflictf(format string, a ...any) Error

func Forbiddenf

func Forbiddenf(format string, a ...any) Error

func NotFoundf

func NotFoundf(format string, a ...any) Error

func Unauthorized

func Unauthorized() Error

func Validation

func Validation(problems map[string]string) Error

func (Error) Error

func (e Error) Error() string

type ErrorKind

type ErrorKind int
const (
	ErrorKindInternal ErrorKind = iota
	ErrorKindBadRequest
	ErrorKindUnauthorized
	ErrorKindForbidden
	ErrorKindConflict
	ErrorKindNotFound
	ErrorKindValidation
)

type Event

type Event struct {
	Index      int64         `json:"index"`
	UUID       string        `json:"uuid"`
	Protocol   EventProtocol `json:"protocol"`
	R          string        `json:"r,omitempty"`
	W          string        `json:"w,omitempty"`
	RW         string        `json:"rw,omitempty"`
	Meta       EventMeta     `json:"meta"`
	RemoteAddr string        `json:"remoteAddress"`
	ReceivedAt time.Time     `json:"receivedAt"`
}

type EventDNSAnswer

type EventDNSAnswer struct {
	Name string `json:"name"`
	Type string `json:"type"`
	TTL  uint32 `json:"ttl"`
}

type EventDNSMeta

type EventDNSMeta struct {
	Question EventDNSQuestion `json:"question"`
	Answer   []EventDNSAnswer `json:"answer"`
}

type EventDNSQuestion

type EventDNSQuestion struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type EventFTPData

type EventFTPData struct {
	User string `json:"user"`
	Pass string `json:"pass"`
	Type string `json:"type"`
	Pasv string `json:"pasv"`
	Epsv string `json:"epsv"`
	Port string `json:"port"`
	Eprt string `json:"eprt"`
	Retr string `json:"retr"`
}

type EventFTPMeta

type EventFTPMeta struct {
	Session EventFTPData `json:"session"`
}

type EventGeoIPASN

type EventGeoIPASN struct {
	Number uint   `json:"number"`
	Org    string `json:"org"`
}

type EventGeoIPCountry

type EventGeoIPCountry struct {
	Name    string `json:"name"`
	ISOCode string `json:"isoCode"`
}

type EventGeoIPMeta

type EventGeoIPMeta struct {
	City         string            `json:"city"`
	Country      EventGeoIPCountry `json:"country"`
	Subdivisions []string          `json:"subdivisions"`
	ASN          EventGeoIPASN     `json:"asn"`
}

type EventHTTPMeta

type EventHTTPMeta struct {
	Request  EventHTTPRequest  `json:"request"`
	Response EventHTTPResponse `json:"response"`
}

type EventHTTPRequest

type EventHTTPRequest struct {
	Method  string              `json:"method"`
	Proto   string              `json:"proto"`
	URL     string              `json:"url"`
	Host    string              `json:"host"`
	Headers map[string][]string `json:"headers"`
	Body    string              `json:"body"`
}

type EventHTTPResponse

type EventHTTPResponse struct {
	Status  int                 `json:"status"`
	Headers map[string][]string `json:"headers"`
	Body    string              `json:"body"`
}

type EventMeta

type EventMeta struct {
	DNS  *EventDNSMeta  `json:"dns,omitempty"`
	HTTP *EventHTTPMeta `json:"http,omitempty"`
	SMTP *EventSMTPMeta `json:"smtp,omitempty"`
	FTP  *EventFTPMeta  `json:"ftp,omitempty"`

	Secure bool `json:"secure"`

	GeoIP *EventGeoIPMeta `json:"geoip,omitempty"`
}

type EventProtocol

type EventProtocol string

ENUM(dns, http, https, smtp, ftp)

const (
	// EventProtocolDns is a EventProtocol of type dns.
	EventProtocolDns EventProtocol = "dns"
	// EventProtocolHttp is a EventProtocol of type http.
	EventProtocolHttp EventProtocol = "http"
	// EventProtocolHttps is a EventProtocol of type https.
	EventProtocolHttps EventProtocol = "https"
	// EventProtocolSmtp is a EventProtocol of type smtp.
	EventProtocolSmtp EventProtocol = "smtp"
	// EventProtocolFtp is a EventProtocol of type ftp.
	EventProtocolFtp EventProtocol = "ftp"
)

func EventProtocolValues

func EventProtocolValues() []EventProtocol

EventProtocolValues returns a list of the values for EventProtocol

func ParseEventProtocol

func ParseEventProtocol(name string) (EventProtocol, error)

ParseEventProtocol attempts to convert a string to a EventProtocol.

func (*EventProtocol) Get

func (x *EventProtocol) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (EventProtocol) IsValid

func (x EventProtocol) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (EventProtocol) Ptr

func (x EventProtocol) Ptr() *EventProtocol

func (*EventProtocol) Set

func (x *EventProtocol) Set(val string) error

Set implements the Golang flag.Value interface func.

func (EventProtocol) String

func (x EventProtocol) String() string

String implements the Stringer interface.

func (*EventProtocol) Type

func (x *EventProtocol) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type EventSMTPAddress

type EventSMTPAddress struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

type EventSMTPData

type EventSMTPData struct {
	Helo     string   `json:"helo"`
	Ehlo     string   `json:"ehlo"`
	MailFrom string   `json:"mailFrom"`
	RcptTo   []string `json:"rcptTo"`
	Data     string   `json:"data"`
}

type EventSMTPEmail

type EventSMTPEmail struct {
	Subject string             `json:"subject"`
	From    []EventSMTPAddress `json:"from"`
	To      []EventSMTPAddress `json:"to"`
	Cc      []EventSMTPAddress `json:"cc"`
	Bcc     []EventSMTPAddress `json:"bcc"`
	Date    *time.Time         `json:"date,omitempty"`
	Text    string             `json:"text"`
	HTML    string             `json:"html"`
}

type EventSMTPMeta

type EventSMTPMeta struct {
	Session EventSMTPData  `json:"session"`
	Email   EventSMTPEmail `json:"email"`
}

type EventsGet

type EventsGet interface {
	EventsGet(context.Context, EventsGetInput) (*EventsGetOutput, error)
}

type EventsGetInput

type EventsGetInput struct {
	PayloadName string
	Index       int64
}

func (EventsGetInput) Validate

func (in EventsGetInput) Validate() v.Problems

type EventsGetOutput

type EventsGetOutput Event

type EventsList

type EventsList interface {
	EventsList(context.Context, EventsListInput) (EventsListOutput, error)
}

type EventsListInput

type EventsListInput struct {
	PayloadName string
	Limit       uint
	Offset      uint
}

func (EventsListInput) Validate

func (in EventsListInput) Validate() v.Problems

type EventsListOutput

type EventsListOutput []Event

type HTTPMethod

type HTTPMethod string

ENUM(GET, HEAD, POST, PUT, PATCH, DELETE, CONNECT, OPTIONS, TRACE, ANY)

const (
	// HTTPMethodGET is a HTTPMethod of type GET.
	HTTPMethodGET HTTPMethod = "GET"
	// HTTPMethodHEAD is a HTTPMethod of type HEAD.
	HTTPMethodHEAD HTTPMethod = "HEAD"
	// HTTPMethodPOST is a HTTPMethod of type POST.
	HTTPMethodPOST HTTPMethod = "POST"
	// HTTPMethodPUT is a HTTPMethod of type PUT.
	HTTPMethodPUT HTTPMethod = "PUT"
	// HTTPMethodPATCH is a HTTPMethod of type PATCH.
	HTTPMethodPATCH HTTPMethod = "PATCH"
	// HTTPMethodDELETE is a HTTPMethod of type DELETE.
	HTTPMethodDELETE HTTPMethod = "DELETE"
	// HTTPMethodCONNECT is a HTTPMethod of type CONNECT.
	HTTPMethodCONNECT HTTPMethod = "CONNECT"
	// HTTPMethodOPTIONS is a HTTPMethod of type OPTIONS.
	HTTPMethodOPTIONS HTTPMethod = "OPTIONS"
	// HTTPMethodTRACE is a HTTPMethod of type TRACE.
	HTTPMethodTRACE HTTPMethod = "TRACE"
	// HTTPMethodANY is a HTTPMethod of type ANY.
	HTTPMethodANY HTTPMethod = "ANY"
)

func HTTPMethodValues

func HTTPMethodValues() []HTTPMethod

HTTPMethodValues returns a list of the values for HTTPMethod

func ParseHTTPMethod

func ParseHTTPMethod(name string) (HTTPMethod, error)

ParseHTTPMethod attempts to convert a string to a HTTPMethod.

func (*HTTPMethod) Get

func (x *HTTPMethod) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (HTTPMethod) IsValid

func (x HTTPMethod) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (HTTPMethod) Ptr

func (x HTTPMethod) Ptr() *HTTPMethod

func (*HTTPMethod) Set

func (x *HTTPMethod) Set(val string) error

Set implements the Golang flag.Value interface func.

func (HTTPMethod) String

func (x HTTPMethod) String() string

String implements the Stringer interface.

func (*HTTPMethod) Type

func (x *HTTPMethod) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type HTTPRoute

type HTTPRoute struct {
	Index            int64               `json:"index"`
	PayloadSubdomain string              `json:"payloadSubdomain"`
	Method           HTTPMethod          `json:"method"`
	Path             string              `json:"path"`
	Code             int                 `json:"code"`
	Headers          map[string][]string `json:"headers"`
	Body             string              `json:"body"`
	IsDynamic        bool                `json:"isDynamic"`
	CreatedAt        time.Time           `json:"createdAt"`
}

type HTTPRoutesClear

type HTTPRoutesClear interface {
	HTTPRoutesClear(context.Context, HTTPRoutesClearInput) (HTTPRoutesClearOutput, error)
}

type HTTPRoutesClearInput

type HTTPRoutesClearInput struct {
	PayloadName string
	Path        string
}

func (HTTPRoutesClearInput) Validate

func (in HTTPRoutesClearInput) Validate() v.Problems

type HTTPRoutesClearOutput

type HTTPRoutesClearOutput []HTTPRoute

type HTTPRoutesCreate

type HTTPRoutesCreate interface {
	HTTPRoutesCreate(context.Context, HTTPRoutesCreateInput) (*HTTPRoutesCreateOutput, error)
}

type HTTPRoutesCreateInput

type HTTPRoutesCreateInput struct {
	PayloadName string
	Method      HTTPMethod
	Path        string
	Code        int
	Headers     map[string][]string
	Body        string
	IsDynamic   bool
}

func (HTTPRoutesCreateInput) Validate

func (in HTTPRoutesCreateInput) Validate() v.Problems

type HTTPRoutesCreateOutput

type HTTPRoutesCreateOutput HTTPRoute

type HTTPRoutesDelete

type HTTPRoutesDelete interface {
	HTTPRoutesDelete(context.Context, HTTPRoutesDeleteInput) (*HTTPRoutesDeleteOutput, error)
}

type HTTPRoutesDeleteInput

type HTTPRoutesDeleteInput struct {
	PayloadName string
	Index       int64
}

func (HTTPRoutesDeleteInput) Validate

func (in HTTPRoutesDeleteInput) Validate() v.Problems

type HTTPRoutesDeleteOutput

type HTTPRoutesDeleteOutput HTTPRoute

type HTTPRoutesList

type HTTPRoutesList interface {
	HTTPRoutesList(context.Context, HTTPRoutesListInput) (HTTPRoutesListOutput, error)
}

type HTTPRoutesListInput

type HTTPRoutesListInput struct {
	PayloadName string
}

func (HTTPRoutesListInput) Validate

func (in HTTPRoutesListInput) Validate() v.Problems

type HTTPRoutesListOutput

type HTTPRoutesListOutput []HTTPRoute

type HTTPRoutesUpdate

type HTTPRoutesUpdate interface {
	HTTPRoutesUpdate(context.Context, HTTPRoutesUpdateInput) (*HTTPRoutesUpdateOutput, error)
}

type HTTPRoutesUpdateInput

type HTTPRoutesUpdateInput struct {
	Payload   string
	Index     int64
	Method    *HTTPMethod
	Path      *string
	Code      *int
	Headers   map[string][]string
	Body      *string
	IsDynamic *bool
}

func (HTTPRoutesUpdateInput) Validate

func (in HTTPRoutesUpdateInput) Validate() v.Problems

type HTTPRoutesUpdateOutput

type HTTPRoutesUpdateOutput HTTPRoute

type LarkProvisionUser

type LarkProvisionUser interface {
	LarkProvisionUser(context.Context, string) error
}

LarkProvisionUser ensures a user exists for the given Lark ID, creating one on first contact. Lark is self-service: unlike the other messengers, a previously unknown Lark user is provisioned rather than rejected. Callers run it before AuthContextByLarkID, which stays lookup-only.

type Payload

type Payload struct {
	Name            string          `json:"name"`
	Subdomain       string          `json:"subdomain"`
	NotifyProtocols []ProtoCategory `json:"notifyProtocols"`
	StoreEvents     bool            `json:"storeEvents"`
	CreatedAt       time.Time       `json:"createdAt"`
}

type PayloadsClear

type PayloadsClear interface {
	PayloadsClear(context.Context, PayloadsClearInput) (PayloadsClearOutput, error)
}

type PayloadsClearInput

type PayloadsClearInput struct {
	Name string
}

type PayloadsClearOutput

type PayloadsClearOutput []Payload

type PayloadsCreate

type PayloadsCreate interface {
	PayloadsCreate(context.Context, PayloadsCreateInput) (*PayloadsCreateOutput, error)
}

type PayloadsCreateInput

type PayloadsCreateInput struct {
	Name            string
	NotifyProtocols []ProtoCategory
	StoreEvents     bool
}

func (PayloadsCreateInput) Validate

func (in PayloadsCreateInput) Validate() v.Problems

type PayloadsCreateOutput

type PayloadsCreateOutput Payload

type PayloadsDelete

type PayloadsDelete interface {
	PayloadsDelete(context.Context, PayloadsDeleteInput) (*PayloadsDeleteOutput, error)
}

type PayloadsDeleteInput

type PayloadsDeleteInput struct {
	Name string
}

func (PayloadsDeleteInput) Validate

func (in PayloadsDeleteInput) Validate() v.Problems

type PayloadsDeleteOutput

type PayloadsDeleteOutput Payload

type PayloadsList

type PayloadsList interface {
	PayloadsList(context.Context, PayloadsListInput) (PayloadsListOutput, error)
}

type PayloadsListInput

type PayloadsListInput struct {
	Name    string
	Page    uint
	PerPage uint
}

type PayloadsListOutput

type PayloadsListOutput []Payload

type PayloadsUpdate

type PayloadsUpdate interface {
	PayloadsUpdate(context.Context, PayloadsUpdateInput) (*PayloadsUpdateOutput, error)
}

type PayloadsUpdateInput

type PayloadsUpdateInput struct {
	Name    string
	NewName string
	// Partial update: a nil NotifyProtocols (slice) or StoreEvents (bool needs a
	// pointer since false is meaningful) leaves the existing setting unchanged.
	NotifyProtocols []ProtoCategory
	StoreEvents     *bool
}

func (PayloadsUpdateInput) Validate

func (in PayloadsUpdateInput) Validate() v.Problems

type PayloadsUpdateOutput

type PayloadsUpdateOutput Payload

type ProfileGet

type ProfileGet interface {
	ProfileGet(context.Context) (*ProfileGetOutput, error)
}

type ProfileGetOutput

type ProfileGetOutput User

type ProtoCategory

type ProtoCategory string

ENUM(dns, http, smtp, ftp)

const (
	// ProtoCategoryDns is a ProtoCategory of type dns.
	ProtoCategoryDns ProtoCategory = "dns"
	// ProtoCategoryHttp is a ProtoCategory of type http.
	ProtoCategoryHttp ProtoCategory = "http"
	// ProtoCategorySmtp is a ProtoCategory of type smtp.
	ProtoCategorySmtp ProtoCategory = "smtp"
	// ProtoCategoryFtp is a ProtoCategory of type ftp.
	ProtoCategoryFtp ProtoCategory = "ftp"
)

func ParseProtoCategory

func ParseProtoCategory(name string) (ProtoCategory, error)

ParseProtoCategory attempts to convert a string to a ProtoCategory.

func ProtoCategoryValues

func ProtoCategoryValues() []ProtoCategory

ProtoCategoryValues returns a list of the values for ProtoCategory

func (*ProtoCategory) Get

func (x *ProtoCategory) Get() interface{}

Get implements the Golang flag.Getter interface func.

func (ProtoCategory) IsValid

func (x ProtoCategory) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ProtoCategory) Ptr

func (x ProtoCategory) Ptr() *ProtoCategory

func (*ProtoCategory) Set

func (x *ProtoCategory) Set(val string) error

Set implements the Golang flag.Value interface func.

func (ProtoCategory) String

func (x ProtoCategory) String() string

String implements the Stringer interface.

func (*ProtoCategory) Type

func (x *ProtoCategory) Type() string

Type implements the github.com/spf13/pFlag Value interface.

type ServerService

ServerService is the full server-side service: the business operations of Service plus the ability to resolve a caller's identity into an authenticated context. It is implemented by DB-backed services (dbsvc and its decorators); the api-backed client (remotesvc) implements only Service, since identity resolution happens on the server.

type User

type User struct {
	Name      string    `json:"name"`
	IsAdmin   bool      `json:"isAdmin"`
	CreatedAt time.Time `json:"createdAt"`

	APIToken   *string `json:"apiToken,omitempty"`
	TelegramID *int64  `json:"telegramId,omitempty"`
	LarkID     *string `json:"larkId,omitempty"`
	SlackID    *string `json:"slackId,omitempty"`
}

type UsersCreate

type UsersCreate interface {
	UsersCreate(context.Context, UsersCreateInput) (*UsersCreateOutput, error)
}

type UsersCreateInput

type UsersCreateInput struct {
	Name       string
	APIToken   *string
	TelegramID *int64
	LarkID     *string
	SlackID    *string
	IsAdmin    bool
}

func (UsersCreateInput) Validate

func (in UsersCreateInput) Validate() v.Problems

type UsersCreateOutput

type UsersCreateOutput User

type UsersDelete

type UsersDelete interface {
	UsersDelete(context.Context, UsersDeleteInput) (*UsersDeleteOutput, error)
}

type UsersDeleteInput

type UsersDeleteInput struct {
	Name string
}

func (UsersDeleteInput) Validate

func (in UsersDeleteInput) Validate() v.Problems

type UsersDeleteOutput

type UsersDeleteOutput User

Directories

Path Synopsis
Package remotesvc implements service.Service by talking to an api server over HTTP.
Package remotesvc implements service.Service by talking to an api server over HTTP.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL