cweventdetails

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 3 Imported by: 0

README

CI PkgGoDev

go-aws-cloudwatch-event-details

go-aws-cloudwatch-event-details provides more detail field types of CloudWatch Events.

Usage

import (
  "context"

  "github.com/aereal/go-aws-cloudwatch-event-details"
  "github.com/aws/aws-lambda-go/events"
)

func handler(ctx context.Context, event events.CloudWatchEvent) error {
  detail, err := cweventdetails.ParseEventDetail(event)
  if err != nil{
    return err
  }
  println(detail.(*cweventdetails.ECSTaskStateChangeEvent).StoppedReason)
  return nil
}

Install

go get github.com/aereal/go-aws-cloudwatch-event-details

License

See LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DetailTypeECSTaskStateChange              = "ECS Task State Change"
	DetailTypeECSContainerInstanceStateChange = "ECS Container Instance State Change"
	DetailTypeECSServiceDeploymentStateChange = "ECS Deployment State Change"
)

Functions

func ParseEventDetail

func ParseEventDetail(ev events.CloudWatchEvent) (interface{}, error)

Types

type Container

type Container struct {
	ContainerArn      string             `json:"containerArn"`
	LastStatus        string             `json:"lastStatus"`
	Name              string             `json:"name"`
	Image             string             `json:"image"`
	ImageDigest       string             `json:"imageDigest"`
	RuntimeID         string             `json:"runtimeId"`
	TaskArn           string             `json:"taskArn"`
	NetworkInterfaces []NetworkInterface `json:"networkInterfaces"`
	CPU               string             `json:"cpu"`
	ExitCode          int                `json:"exitCode"`
	Reason            string             `json:"reason"`
}

Container is a container in the task.

type ECSContainerAgentInfo

type ECSContainerAgentInfo struct {
	AgentHash     string `json:"agentHash"`
	AgentVersion  string `json:"agentVersion"`
	DockerVersion string `json:"dockerVersion"`
}

type ECSContainerInstanceAttribute

type ECSContainerInstanceAttribute struct {
	Name string `json:"name"`
}

type ECSContainerInstanceStateChangeEvent

type ECSContainerInstanceStateChangeEvent struct {
	AgentConnected       bool                            `json:"agentConnected"`
	Attributes           []ECSContainerInstanceAttribute `json:"attributes"`
	ClusterArn           string                          `json:"clusterArn"`
	ContainerInstanceArn string                          `json:"containerInstanceArn"`
	EC2InstanceID        string                          `json:"ec2InstanceId"`
	Status               string                          `json:"status"`
	RegisteredResources  []ECSResource                   `json:"registeredResources"`
	RemainingResources   []ECSResource                   `json:"remainingResources"`
	Version              int                             `json:"version"`
	VersionInfo          ECSContainerAgentInfo           `json:"versionInfo"`
	UpdatedAt            time.Time                       `json:"updatedAt"`
}

type ECSDeploymentStateChangeEvent

type ECSDeploymentStateChangeEvent struct {
	EventType    string    `json:"eventType"`
	EventName    string    `json:"eventName"`
	DeploymentID string    `json:"deploymentId"`
	Reason       string    `json:"reason"`
	UpdatedAt    time.Time `json:"updatedAt"`
}

type ECSResource

type ECSResource struct {
	Name            string   `json:"name"`
	Type            string   `json:"type"`
	IntegerValue    int      `json:"integerValue"`
	IntegerSetValue []int    `json:"integerSetValue"`
	StringSetValue  []string `json:"stringSetValue"`
}

type ECSTaskStateChangeEvent

type ECSTaskStateChangeEvent struct {
	Attachments       []TaskAttachment `json:"attachments"`
	AvailabilityZone  string           `json:"availabilityZone"`
	ClusterArn        string           `json:"clusterArn"`
	Containers        []Container      `json:"containers"`
	CreatedAt         time.Time        `json:"createdAt"`
	LaunchType        string           `json:"launchType"`
	CPU               string           `json:"cpu"`
	Memory            string           `json:"memory"`
	DesiredStatus     string           `json:"desiredStatus"`
	Group             string           `json:"group"`
	LastStatus        string           `json:"lastStatus"`
	Connectivity      string           `json:"connectivity"`
	ConnectivityAt    time.Time        `json:"connectivityAt"`
	PullStartedAt     time.Time        `json:"pullStartedAt"`
	StartedAt         time.Time        `json:"startedAt"`
	PullStoppedAt     time.Time        `json:"pullStoppedAt"`
	UpdatedAt         time.Time        `json:"updatedAt"`
	TaskArn           string           `json:"taskArn"`
	TaskDefinitionArn string           `json:"taskDefinitionArn"`
	Version           int              `json:"version"`
	PlatformVersion   string           `json:"platformVersion"`
	StoppedReason     string           `json:"stoppedReason"`
	StopCode          string           `json:"stopCode"`
	StoppingAt        time.Time        `json:"stoppingAt"`
	StoppedAt         time.Time        `json:"stoppedAt"`
}

ECSTaskStateChangeEvent is the event indicates ECS task state is changed.

type NetworkInterface

type NetworkInterface struct {
	AttachmentID       string `json:"attachmentId"`
	PrivateIpv4Address string `json:"privateIpv4Address"`
}

type TaskAttachment

type TaskAttachment struct {
	ID      string                 `json:"id"`
	Type    string                 `json:"type"`
	Status  string                 `json:"status"`
	Details []TaskAttachmentDetail `json:"details"`
}

type TaskAttachmentDetail

type TaskAttachmentDetail struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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