Documentation
¶
Index ¶
- Constants
- type APIError
- type Client
- func (c *Client) CreateWebhook(req CreateWebhookRequest) (*LDWebhook, error)
- func (c *Client) DeleteFeatureFlag(projectKey, flagKey string) error
- func (c *Client) DeleteWebhook(id string) error
- func (c *Client) GetFeatureFlag(projectKey, flagKey string) (map[string]any, error)
- func (c *Client) ListEnvironments(projectKey string) ([]Environment, error)
- func (c *Client) ListFeatureFlags(projectKey string) ([]FeatureFlag, error)
- func (c *Client) ListProjects() ([]Project, error)
- type Configuration
- type CreateWebhookRequest
- type DeleteFeatureFlag
- func (c *DeleteFeatureFlag) Actions() []core.Action
- func (c *DeleteFeatureFlag) Cancel(ctx core.ExecutionContext) error
- func (c *DeleteFeatureFlag) Cleanup(ctx core.SetupContext) error
- func (c *DeleteFeatureFlag) Color() string
- func (c *DeleteFeatureFlag) Configuration() []configuration.Field
- func (c *DeleteFeatureFlag) Description() string
- func (c *DeleteFeatureFlag) Documentation() string
- func (c *DeleteFeatureFlag) ExampleOutput() map[string]any
- func (c *DeleteFeatureFlag) Execute(ctx core.ExecutionContext) error
- func (c *DeleteFeatureFlag) HandleAction(ctx core.ActionContext) error
- func (c *DeleteFeatureFlag) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
- func (c *DeleteFeatureFlag) Icon() string
- func (c *DeleteFeatureFlag) Label() string
- func (c *DeleteFeatureFlag) Name() string
- func (c *DeleteFeatureFlag) OutputChannels(configuration any) []core.OutputChannel
- func (c *DeleteFeatureFlag) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
- func (c *DeleteFeatureFlag) Setup(ctx core.SetupContext) error
- type DeleteFeatureFlagSpec
- type Environment
- type EnvironmentListResponse
- type FeatureFlag
- type FeatureFlagListResponse
- type GetFeatureFlag
- func (c *GetFeatureFlag) Actions() []core.Action
- func (c *GetFeatureFlag) Cancel(ctx core.ExecutionContext) error
- func (c *GetFeatureFlag) Cleanup(ctx core.SetupContext) error
- func (c *GetFeatureFlag) Color() string
- func (c *GetFeatureFlag) Configuration() []configuration.Field
- func (c *GetFeatureFlag) Description() string
- func (c *GetFeatureFlag) Documentation() string
- func (c *GetFeatureFlag) ExampleOutput() map[string]any
- func (c *GetFeatureFlag) Execute(ctx core.ExecutionContext) error
- func (c *GetFeatureFlag) HandleAction(ctx core.ActionContext) error
- func (c *GetFeatureFlag) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
- func (c *GetFeatureFlag) Icon() string
- func (c *GetFeatureFlag) Label() string
- func (c *GetFeatureFlag) Name() string
- func (c *GetFeatureFlag) OutputChannels(configuration any) []core.OutputChannel
- func (c *GetFeatureFlag) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
- func (c *GetFeatureFlag) Setup(ctx core.SetupContext) error
- type GetFeatureFlagSpec
- type LDWebhook
- type LaunchDarkly
- func (l *LaunchDarkly) Actions() []core.Action
- func (l *LaunchDarkly) Cleanup(ctx core.IntegrationCleanupContext) error
- func (l *LaunchDarkly) Components() []core.Component
- func (l *LaunchDarkly) Configuration() []configuration.Field
- func (l *LaunchDarkly) Description() string
- func (l *LaunchDarkly) HandleAction(ctx core.IntegrationActionContext) error
- func (l *LaunchDarkly) HandleRequest(ctx core.HTTPRequestContext)
- func (l *LaunchDarkly) Icon() string
- func (l *LaunchDarkly) Instructions() string
- func (l *LaunchDarkly) Label() string
- func (l *LaunchDarkly) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)
- func (l *LaunchDarkly) Name() string
- func (l *LaunchDarkly) Sync(ctx core.SyncContext) error
- func (l *LaunchDarkly) Triggers() []core.Trigger
- type LaunchDarklyWebhookHandler
- func (h *LaunchDarklyWebhookHandler) Cleanup(ctx core.WebhookHandlerContext) error
- func (h *LaunchDarklyWebhookHandler) CompareConfig(a, b any) (bool, error)
- func (h *LaunchDarklyWebhookHandler) Merge(current, requested any) (any, bool, error)
- func (h *LaunchDarklyWebhookHandler) Setup(ctx core.WebhookHandlerContext) (any, error)
- type OnFeatureFlagChange
- func (t *OnFeatureFlagChange) Actions() []core.Action
- func (t *OnFeatureFlagChange) Cleanup(ctx core.TriggerContext) error
- func (t *OnFeatureFlagChange) Color() string
- func (t *OnFeatureFlagChange) Configuration() []configuration.Field
- func (t *OnFeatureFlagChange) Description() string
- func (t *OnFeatureFlagChange) Documentation() string
- func (t *OnFeatureFlagChange) ExampleData() map[string]any
- func (t *OnFeatureFlagChange) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)
- func (t *OnFeatureFlagChange) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
- func (t *OnFeatureFlagChange) Icon() string
- func (t *OnFeatureFlagChange) Label() string
- func (t *OnFeatureFlagChange) Name() string
- func (t *OnFeatureFlagChange) Setup(ctx core.TriggerContext) error
- type OnFeatureFlagChangeConfiguration
- type Project
- type ProjectListResponse
- type WebhookConfiguration
- type WebhookMetadata
- type WebhookStatement
Constants ¶
const ( ActionCreateFlag = "createFlag" ActionUpdateOn = "updateOn" ActionUpdateOffVariation = "updateOffVariation" ActionUpdateFallthrough = "updateFallthrough" ActionUpdateRules = "updateRules" ActionUpdateTargets = "updateTargets" ActionDeleteFlag = "deleteFlag" )
LaunchDarkly webhook actions found in the accesses array.
const BaseURL = "https://app.launchdarkly.com"
const KindFlag = "flag"
LaunchDarkly webhook "kind" value for feature flag events.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(http core.HTTPContext, ctx core.IntegrationContext) (*Client, error)
func (*Client) CreateWebhook ¶
func (c *Client) CreateWebhook(req CreateWebhookRequest) (*LDWebhook, error)
CreateWebhook creates a new signed webhook in LaunchDarkly. LaunchDarkly auto-generates the signing secret if one is not provided in the request.
func (*Client) DeleteFeatureFlag ¶
DeleteFeatureFlag deletes a feature flag by project key and flag key.
func (*Client) DeleteWebhook ¶
DeleteWebhook deletes a webhook from LaunchDarkly by its ID.
func (*Client) GetFeatureFlag ¶
GetFeatureFlag returns a feature flag by project key and flag key.
func (*Client) ListEnvironments ¶
func (c *Client) ListEnvironments(projectKey string) ([]Environment, error)
ListEnvironments returns all environments in a LaunchDarkly project.
func (*Client) ListFeatureFlags ¶
func (c *Client) ListFeatureFlags(projectKey string) ([]FeatureFlag, error)
ListFeatureFlags returns all feature flags in a LaunchDarkly project.
func (*Client) ListProjects ¶
ListProjects returns all projects in the LaunchDarkly account.
type Configuration ¶
type Configuration struct {
APIKey string `json:"apiKey"`
}
type CreateWebhookRequest ¶
type CreateWebhookRequest struct {
URL string `json:"url"`
Sign bool `json:"sign"`
On bool `json:"on"`
Name string `json:"name,omitempty"`
Statements []WebhookStatement `json:"statements,omitempty"`
}
CreateWebhookRequest is the request body for creating a LaunchDarkly webhook.
type DeleteFeatureFlag ¶
type DeleteFeatureFlag struct{}
func (*DeleteFeatureFlag) Actions ¶
func (c *DeleteFeatureFlag) Actions() []core.Action
func (*DeleteFeatureFlag) Cancel ¶
func (c *DeleteFeatureFlag) Cancel(ctx core.ExecutionContext) error
func (*DeleteFeatureFlag) Cleanup ¶
func (c *DeleteFeatureFlag) Cleanup(ctx core.SetupContext) error
func (*DeleteFeatureFlag) Color ¶
func (c *DeleteFeatureFlag) Color() string
func (*DeleteFeatureFlag) Configuration ¶
func (c *DeleteFeatureFlag) Configuration() []configuration.Field
func (*DeleteFeatureFlag) Description ¶
func (c *DeleteFeatureFlag) Description() string
func (*DeleteFeatureFlag) Documentation ¶
func (c *DeleteFeatureFlag) Documentation() string
func (*DeleteFeatureFlag) ExampleOutput ¶
func (c *DeleteFeatureFlag) ExampleOutput() map[string]any
func (*DeleteFeatureFlag) Execute ¶
func (c *DeleteFeatureFlag) Execute(ctx core.ExecutionContext) error
func (*DeleteFeatureFlag) HandleAction ¶
func (c *DeleteFeatureFlag) HandleAction(ctx core.ActionContext) error
func (*DeleteFeatureFlag) HandleWebhook ¶
func (c *DeleteFeatureFlag) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
func (*DeleteFeatureFlag) Icon ¶
func (c *DeleteFeatureFlag) Icon() string
func (*DeleteFeatureFlag) Label ¶
func (c *DeleteFeatureFlag) Label() string
func (*DeleteFeatureFlag) Name ¶
func (c *DeleteFeatureFlag) Name() string
func (*DeleteFeatureFlag) OutputChannels ¶
func (c *DeleteFeatureFlag) OutputChannels(configuration any) []core.OutputChannel
func (*DeleteFeatureFlag) ProcessQueueItem ¶
func (c *DeleteFeatureFlag) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
func (*DeleteFeatureFlag) Setup ¶
func (c *DeleteFeatureFlag) Setup(ctx core.SetupContext) error
type DeleteFeatureFlagSpec ¶
type Environment ¶
Environment represents a LaunchDarkly environment within a project.
type EnvironmentListResponse ¶
type EnvironmentListResponse struct {
Items []Environment `json:"items"`
TotalCount int `json:"totalCount"`
}
EnvironmentListResponse is the API response for listing environments.
type FeatureFlag ¶
type FeatureFlag struct {
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description"`
Kind string `json:"kind"`
CreationDate int64 `json:"creationDate"`
Archived bool `json:"archived"`
Temporary bool `json:"temporary"`
}
FeatureFlag represents a LaunchDarkly feature flag.
type FeatureFlagListResponse ¶
type FeatureFlagListResponse struct {
Items []FeatureFlag `json:"items"`
TotalCount int `json:"totalCount"`
}
FeatureFlagListResponse is the API response for listing feature flags.
type GetFeatureFlag ¶
type GetFeatureFlag struct{}
func (*GetFeatureFlag) Actions ¶
func (c *GetFeatureFlag) Actions() []core.Action
func (*GetFeatureFlag) Cancel ¶
func (c *GetFeatureFlag) Cancel(ctx core.ExecutionContext) error
func (*GetFeatureFlag) Cleanup ¶
func (c *GetFeatureFlag) Cleanup(ctx core.SetupContext) error
func (*GetFeatureFlag) Color ¶
func (c *GetFeatureFlag) Color() string
func (*GetFeatureFlag) Configuration ¶
func (c *GetFeatureFlag) Configuration() []configuration.Field
func (*GetFeatureFlag) Description ¶
func (c *GetFeatureFlag) Description() string
func (*GetFeatureFlag) Documentation ¶
func (c *GetFeatureFlag) Documentation() string
func (*GetFeatureFlag) ExampleOutput ¶
func (c *GetFeatureFlag) ExampleOutput() map[string]any
func (*GetFeatureFlag) Execute ¶
func (c *GetFeatureFlag) Execute(ctx core.ExecutionContext) error
func (*GetFeatureFlag) HandleAction ¶
func (c *GetFeatureFlag) HandleAction(ctx core.ActionContext) error
func (*GetFeatureFlag) HandleWebhook ¶
func (c *GetFeatureFlag) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
func (*GetFeatureFlag) Icon ¶
func (c *GetFeatureFlag) Icon() string
func (*GetFeatureFlag) Label ¶
func (c *GetFeatureFlag) Label() string
func (*GetFeatureFlag) Name ¶
func (c *GetFeatureFlag) Name() string
func (*GetFeatureFlag) OutputChannels ¶
func (c *GetFeatureFlag) OutputChannels(configuration any) []core.OutputChannel
func (*GetFeatureFlag) ProcessQueueItem ¶
func (c *GetFeatureFlag) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
func (*GetFeatureFlag) Setup ¶
func (c *GetFeatureFlag) Setup(ctx core.SetupContext) error
type GetFeatureFlagSpec ¶
type LDWebhook ¶
LDWebhook is the response from creating a webhook. The _id field is the webhook ID needed later for deletion.
type LaunchDarkly ¶
type LaunchDarkly struct{}
func (*LaunchDarkly) Actions ¶
func (l *LaunchDarkly) Actions() []core.Action
func (*LaunchDarkly) Cleanup ¶
func (l *LaunchDarkly) Cleanup(ctx core.IntegrationCleanupContext) error
func (*LaunchDarkly) Components ¶
func (l *LaunchDarkly) Components() []core.Component
func (*LaunchDarkly) Configuration ¶
func (l *LaunchDarkly) Configuration() []configuration.Field
func (*LaunchDarkly) Description ¶
func (l *LaunchDarkly) Description() string
func (*LaunchDarkly) HandleAction ¶
func (l *LaunchDarkly) HandleAction(ctx core.IntegrationActionContext) error
func (*LaunchDarkly) HandleRequest ¶
func (l *LaunchDarkly) HandleRequest(ctx core.HTTPRequestContext)
func (*LaunchDarkly) Icon ¶
func (l *LaunchDarkly) Icon() string
func (*LaunchDarkly) Instructions ¶
func (l *LaunchDarkly) Instructions() string
func (*LaunchDarkly) Label ¶
func (l *LaunchDarkly) Label() string
func (*LaunchDarkly) ListResources ¶
func (l *LaunchDarkly) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)
func (*LaunchDarkly) Name ¶
func (l *LaunchDarkly) Name() string
func (*LaunchDarkly) Sync ¶
func (l *LaunchDarkly) Sync(ctx core.SyncContext) error
func (*LaunchDarkly) Triggers ¶
func (l *LaunchDarkly) Triggers() []core.Trigger
type LaunchDarklyWebhookHandler ¶
type LaunchDarklyWebhookHandler struct{}
func (*LaunchDarklyWebhookHandler) Cleanup ¶
func (h *LaunchDarklyWebhookHandler) Cleanup(ctx core.WebhookHandlerContext) error
Cleanup deletes the webhook from LaunchDarkly when the trigger is removed.
func (*LaunchDarklyWebhookHandler) CompareConfig ¶
func (h *LaunchDarklyWebhookHandler) CompareConfig(a, b any) (bool, error)
func (*LaunchDarklyWebhookHandler) Merge ¶
func (h *LaunchDarklyWebhookHandler) Merge(current, requested any) (any, bool, error)
func (*LaunchDarklyWebhookHandler) Setup ¶
func (h *LaunchDarklyWebhookHandler) Setup(ctx core.WebhookHandlerContext) (any, error)
Setup creates a signed webhook in LaunchDarkly via the API using the integration's API key. LaunchDarkly auto-generates the signing secret, which we store encrypted for later verification.
type OnFeatureFlagChange ¶
type OnFeatureFlagChange struct{}
func (*OnFeatureFlagChange) Actions ¶
func (t *OnFeatureFlagChange) Actions() []core.Action
func (*OnFeatureFlagChange) Cleanup ¶
func (t *OnFeatureFlagChange) Cleanup(ctx core.TriggerContext) error
func (*OnFeatureFlagChange) Color ¶
func (t *OnFeatureFlagChange) Color() string
func (*OnFeatureFlagChange) Configuration ¶
func (t *OnFeatureFlagChange) Configuration() []configuration.Field
func (*OnFeatureFlagChange) Description ¶
func (t *OnFeatureFlagChange) Description() string
func (*OnFeatureFlagChange) Documentation ¶
func (t *OnFeatureFlagChange) Documentation() string
func (*OnFeatureFlagChange) ExampleData ¶
func (t *OnFeatureFlagChange) ExampleData() map[string]any
func (*OnFeatureFlagChange) HandleAction ¶
func (t *OnFeatureFlagChange) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)
func (*OnFeatureFlagChange) HandleWebhook ¶
func (t *OnFeatureFlagChange) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
func (*OnFeatureFlagChange) Icon ¶
func (t *OnFeatureFlagChange) Icon() string
func (*OnFeatureFlagChange) Label ¶
func (t *OnFeatureFlagChange) Label() string
func (*OnFeatureFlagChange) Name ¶
func (t *OnFeatureFlagChange) Name() string
func (*OnFeatureFlagChange) Setup ¶
func (t *OnFeatureFlagChange) Setup(ctx core.TriggerContext) error
type OnFeatureFlagChangeConfiguration ¶
type OnFeatureFlagChangeConfiguration struct {
ProjectKey string `json:"projectKey" mapstructure:"projectKey"`
Environments []string `json:"environments" mapstructure:"environments"`
Flags []configuration.Predicate `json:"flags" mapstructure:"flags"`
Actions []string `json:"actions" mapstructure:"actions"`
}
type ProjectListResponse ¶
type ProjectListResponse struct {
Items []Project `json:"items"`
TotalCount int `json:"totalCount"`
}
ProjectListResponse is the API response for listing projects.
type WebhookConfiguration ¶
type WebhookConfiguration struct {
ProjectKey string `json:"projectKey" mapstructure:"projectKey"`
}
WebhookConfiguration is the config stored with the webhook.
type WebhookMetadata ¶
type WebhookMetadata struct {
LDWebhookID string `json:"ldWebhookId"`
}
WebhookMetadata is stored after Setup. It holds the LaunchDarkly webhook ID so we can delete it when the trigger is removed.
type WebhookStatement ¶
type WebhookStatement struct {
Effect string `json:"effect"`
Resources []string `json:"resources,omitempty"`
Actions []string `json:"actions,omitempty"`
}
WebhookStatement is a policy statement that filters which resource/action combinations the webhook responds to.