common

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WebhookTypeSNS = "sns"
)

Variables

View Source
var AllRegions = []configuration.FieldOption{
	{
		Label: "us-east-1",
		Value: "us-east-1",
	},
	{
		Label: "us-east-2",
		Value: "us-east-2",
	},
	{
		Label: "us-west-1",
		Value: "us-west-1",
	},
	{
		Label: "us-west-2",
		Value: "us-west-2",
	},
	{
		Label: "eu-west-1",
		Value: "eu-west-1",
	},
	{
		Label: "eu-central-1",
		Value: "eu-central-1",
	},
	{
		Label: "ap-northeast-1",
		Value: "ap-northeast-1",
	},
	{
		Label: "ap-northeast-2",
		Value: "ap-northeast-2",
	},
	{
		Label: "ap-southeast-1",
		Value: "ap-southeast-1",
	},
	{
		Label: "ap-southeast-2",
		Value: "ap-southeast-2",
	},
	{
		Label: "ap-south-1",
		Value: "ap-south-1",
	},
	{
		Label: "ca-central-1",
		Value: "ca-central-1",
	},
	{
		Label: "cn-north-1",
		Value: "cn-north-1",
	},
	{
		Label: "cn-northwest-1",
		Value: "cn-northwest-1",
	},
	{
		Label: "eu-north-1",
		Value: "eu-north-1",
	},
	{
		Label: "eu-south-1",
		Value: "eu-south-1",
	},
	{
		Label: "eu-west-2",
		Value: "eu-west-2",
	},
	{
		Label: "eu-west-3",
		Value: "eu-west-3",
	},
	{
		Label: "sa-east-1",
		Value: "sa-east-1",
	},
}

Functions

func AccountIDFromRoleArn added in v0.7.0

func AccountIDFromRoleArn(roleArn string) (string, error)

* Extract the account ID from an IAM role ARN. * * Expected format: arn:aws:iam::<account-id>:role/<role-name>

func CredentialsFromInstallation

func CredentialsFromInstallation(ctx core.IntegrationContext) (*aws.Credentials, error)

func EventBridgeRuleKey added in v0.9.0

func EventBridgeRuleKey(source string, region string) string

* This is the key used to store the rule in the metadata. * The key here is the source and region, e.g., "aws.ec2:us-east-1". * This ensures that we have a rule per {source, region} combination.

func HasEventBridgeRule added in v0.9.0

func HasEventBridgeRule(logger *logrus.Entry, integration core.IntegrationContext, source, region, detailType string) (bool, error)

func IsAlreadyExistsErr added in v0.7.0

func IsAlreadyExistsErr(err error) bool

func IsNotFoundErr added in v0.7.0

func IsNotFoundErr(err error) bool

func RegionFromInstallation

func RegionFromInstallation(ctx core.IntegrationContext) string

func TagsForAPI added in v0.7.0

func TagsForAPI(tags []Tag) []any

Types

type APIDestinationMetadata added in v0.7.0

type APIDestinationMetadata struct {
	Name              string `json:"name" mapstructure:"name"`
	Region            string `json:"region" mapstructure:"region"`
	ConnectionArn     string `json:"connectionArn" mapstructure:"connectionArn"`
	APIDestinationArn string `json:"apiDestinationArn" mapstructure:"apiDestinationArn"`
}

type Error added in v0.7.0

type Error struct {
	Code    string
	Message string
}

func ParseError added in v0.7.0

func ParseError(body []byte) *Error

func (*Error) Error added in v0.7.0

func (e *Error) Error() string

type EventBridgeEvent added in v0.7.0

type EventBridgeEvent struct {
	Region     string         `json:"region" mapstructure:"region"`
	DetailType string         `json:"detail-type" mapstructure:"detail-type"`
	Source     string         `json:"source" mapstructure:"source"`
	Detail     map[string]any `json:"detail" mapstructure:"detail"`
}

type EventBridgeMetadata added in v0.7.0

type EventBridgeMetadata struct {

	/*
	 * Since we need to support multiple regions,
	 * the integration needs to maintain one connection/destination per region.
	 */
	APIDestinations map[string]APIDestinationMetadata `json:"apiDestinations" mapstructure:"apiDestinations"`

	/*
	 * List of EventBridge rules created by the integration.
	 * This ensures that we reuse the same rule for the same source, e.g., aws.codeartifact, aws.ecr, etc.
	 *
	 * The key here is the source and region, e.g., "aws.ec2:us-east-1".
	 */
	Rules map[string]EventBridgeRuleMetadata `json:"rules" mapstructure:"rules"`
}

* EventBridge metadata for the integration.

type EventBridgeRuleMetadata added in v0.7.0

type EventBridgeRuleMetadata struct {
	Source      string   `json:"source" mapstructure:"source"`
	Region      string   `json:"region" mapstructure:"region"`
	Name        string   `json:"name" mapstructure:"name"`
	RuleArn     string   `json:"ruleArn" mapstructure:"ruleArn"`
	DetailTypes []string `json:"detailTypes" mapstructure:"detailTypes"`
}

type FloatTime added in v0.7.0

type FloatTime struct {
	time.Time
}

FloatTime decodes AWS timestamps that are represented as float64 seconds since epoch. It marshals to RFC3339 strings for consistency across outputs.

func (FloatTime) IsZero added in v0.7.0

func (t FloatTime) IsZero() bool

func (FloatTime) MarshalJSON added in v0.7.0

func (t FloatTime) MarshalJSON() ([]byte, error)

func (*FloatTime) UnmarshalJSON added in v0.7.0

func (t *FloatTime) UnmarshalJSON(data []byte) error

type IAMMetadata added in v0.7.0

type IAMMetadata struct {

	/*
	 * The role ARN of the role that will be used to invoke the EventBridge API destinations.
	 */
	TargetDestinationRole *IAMRoleMetadata `json:"targetDestinationRole" mapstructure:"targetDestinationRole"`
}

* IAM metadata for the integration.

type IAMRoleMetadata added in v0.7.0

type IAMRoleMetadata struct {
	RoleArn  string `json:"roleArn" mapstructure:"roleArn"`
	RoleName string `json:"roleName" mapstructure:"roleName"`
}

type IntegrationMetadata added in v0.7.0

type IntegrationMetadata struct {
	Session     *SessionMetadata     `json:"session" mapstructure:"session"`
	IAM         *IAMMetadata         `json:"iam" mapstructure:"iam"`
	EventBridge *EventBridgeMetadata `json:"eventBridge" mapstructure:"eventBridge"`
	Tags        []Tag                `json:"tags" mapstructure:"tags"`
}

type ProvisionRuleParameters added in v0.7.0

type ProvisionRuleParameters struct {
	Region     string `json:"region"`
	Source     string `json:"source"`
	DetailType string `json:"detailType"`
}

type SNSWebhookConfiguration added in v0.8.0

type SNSWebhookConfiguration struct {
	TopicArn string `json:"topicArn"`
}

type SNSWebhookMetadata added in v0.8.0

type SNSWebhookMetadata struct {
	SubscriptionArn string `json:"subscriptionArn"`
}

type SessionMetadata added in v0.7.0

type SessionMetadata struct {
	RoleArn   string `json:"roleArn"`
	AccountID string `json:"accountId"`
	Region    string `json:"region"`
	ExpiresAt string `json:"expiresAt"`
}

type Tag added in v0.7.0

type Tag struct {
	Key   string `json:"key" mapstructure:"key"`
	Value string `json:"value" mapstructure:"value"`
}

func NormalizeTags added in v0.7.0

func NormalizeTags(tags []Tag) []Tag

type WebhookConfiguration added in v0.8.0

type WebhookConfiguration struct {
	Region string                   `json:"region"`
	Type   string                   `json:"type"`
	SNS    *SNSWebhookConfiguration `json:"sns"`
}

Jump to

Keyboard shortcuts

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