Documentation
¶
Overview ¶
Package hookdeck provides an HTTP client adapter that satisfies the deploy.Client interface for the Hookdeck REST API.
Index ¶
- type Client
- func (c *Client) FindConnectionByFullName(ctx context.Context, fullName string) (*ResourceInfo, error)
- func (c *Client) FindDestinationByName(ctx context.Context, name string) (*ResourceInfo, error)
- func (c *Client) FindSourceByName(ctx context.Context, name string) (*ResourceInfo, error)
- func (c *Client) FindTransformationByName(ctx context.Context, name string) (*ResourceInfo, error)
- func (c *Client) GetConnectionByFullName(ctx context.Context, fullName string) (*ConnectionDetail, error)
- func (c *Client) GetDestinationByName(ctx context.Context, name string) (*DestinationDetail, error)
- func (c *Client) GetSourceByName(ctx context.Context, name string) (*SourceDetail, error)
- func (c *Client) GetTransformationByName(ctx context.Context, name string) (*TransformationDetail, error)
- func (c *Client) UpsertConnection(ctx context.Context, req *deploy.UpsertConnectionRequest) (*deploy.UpsertConnectionResult, error)
- func (c *Client) UpsertDestination(ctx context.Context, req *deploy.UpsertDestinationRequest) (*deploy.UpsertDestinationResult, error)
- func (c *Client) UpsertSource(ctx context.Context, req *deploy.UpsertSourceRequest) (*deploy.UpsertSourceResult, error)
- func (c *Client) UpsertTransformation(ctx context.Context, req *deploy.UpsertTransformationRequest) (*deploy.UpsertTransformationResult, error)
- type ClientOption
- type ConnectionDetail
- type DestinationConfigDetail
- type DestinationDetail
- type ResourceInfo
- type SourceDetail
- type TransformationDetail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a concrete HTTP client for the Hookdeck API.
func NewClient ¶
func NewClient(apiKey, projectID string, opts ...ClientOption) *Client
NewClient creates a Hookdeck API client. The apiKey is required. The projectID is optional (omit if the API key is scoped to one project).
func (*Client) FindConnectionByFullName ¶
func (c *Client) FindConnectionByFullName(ctx context.Context, fullName string) (*ResourceInfo, error)
FindConnectionByFullName queries GET /connections?full_name=<name> and returns the first match.
func (*Client) FindDestinationByName ¶
FindDestinationByName queries GET /destinations?name=<name> and returns the first match.
func (*Client) FindSourceByName ¶
FindSourceByName queries GET /sources?name=<name> and returns the first match.
func (*Client) FindTransformationByName ¶
FindTransformationByName queries GET /transformations?name=<name> and returns the first match.
func (*Client) GetConnectionByFullName ¶
func (c *Client) GetConnectionByFullName(ctx context.Context, fullName string) (*ConnectionDetail, error)
GetConnectionByFullName queries GET /connections?full_name=<name> and returns full connection details.
func (*Client) GetDestinationByName ¶
GetDestinationByName queries GET /destinations?name=<name> and returns full destination details.
func (*Client) GetSourceByName ¶
GetSourceByName queries GET /sources?name=<name> and returns full source details.
func (*Client) GetTransformationByName ¶
func (c *Client) GetTransformationByName(ctx context.Context, name string) (*TransformationDetail, error)
GetTransformationByName queries GET /transformations?name=<name> and returns full transformation details.
func (*Client) UpsertConnection ¶
func (c *Client) UpsertConnection(ctx context.Context, req *deploy.UpsertConnectionRequest) (*deploy.UpsertConnectionResult, error)
UpsertConnection creates or updates a connection (PUT /connections).
func (*Client) UpsertDestination ¶
func (c *Client) UpsertDestination(ctx context.Context, req *deploy.UpsertDestinationRequest) (*deploy.UpsertDestinationResult, error)
UpsertDestination creates or updates a destination by name (PUT /destinations).
func (*Client) UpsertSource ¶
func (c *Client) UpsertSource(ctx context.Context, req *deploy.UpsertSourceRequest) (*deploy.UpsertSourceResult, error)
UpsertSource creates or updates a source by name (PUT /sources).
func (*Client) UpsertTransformation ¶
func (c *Client) UpsertTransformation(ctx context.Context, req *deploy.UpsertTransformationRequest) (*deploy.UpsertTransformationResult, error)
UpsertTransformation creates or updates a transformation by name (PUT /transformations).
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures the Client.
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL overrides the default API base URL.
func WithHTTPClient ¶
func WithHTTPClient(hc *http.Client) ClientOption
WithHTTPClient overrides the default http.Client.
type ConnectionDetail ¶
type ConnectionDetail struct {
ID string `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Source *SourceDetail `json:"source"`
Destination *DestinationDetail `json:"destination"`
Rules []map[string]interface{} `json:"rules"`
}
ConnectionDetail is the full representation of a Hookdeck connection.
type DestinationConfigDetail ¶
type DestinationConfigDetail struct {
URL string `json:"url"`
AuthType string `json:"auth_type"`
Auth map[string]interface{} `json:"auth"`
RateLimit int `json:"rate_limit"`
RateLimitPeriod string `json:"rate_limit_period"`
}
DestinationConfigDetail is the config sub-object of a Hookdeck destination.
type DestinationDetail ¶
type DestinationDetail struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
Config DestinationConfigDetail `json:"config"`
}
DestinationDetail is the full representation of a Hookdeck destination. The API returns url, auth_type, auth, rate_limit, rate_limit_period inside a config object.
type ResourceInfo ¶
type ResourceInfo struct {
ID string `json:"id"`
Name string `json:"name"`
URL string `json:"url,omitempty"`
}
ResourceInfo is a lightweight representation of a Hookdeck resource returned by list endpoints.