aws

package
v0.0.0-...-f7ce621 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const S3_BUCKET_VAR_NAME = "S3_DEPLOYMENT_BUCKET_NAME"

Variables

This section is empty.

Functions

func DeployLambdaFunction

func DeployLambdaFunction(functionName, zipfile string, arch lambdatypes.Architecture) (*string, error)

DeployLambdaFunction lets you update the function code for a specified lambda function by setting the code to execute point to a zip file in a lambda bucket. Arch must match the architecture the code is compiled for

func DescribeClusterServices

func DescribeClusterServices(clusterName string) ([]types.Service, error)

DescribeClusterServices return a slice of the service descriptions found in the given ECS cluster

func DescribeClusterTasks

func DescribeClusterTasks(clusterName, serviceName *string) ([]types.Task, error)

DescribeClusterTasks lists all tasks in a cluster or service (if serivceName != nil) and returns a slice of the tasks found

func ExecuteCommand

func ExecuteCommand(taskArn, containerName, clusterArn string) (*ecs.ExecuteCommandOutput, error)

ExecuteCommand executes /bin/sh command in an ECS container and returns the output

func FetchCloudwatchLogs

func FetchCloudwatchLogs(logGroupName, logStreamName string, nextForwardToken *string, interval time.Duration) (outputList [][]awscloudwatchlogstypes.OutputLogEvent, nextToken *string, err error)

FetchCloudwatchLogs fetches log records from cloudwatch. If a nextForwardToken is provided, it will be used to in the query to cloudwatch, if not, it starts from scratch

func FetchCpuAndMemoryUsage

func FetchCpuAndMemoryUsage(serviceName, clusterName string) (memoryUtilized uint32, memoryReserved uint32, cpuUtilized uint32, cpuReserved uint32, err error)

FetchCpuAndMemoryUsage reads memory and cpu usage from cloudwatch metrics for a given ECS service. Service and cluster name must be provided.

func FetchLogStreams

func FetchLogStreams(logGroupName string, container, taskArn *string) ([]awscloudwatchlogstypes.LogStream, error)

FetchLogStreams fetches log streams for a given log group. If container and taskArn is provided, it is used to filter the returned result.

func GetAccountInformation

func GetAccountInformation() (*string, error)

GetAccountInformation returns information about the logged in account

func GetFunctionDescription

func GetFunctionDescription(functionName string) (*string, error)

GetFunctionDescription reads the lambda function description for the specified function and returns it

func GetLambdaFunction

func GetLambdaFunction(functionName string) (*lambda.GetFunctionOutput, error)

func GetTaskDefinitions

func GetTaskDefinitions(taskDefinitionArns []string) ([]types.TaskDefinition, error)

GetTaskDefinitions returns a slice of the task definitions in the given ECS tasks identified by Task definition arns

func ListECSClusters

func ListECSClusters() ([]types.Cluster, error)

ListECSClusters returns a slice of all ECS clusters found in the account

func ListLambdaFunctions

func ListLambdaFunctions() ([]lambdatypes.FunctionConfiguration, error)

ListLambdaFunctions lists all lambda functions the account and returns them as a slice of FunctionConfigurations

func RestartECSService

func RestartECSService(clusterName, name string) error

RestartECSService restarts an ECS service by using updateing the service and setting the ForceNewDeployment flag, but not changing anything else. This effectively forces the ECS service to restart.

func ShortenTaskDefArn

func ShortenTaskDefArn(taskDefinitionArn *string) string

ShortTaskDefArn returns a short version of the task definition arn

func TagLambdaFunctionWithVersion

func TagLambdaFunctionWithVersion(functionName, version string) error

TagLambdaFunctionWithVersion adds LastDeployed tag to a lambda function

func UpdateLambdaFunctionDescription

func UpdateLambdaFunctionDescription(functionName, newDescription string) error

UpdateLambdaFunctionDescription updates the lambda function description to the specified string. This is commonly used to force a cold start and makes the lambda function "restart"

Types

type ApiGateway

type ApiGateway struct {
	CreatedDate time.Time
	Name        string
	Description string
	DomainName  string
	ApiId       string
	Type        ApiType
}

func FetchApis

func FetchApis() []ApiGateway

FetchApis reads apigateway apis

type ApiType

type ApiType int
const (
	Http ApiType = iota + 1
	Rest
)

func (ApiType) String

func (a ApiType) String() string

type LogItem

type LogItem struct {
	Updated time.Time `json:"updated,omitempty"`
	User    string    `json:"user,omitempty"`
	Version string    `json:"version,omitempty"`
}

Logitem, describing who installed which version

type Version

type Version struct {
	Name      string
	Message   string
	CreatedAt string
}

Struct describing a version

func FetchAvailableVersions

func FetchAvailableVersions(functionName string) ([]Version, error)

FetchAvailableVersions reads all files in the s3 bucket and returns the name and created timestamp. The Message field is not filled

Jump to

Keyboard shortcuts

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