Documentation
¶
Index ¶
- Constants
- func DoWithFallbackForTest(client *http.Client, req *http.Request, apiIp string) (*http.Response, error)
- func ParseRawUID(rawUID string) (string, string)
- func SendLogs(ctx context.Context, lr *LogsRequest, cdDev bool) error
- type ErrorResponse
- type LogsRequest
- type ResolverConfig
- func FetchResolverConfig(ctx context.Context, req *ResolverConfigRequest, cdDev bool) (*ResolverConfig, error)
- func FetchResolverUID(ctx context.Context, req *UtilityOrgRequest, version string, cdDev bool) (*ResolverConfig, error)
- func UpdateCustomLastFailed(ctx context.Context, rawUID, version string, cdDev, lastUpdatedFailed bool) (*ResolverConfig, error)
- type ResolverConfigRequest
- type UtilityOrgRequest
Constants ¶
const (
InvalidConfigCode = 40402
)
Variables ¶
This section is empty.
Functions ¶
func DoWithFallbackForTest ¶ added in v1.5.6
func DoWithFallbackForTest(client *http.Client, req *http.Request, apiIp string) (*http.Response, error)
DoWithFallbackForTest exposes doWithFallback so tests outside this package can drive the real two-attempt composition through the real retry predicate, rather than asserting a copy of this error shape against another copy of it.
func ParseRawUID ¶ added in v1.3.0
ParseRawUID parse the input raw UID, returning real UID and ClientID. The raw UID can have 2 forms:
- <uid> - <uid>/<client_id>
Types ¶
type ErrorResponse ¶ added in v1.4.0
type ErrorResponse struct {
ErrorField struct {
Message string `json:"message"`
Code int `json:"code"`
} `json:"error"`
// StatusCode is the HTTP status the API answered with. It is not part of the JSON
// body: this type is built for *any* non-200 whose body decodes, so the body alone
// cannot tell a permanent rejection of the request from a transient server-side
// failure, and callers that act differently on the two need the status to tell them
// apart. Zero means the status was not recorded.
StatusCode int `json:"-"`
}
func (ErrorResponse) Error ¶ added in v1.4.0
func (u ErrorResponse) Error() string
type LogsRequest ¶ added in v1.4.0
type LogsRequest struct {
UID string `json:"uid"`
Data io.ReadCloser `json:"-"`
}
LogsRequest contains request data for sending runtime logs to API.
type ResolverConfig ¶
type ResolverConfig struct {
DOH string `json:"doh"`
Ctrld struct {
CustomConfig string `json:"custom_config"`
CustomLastUpdate int64 `json:"custom_last_update"`
VersionTarget string `json:"version_target"`
} `json:"ctrld"`
Exclude []string `json:"exclude"`
UID string `json:"uid"`
DeactivationPin *int64 `json:"deactivation_pin,omitempty"`
}
ResolverConfig represents Control D resolver data.
func FetchResolverConfig ¶
func FetchResolverConfig(ctx context.Context, req *ResolverConfigRequest, cdDev bool) (*ResolverConfig, error)
FetchResolverConfig fetch Control D config for given uid.
func FetchResolverUID ¶ added in v1.3.0
func FetchResolverUID(ctx context.Context, req *UtilityOrgRequest, version string, cdDev bool) (*ResolverConfig, error)
FetchResolverUID fetch resolver uid from a given request.
func UpdateCustomLastFailed ¶ added in v1.3.8
func UpdateCustomLastFailed(ctx context.Context, rawUID, version string, cdDev, lastUpdatedFailed bool) (*ResolverConfig, error)
UpdateCustomLastFailed calls API to mark custom config is bad.
type ResolverConfigRequest ¶ added in v1.4.9
ResolverConfigRequest contains request data for fetching resolver config.