v1

package
v0.15.18 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package v1 is a container for endpoints that are used to power the v1 of the service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	// PublicIPAddresses show changed public IP addresses
	PublicIPAddresses []string `json:"publicIpAddresses,omitempty"`

	// PrivateIPAddresses show changed private IP addresses
	PrivateIPAddresses []string `json:"privateIpAddresses,omitempty"`

	// CIDRBlock shows a changed CIDR block
	CIDRBlock string `json:"cidrBlock"`

	// Hostnames show changed public DNS names
	Hostnames []string `json:"hostnames,omitempty"`

	// RelatedResources show a related arn_id. ex: an ELB the ENI is attached to
	RelatedResources []string `json:"relatedResources,omitempty"`

	// TagChanges changed keys/values per tag
	TagChanges []TagChange `json:"tagChanges,omitempty"`

	// ChangeType indicates the type of change which occurred. Allowed values are "ADDED" or "DELETED"
	ChangeType string `json:"changeType"`
}

Change details network related changes for a resource

type ErrMissingValue

type ErrMissingValue struct {
	Field string
}

ErrMissingValue is returned when a configuration item is missing a required field

func (ErrMissingValue) Error

func (e ErrMissingValue) Error() string

type Input

type Input struct {
	// Message is the stringified AWS config change notification as documented here:
	// https://docs.aws.amazon.com/config/latest/developerguide/example-sns-notification.html
	Message string `json:"Message"`

	// Timestamp is the time at which the notification was published to the SNS topic
	Timestamp string `json:"Timestamp"`

	// ProcessedTimestamp is an optional field. It is the time at which a previous service emitted this event.
	ProcessedTimestamp string `json:"ProcessedTimestamp"`
}

Input is the event we will receive as input to our lambda handler

type Output

type Output struct {
	// ChangeTime is the time at which the asset change occurred, date-time format (required)
	ChangeTime string `json:"changeTime"`

	// ResourceType is the AWS resource type (required)
	ResourceType string `json:"resourceType"`

	// AccountID is the 12-digit ID of the AWS account (required)
	AccountID string `json:"accountId"`

	// Region is the AWS region (required)
	Region string `json:"region"`

	// ARN is the Amazon Resource Name (required)
	ARN string `json:"arn"`

	// Tags are key/value pairs set on the AWS resource (required)
	Tags map[string]string `json:"tags"`

	// Changes are a list of network related changes which occurred on the resource (required)
	Changes []Change `json:"changes"`
}

Output is the result of the transformation

type ResourceTransformer

type ResourceTransformer interface {
	Create(event awsConfigEvent) (Output, bool, error)
	Update(event awsConfigEvent) (Output, bool, error)
	Delete(event awsConfigEvent) (Output, bool, error)
}

ResourceTransformer takes AWS Config Events, and returns transformed output.

type Tag added in v0.5.0

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

Tag represents a single AWS resource tag (key:value pair)

type TagChange added in v0.5.0

type TagChange struct {
	UpdatedValue  *Tag `json:"updatedValue"` // pointer type as either of the values can be nil
	PreviousValue *Tag `json:"previousValue"`
}

TagChange represents a modification, addition or deletion of a resource tag key or value

type Transformer

type Transformer struct {
	LogFn  domain.LogFn
	StatFn domain.StatFn
}

Transformer is a lambda handler which transforms incoming AWS Config change events

func (*Transformer) Handle

func (t *Transformer) Handle(ctx context.Context, input Input) (Output, error)

Handle is an AWS Lambda handler which takes, as input, an SNS configuration change event notification. The input is transformed into a JSON structure which highlights changes in the network details for this resource. The output is the transformed JSON.

Jump to

Keyboard shortcuts

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