Documentation
¶
Index ¶
- Variables
- func AssertChangesConstraints(obj Changes) error
- func AssertChangesRequired(obj Changes) error
- func AssertEndpointConstraints(obj Endpoint) error
- func AssertEndpointRequired(obj Endpoint) error
- func AssertFiltersConstraints(obj Filters) error
- func AssertFiltersRequired(obj Filters) error
- func AssertProviderSpecificPropertyConstraints(obj ProviderSpecificProperty) error
- func AssertProviderSpecificPropertyRequired(obj ProviderSpecificProperty) error
- func AssertRecurseInterfaceRequired[T any](obj interface{}, callback func(T) error) error
- func AssertRecurseValueRequired[T any](value reflect.Value, callback func(T) error) error
- func DefaultErrorHandler(w http.ResponseWriter, _ *http.Request, err error, result *ImplResponse)
- func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
- func IsZeroValue(val interface{}) bool
- func Logger(inner http.Handler, name string) http.Handler
- func NewRouter(routers ...Router) *mux.Router
- func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)
- func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error)
- type Changes
- type Constraint
- type Endpoint
- type ErrorHandler
- type Filters
- type ImplResponse
- type InitializationAPIController
- type InitializationAPIOption
- type InitializationAPIRouter
- type InitializationAPIService
- type InitializationAPIServicer
- type ListingAPIController
- type ListingAPIOption
- type ListingAPIRouter
- type ListingAPIService
- type ListingAPIServicer
- type Number
- type Operation
- type ParseString
- type ParsingError
- type ProviderSpecificProperty
- type RequiredError
- type Route
- type Router
- type Routes
- type UpdateAPIController
- type UpdateAPIOption
- type UpdateAPIRouter
- type UpdateAPIService
- type UpdateAPIServicer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTypeAssertionError is thrown when type an interface does not match the asserted type ErrTypeAssertionError = errors.New("unable to assert type") )
Functions ¶
func AssertChangesConstraints ¶
AssertChangesConstraints checks if the values respects the defined constraints
func AssertChangesRequired ¶
AssertChangesRequired checks if the required fields are not zero-ed
func AssertEndpointConstraints ¶
AssertEndpointConstraints checks if the values respects the defined constraints
func AssertEndpointRequired ¶
AssertEndpointRequired checks if the required fields are not zero-ed
func AssertFiltersConstraints ¶
AssertFiltersConstraints checks if the values respects the defined constraints
func AssertFiltersRequired ¶
AssertFiltersRequired checks if the required fields are not zero-ed
func AssertProviderSpecificPropertyConstraints ¶
func AssertProviderSpecificPropertyConstraints(obj ProviderSpecificProperty) error
AssertProviderSpecificPropertyConstraints checks if the values respects the defined constraints
func AssertProviderSpecificPropertyRequired ¶
func AssertProviderSpecificPropertyRequired(obj ProviderSpecificProperty) error
AssertProviderSpecificPropertyRequired checks if the required fields are not zero-ed
func AssertRecurseInterfaceRequired ¶
AssertRecurseInterfaceRequired recursively checks each struct in a slice against the callback. This method traverse nested slices in a preorder fashion.
func AssertRecurseValueRequired ¶
AssertRecurseValueRequired checks each struct in the nested slice against the callback. This method traverse nested slices in a preorder fashion. ErrTypeAssertionError is thrown if the underlying struct does not match type T.
func DefaultErrorHandler ¶
func DefaultErrorHandler(w http.ResponseWriter, _ *http.Request, err error, result *ImplResponse)
DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used.
func EncodeJSONResponse ¶
func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
func IsZeroValue ¶
func IsZeroValue(val interface{}) bool
IsZeroValue checks if the val is the zero-ed value.
func ReadFormFileToTempFile ¶
ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
Types ¶
type Changes ¶
type Changes struct {
// This is a list of DNS records.
Create []Endpoint `json:"create,omitempty"`
// This is a list of DNS records.
UpdateOld []Endpoint `json:"updateOld,omitempty"`
// This is a list of DNS records.
UpdateNew []Endpoint `json:"updateNew,omitempty"`
// This is a list of DNS records.
Delete []Endpoint `json:"delete,omitempty"`
}
Changes - This is the list of changes send by `external-dns` that need to be applied. There are four lists of endpoints. The `create` and `delete` lists are lists of records to create and delete respectively. The `updateOld` and `updateNew` lists are paired. For each entry there's the old version of the record and a new version of the record.
type Constraint ¶
func WithMaximum ¶
func WithMaximum[T Number](expected T) Constraint[T]
func WithMinimum ¶
func WithMinimum[T Number](expected T) Constraint[T]
type Endpoint ¶
type Endpoint struct {
DnsName string `json:"dnsName,omitempty"`
// This is the list of targets that this DNS record points to. So for an A record it will be a list of IP addresses.
Targets []string `json:"targets,omitempty"`
RecordType string `json:"recordType,omitempty"`
SetIdentifier string `json:"setIdentifier,omitempty"`
RecordTTL int64 `json:"recordTTL,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
ProviderSpecific []ProviderSpecificProperty `json:"providerSpecific,omitempty"`
}
Endpoint - This is a DNS record.
type ErrorHandler ¶
type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)
ErrorHandler defines the required method for handling error. You may implement it and inject this into a controller if you would like errors to be handled differently from the DefaultErrorHandler
type Filters ¶
type Filters struct {
Filters []string `json:"filters,omitempty"`
}
Filters - external-dns will only create DNS records for host names (specified in ingress objects and services with the external-dns annotation) related to zones that match filters. They can set in external-dns deployment manifest.
type ImplResponse ¶
type ImplResponse struct {
Code int
Body interface{}
}
ImplResponse defines an implementation response with error code and the associated body
func Response ¶
func Response(code int, body interface{}) ImplResponse
Response return a ImplResponse struct filled
type InitializationAPIController ¶
type InitializationAPIController struct {
// contains filtered or unexported fields
}
InitializationAPIController binds http requests to an api service and writes the service results to the http response
func NewInitializationAPIController ¶
func NewInitializationAPIController(s InitializationAPIServicer, opts ...InitializationAPIOption) *InitializationAPIController
NewInitializationAPIController creates a default api controller
func (*InitializationAPIController) Negotiate ¶
func (c *InitializationAPIController) Negotiate(w http.ResponseWriter, r *http.Request)
Negotiate - Initialisation and negotiates headers and returns domain filter.
func (*InitializationAPIController) OrderedRoutes ¶ added in v0.28.0
func (c *InitializationAPIController) OrderedRoutes() []Route
OrderedRoutes returns all the api routes in a deterministic order for the InitializationAPIController
func (*InitializationAPIController) Routes ¶
func (c *InitializationAPIController) Routes() Routes
Routes returns all the api routes for the InitializationAPIController
type InitializationAPIOption ¶
type InitializationAPIOption func(*InitializationAPIController)
InitializationAPIOption for how the controller is set up.
func WithInitializationAPIErrorHandler ¶
func WithInitializationAPIErrorHandler(h ErrorHandler) InitializationAPIOption
WithInitializationAPIErrorHandler inject ErrorHandler into controller
type InitializationAPIRouter ¶
type InitializationAPIRouter interface {
Negotiate(http.ResponseWriter, *http.Request)
}
InitializationAPIRouter defines the required methods for binding the api requests to a responses for the InitializationAPI The InitializationAPIRouter implementation should parse necessary information from the http request, pass the data to a InitializationAPIServicer to perform the required actions, then write the service results to the http response.
type InitializationAPIService ¶
type InitializationAPIService struct {
}
InitializationAPIService is a service that implements the logic for the InitializationAPIServicer This service should implement the business logic for every endpoint for the InitializationAPI API. Include any external packages or services that will be required by this service.
func NewInitializationAPIService ¶
func NewInitializationAPIService() *InitializationAPIService
NewInitializationAPIService creates a default api service
func (*InitializationAPIService) Negotiate ¶
func (s *InitializationAPIService) Negotiate(ctx context.Context) (ImplResponse, error)
Negotiate - Initialisation and negotiates headers and returns domain filter.
type InitializationAPIServicer ¶
type InitializationAPIServicer interface {
Negotiate(context.Context) (ImplResponse, error)
}
InitializationAPIServicer defines the api actions for the InitializationAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
type ListingAPIController ¶
type ListingAPIController struct {
// contains filtered or unexported fields
}
ListingAPIController binds http requests to an api service and writes the service results to the http response
func NewListingAPIController ¶
func NewListingAPIController(s ListingAPIServicer, opts ...ListingAPIOption) *ListingAPIController
NewListingAPIController creates a default api controller
func (*ListingAPIController) GetRecords ¶
func (c *ListingAPIController) GetRecords(w http.ResponseWriter, r *http.Request)
GetRecords - Returns the current records.
func (*ListingAPIController) OrderedRoutes ¶ added in v0.28.0
func (c *ListingAPIController) OrderedRoutes() []Route
OrderedRoutes returns all the api routes in a deterministic order for the ListingAPIController
func (*ListingAPIController) Routes ¶
func (c *ListingAPIController) Routes() Routes
Routes returns all the api routes for the ListingAPIController
type ListingAPIOption ¶
type ListingAPIOption func(*ListingAPIController)
ListingAPIOption for how the controller is set up.
func WithListingAPIErrorHandler ¶
func WithListingAPIErrorHandler(h ErrorHandler) ListingAPIOption
WithListingAPIErrorHandler inject ErrorHandler into controller
type ListingAPIRouter ¶
type ListingAPIRouter interface {
GetRecords(http.ResponseWriter, *http.Request)
}
ListingAPIRouter defines the required methods for binding the api requests to a responses for the ListingAPI The ListingAPIRouter implementation should parse necessary information from the http request, pass the data to a ListingAPIServicer to perform the required actions, then write the service results to the http response.
type ListingAPIService ¶
type ListingAPIService struct {
}
ListingAPIService is a service that implements the logic for the ListingAPIServicer This service should implement the business logic for every endpoint for the ListingAPI API. Include any external packages or services that will be required by this service.
func NewListingAPIService ¶
func NewListingAPIService() *ListingAPIService
NewListingAPIService creates a default api service
func (*ListingAPIService) GetRecords ¶
func (s *ListingAPIService) GetRecords(ctx context.Context) (ImplResponse, error)
GetRecords - Returns the current records.
type ListingAPIServicer ¶
type ListingAPIServicer interface {
GetRecords(context.Context) (ImplResponse, error)
}
ListingAPIServicer defines the api actions for the ListingAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
type Operation ¶
func WithDefaultOrParse ¶
func WithDefaultOrParse[T Number | string | bool](def T, parse ParseString[T]) Operation[T]
func WithRequire ¶
func WithRequire[T Number | string | bool](parse ParseString[T]) Operation[T]
type ParsingError ¶
ParsingError indicates that an error has occurred when parsing request parameters
func (*ParsingError) Error ¶
func (e *ParsingError) Error() string
func (*ParsingError) Unwrap ¶
func (e *ParsingError) Unwrap() error
type ProviderSpecificProperty ¶
type ProviderSpecificProperty struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
}
ProviderSpecificProperty - Allows provider to pass property specific to their implementation.
type RequiredError ¶
type RequiredError struct {
Field string
}
RequiredError indicates that an error has occurred when parsing request parameters
func (*RequiredError) Error ¶
func (e *RequiredError) Error() string
type Route ¶
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
A Route defines the parameters for an api endpoint
type UpdateAPIController ¶
type UpdateAPIController struct {
// contains filtered or unexported fields
}
UpdateAPIController binds http requests to an api service and writes the service results to the http response
func NewUpdateAPIController ¶
func NewUpdateAPIController(s UpdateAPIServicer, opts ...UpdateAPIOption) *UpdateAPIController
NewUpdateAPIController creates a default api controller
func (*UpdateAPIController) AdjustRecords ¶
func (c *UpdateAPIController) AdjustRecords(w http.ResponseWriter, r *http.Request)
AdjustRecords - Executes the AdjustEndpoints method.
func (*UpdateAPIController) OrderedRoutes ¶ added in v0.28.0
func (c *UpdateAPIController) OrderedRoutes() []Route
OrderedRoutes returns all the api routes in a deterministic order for the UpdateAPIController
func (*UpdateAPIController) Routes ¶
func (c *UpdateAPIController) Routes() Routes
Routes returns all the api routes for the UpdateAPIController
func (*UpdateAPIController) SetRecords ¶
func (c *UpdateAPIController) SetRecords(w http.ResponseWriter, r *http.Request)
SetRecords - Applies the changes.
type UpdateAPIOption ¶
type UpdateAPIOption func(*UpdateAPIController)
UpdateAPIOption for how the controller is set up.
func WithUpdateAPIErrorHandler ¶
func WithUpdateAPIErrorHandler(h ErrorHandler) UpdateAPIOption
WithUpdateAPIErrorHandler inject ErrorHandler into controller
type UpdateAPIRouter ¶
type UpdateAPIRouter interface {
SetRecords(http.ResponseWriter, *http.Request)
AdjustRecords(http.ResponseWriter, *http.Request)
}
UpdateAPIRouter defines the required methods for binding the api requests to a responses for the UpdateAPI The UpdateAPIRouter implementation should parse necessary information from the http request, pass the data to a UpdateAPIServicer to perform the required actions, then write the service results to the http response.
type UpdateAPIService ¶
type UpdateAPIService struct {
}
UpdateAPIService is a service that implements the logic for the UpdateAPIServicer This service should implement the business logic for every endpoint for the UpdateAPI API. Include any external packages or services that will be required by this service.
func NewUpdateAPIService ¶
func NewUpdateAPIService() *UpdateAPIService
NewUpdateAPIService creates a default api service
func (*UpdateAPIService) AdjustRecords ¶
func (s *UpdateAPIService) AdjustRecords(ctx context.Context, endpoint []Endpoint) (ImplResponse, error)
AdjustRecords - Executes the AdjustEndpoints method.
func (*UpdateAPIService) SetRecords ¶
func (s *UpdateAPIService) SetRecords(ctx context.Context, changes Changes) (ImplResponse, error)
SetRecords - Applies the changes.
type UpdateAPIServicer ¶
type UpdateAPIServicer interface {
SetRecords(context.Context, Changes) (ImplResponse, error)
AdjustRecords(context.Context, []Endpoint) (ImplResponse, error)
}
UpdateAPIServicer defines the api actions for the UpdateAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.