ecs

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ALB

type ALB struct {
	VpcId     string
	Listeners []*elbv2.Listener
	Domain    string
	Rules     map[string][]*elbv2.Rule
	DnsName   string
	// contains filtered or unexported fields
}

ALB struct

func NewALB

func NewALB(loadBalancerName string) (*ALB, error)

func NewALBAndCreate

func NewALBAndCreate(loadBalancerName, ipAddressType string, scheme string, securityGroups []string, subnets []string, lbType string) (*ALB, error)

get the listeners for the loadbalancer

func (*ALB) CreateListener

func (a *ALB) CreateListener(protocol string, port int64, targetGroupArn string) error

func (*ALB) CreateRule

func (a *ALB) CreateRule(ruleType string, listenerArn string, targetGroupArn string, rules []string, priority int64) error

func (*ALB) CreateRuleForAllListeners

func (a *ALB) CreateRuleForAllListeners(ruleType string, targetGroupArn string, rules []string, priority int64) ([]string, error)

func (*ALB) CreateRuleForListeners

func (a *ALB) CreateRuleForListeners(ruleType string, listeners []string, targetGroupArn string, rules []string, priority int64) ([]string, error)

func (*ALB) CreateTargetGroup

func (a *ALB) CreateTargetGroup(serviceName string, d service.Deploy) (*string, error)

func (*ALB) DeleteListener

func (a *ALB) DeleteListener(listenerArn string) error

func (*ALB) DeleteLoadBalancer

func (a *ALB) DeleteLoadBalancer() error

func (*ALB) DeleteTargetGroup

func (a *ALB) DeleteTargetGroup(targetGroupArn string) error

func (*ALB) FindRule

func (a *ALB) FindRule(listener string, targetGroupArn string, conditionField []string, conditionValue []string) (*string, *string, error)

func (*ALB) GetDomain

func (a *ALB) GetDomain() string

func (*ALB) GetDomainUsingCertificate

func (a *ALB) GetDomainUsingCertificate() error

get the domain using certificates

func (*ALB) GetHighestRule

func (a *ALB) GetHighestRule() (int64, error)

func (*ALB) GetListeners

func (a *ALB) GetListeners() error

get the listeners for the loadbalancer

func (*ALB) GetRulesForAllListeners

func (a *ALB) GetRulesForAllListeners() error

get rules by listener

func (*ALB) GetTargetGroupArn

func (a *ALB) GetTargetGroupArn(serviceName string) (*string, error)

func (*ALB) ModifyTargetGroupAttributes

func (a *ALB) ModifyTargetGroupAttributes(targetGroupArn string, d service.Deploy) error

func (*ALB) UpdateHealthCheck

func (a *ALB) UpdateHealthCheck(targetGroupArn string, healthCheck service.DeployHealthCheck) error

type AutoScaling

type AutoScaling struct {
}

ECR struct

func (*AutoScaling) CompleteLifecycleAction

func (a *AutoScaling) CompleteLifecycleAction(autoScalingGroupName, instanceId, action, lifecycleHookName, lifecycleToken string) error

func (*AutoScaling) CompletePendingLifecycleAction

func (a *AutoScaling) CompletePendingLifecycleAction(autoScalingGroupName, instanceId, action, lifecycleHookName string) error

func (*AutoScaling) CreateAutoScalingGroup

func (a *AutoScaling) CreateAutoScalingGroup(clusterName string, desiredCapacity int64, maxSize int64, minSize int64, subnets []string) error

func (*AutoScaling) CreateLaunchConfiguration

func (a *AutoScaling) CreateLaunchConfiguration(clusterName string, keyName string, instanceType string, instanceProfile string, securitygroups []string) error

func (*AutoScaling) DeleteAutoScalingGroup

func (a *AutoScaling) DeleteAutoScalingGroup(clusterName string, forceDelete bool) error

func (*AutoScaling) DeleteLaunchConfiguration

func (a *AutoScaling) DeleteLaunchConfiguration(clusterName string) error

func (*AutoScaling) GetAutoScalingGroupByTag

func (a *AutoScaling) GetAutoScalingGroupByTag(clusterName string) (string, error)

func (*AutoScaling) GetClusterNodeDesiredCount

func (a *AutoScaling) GetClusterNodeDesiredCount(autoScalingGroupName string) (int64, int64, int64, error)

func (*AutoScaling) GetLifecycleHookNames

func (a *AutoScaling) GetLifecycleHookNames(autoScalingGroupName, lifecycleHookType string) ([]string, error)

func (*AutoScaling) ScaleClusterNodes

func (a *AutoScaling) ScaleClusterNodes(autoScalingGroupName string, change int64) error

func (*AutoScaling) WaitForAutoScalingGroupInService

func (a *AutoScaling) WaitForAutoScalingGroupInService(clusterName string) error

func (*AutoScaling) WaitForAutoScalingGroupNotExists

func (a *AutoScaling) WaitForAutoScalingGroupNotExists(clusterName string) error

type CloudWatch

type CloudWatch struct{}

func (*CloudWatch) CreateLogGroup

func (cloudwatch *CloudWatch) CreateLogGroup(clusterName, logGroup string) error

func (*CloudWatch) DeleteLogGroup

func (cloudwatch *CloudWatch) DeleteLogGroup(logGroup string) error

func (*CloudWatch) GetLogEventsByTime

func (cloudwatch *CloudWatch) GetLogEventsByTime(logGroup, logStream string, startTime, endTime time.Time, nextToken string) (CloudWatchLog, error)

type CloudWatchLog

type CloudWatchLog struct {
	NextBackwardToken string               `json:"nextBackwardToken"`
	NextForwardToken  string               `json:"nextForwardToken"`
	LogEvents         []CloudWatchLogEvent `json:"logEvents"`
}

type CloudWatchLogEvent

type CloudWatchLogEvent struct {
	IngestionTime time.Time `json:"ingestionTime"`
	Message       string    `json:"message"`
	Timestamp     time.Time `json:"timestamp"`
}

type ContainerDefinition

type ContainerDefinition struct {
	Name      string `json:"name"`
	Essential bool   `json:"essential"`
}

type ContainerInstance

type ContainerInstance struct {
	ContainerInstanceArn string
	Ec2InstanceId        string
	AvailabilityZone     string
	PendingTasksCount    int64
	RegisteredAt         time.Time
	RegisteredResources  []ContainerInstanceResource
	RemainingResources   []ContainerInstanceResource
	RunningTasksCount    int64
	Status               string
	Version              int64
}

containerInstance

type ContainerInstanceResource

type ContainerInstanceResource struct {
	DoubleValue    float64  `json:"doubleValue"`
	IntegerValue   int64    `json:"integerValue"`
	Name           string   `json:"name"`
	StringSetValue []string `json:"stringSetValue"`
	Type           string   `json:"type"`
}

type ECR

type ECR struct {
	RepositoryName, RepositoryURI string
}

ECR struct

func (*ECR) CreateRepository

func (e *ECR) CreateRepository() error

Creates ECR repository

func (*ECR) ListImagesWithTag

func (e *ECR) ListImagesWithTag(repositoryName string) (map[string]string, error)

type ECS

type ECS struct {
	ClusterName    string
	ServiceName    string
	IamRoleArn     string
	TaskDefinition *ecs.RegisterTaskDefinitionInput
	TaskDefArn     *string
	TargetGroupArn *string
}

ECS struct

func (*ECS) ConvertResourceToFir

func (e *ECS) ConvertResourceToFir(cir []ContainerInstanceResource) (FreeInstanceResource, error)

func (*ECS) ConvertResourceToRir

func (e *ECS) ConvertResourceToRir(cir []ContainerInstanceResource) (RegisteredInstanceResource, error)

func (*ECS) CreateCluster

func (e *ECS) CreateCluster(clusterName string) (*string, error)

create cluster

func (*ECS) CreateService

func (e *ECS) CreateService(d service.Deploy) error

create service

func (*ECS) CreateTaskDefinition

func (e *ECS) CreateTaskDefinition(d service.Deploy) (*string, error)

Creates ECS repository

func (*ECS) DeleteCluster

func (e *ECS) DeleteCluster(clusterName string) error

delete cluster

func (*ECS) DeleteKeyPair

func (e *ECS) DeleteKeyPair(keyName string) error

func (*ECS) DeleteService

func (e *ECS) DeleteService(clusterName, serviceName string) error

delete ECS service

func (*ECS) DescribeContainerInstances

func (e *ECS) DescribeContainerInstances(clusterName string, containerInstances []string) ([]ContainerInstance, error)

describe container instances

func (*ECS) DescribeService

func (e *ECS) DescribeService(clusterName string, serviceName string, showEvents bool, showTasks bool, showStoppedTasks bool) (service.RunningService, error)

describe services

func (*ECS) DescribeServices

func (e *ECS) DescribeServices(clusterName string, serviceNames []*string, showEvents bool, showTasks bool, showStoppedTasks bool) ([]service.RunningService, error)

func (*ECS) DescribeTaskDefinition

func (e *ECS) DescribeTaskDefinition(taskDefinitionNameOrArn string) (TaskDefinition, error)

func (*ECS) DescribeTasks

func (e *ECS) DescribeTasks(clusterName string, tasks []*string) ([]service.RunningTask, error)

func (*ECS) DrainNode

func (e *ECS) DrainNode(clusterName, instance string) error

func (*ECS) GetClusterNameByInstanceId

func (e *ECS) GetClusterNameByInstanceId(instance string) (string, error)

func (*ECS) GetContainerInstanceArnByInstanceId

func (e *ECS) GetContainerInstanceArnByInstanceId(clusterName, instanceId string) (string, error)

func (*ECS) GetContainerLimits

func (e *ECS) GetContainerLimits(d service.Deploy) (int64, int64, int64, int64)

func (*ECS) GetECSAMI

func (e *ECS) GetECSAMI() (string, error)

func (*ECS) GetFreeResources

func (e *ECS) GetFreeResources(clusterName string) ([]FreeInstanceResource, error)

func (*ECS) GetPubKeyFromPrivateKey

func (e *ECS) GetPubKeyFromPrivateKey(privateKey string) ([]byte, error)

func (*ECS) GetTaskDefinition

func (e *ECS) GetTaskDefinition(clusterName, serviceName string) (string, error)

func (*ECS) ImportKeyPair

func (e *ECS) ImportKeyPair(keyName string, publicKey []byte) error

func (*ECS) IsEqualContainerLimits

func (e *ECS) IsEqualContainerLimits(d1 service.Deploy, d2 service.Deploy) bool

func (*ECS) LaunchWaitForDrainedNode

func (e *ECS) LaunchWaitForDrainedNode(clusterName, containerInstanceArn, instanceId, autoScalingGroupName, lifecycleHookName, lifecycleHookToken string) error

func (*ECS) LaunchWaitUntilServicesStable

func (e *ECS) LaunchWaitUntilServicesStable(dd *service.DynamoDeployment) error

func (*ECS) ListContainerInstances

func (e *ECS) ListContainerInstances(clusterName string) ([]string, error)

func (*ECS) ListServices

func (e *ECS) ListServices(clusterName string) ([]*string, error)

list services

func (*ECS) ListTasks

func (e *ECS) ListTasks(clusterName, name, desiredStatus, filterBy string) ([]*string, error)

list tasks

func (*ECS) ManualScaleService

func (e *ECS) ManualScaleService(clusterName, serviceName string, desiredCount int64) error

manual scale ECS service

func (*ECS) Rollback

func (e *ECS) Rollback(clusterName, serviceName string) error

func (*ECS) RunTask

func (e *ECS) RunTask(clusterName, taskDefinition string, runTask service.RunTask) (string, error)

run one-off task

func (*ECS) ServiceExists

func (e *ECS) ServiceExists(serviceName string) (bool, error)

check whether service exists

func (*ECS) UpdateService

func (e *ECS) UpdateService(serviceName string, taskDefArn *string, d service.Deploy) (*string, error)

Update ECS service

func (*ECS) WaitUntilServicesInactive

func (e *ECS) WaitUntilServicesInactive(clusterName, serviceName string) error

wait until service is inactive

func (*ECS) WaitUntilServicesStable

func (e *ECS) WaitUntilServicesStable(clusterName, serviceName string, maxWaitMinutes int) error

wait until service is stable

type EcsVersionInfo

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

version info

type FreeInstanceResource

type FreeInstanceResource struct {
	InstanceId       string
	AvailabilityZone string
	Status           string
	FreeMemory       int64
	FreeCpu          int64
}

free instance resource

type IAM

type IAM struct {
	AccountId string
	// contains filtered or unexported fields
}

IAM struct

func (*IAM) AddRoleToInstanceProfile

func (e *IAM) AddRoleToInstanceProfile(instanceProfileName, roleName string) error

func (*IAM) AssumeRole

func (e *IAM) AssumeRole(roleArn, roleSessionName, prevCreds string) (*credentials.Credentials, string, error)

func (*IAM) AttachRolePolicy

func (e *IAM) AttachRolePolicy(roleName, policyArn string) error

func (*IAM) CreateInstanceProfile

func (e *IAM) CreateInstanceProfile(instanceProfileName string) error

func (*IAM) CreateRole

func (e *IAM) CreateRole(roleName, assumePolicyDocument string) (*string, error)

func (*IAM) DeleteInstanceProfile

func (e *IAM) DeleteInstanceProfile(instanceProfileName string) error

func (*IAM) DeleteRole

func (e *IAM) DeleteRole(roleName string) error

func (*IAM) DeleteRolePolicy

func (e *IAM) DeleteRolePolicy(roleName, policyName string) error

func (*IAM) GetAccountId

func (e *IAM) GetAccountId() error

func (*IAM) GetEC2IAMTrust

func (e *IAM) GetEC2IAMTrust() string

func (*IAM) GetEcsServiceIAMTrust

func (e *IAM) GetEcsServiceIAMTrust() string

func (*IAM) GetEcsServicePolicy

func (e *IAM) GetEcsServicePolicy() string

func (*IAM) GetEcsTaskIAMTrust

func (e *IAM) GetEcsTaskIAMTrust() string

func (*IAM) PutRolePolicy

func (e *IAM) PutRolePolicy(roleName, policyName, policy string) error

func (*IAM) RemoveRoleFromInstanceProfile

func (e *IAM) RemoveRoleFromInstanceProfile(instanceProfileName, roleName string) error

func (*IAM) RoleExists

func (e *IAM) RoleExists(roleName string) (*string, error)

func (*IAM) WaitUntilInstanceProfileExists

func (e *IAM) WaitUntilInstanceProfileExists(instanceProfileName string) error

type Parameter

type Parameter struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Value   string `json:"value"`
	Version int64  `json:"version"`
}

parameter type

type Paramstore

type Paramstore struct {
	Parameters      map[string]Parameter
	SsmAssumingRole *ssm.SSM
}

Paramstore struct

func (*Paramstore) AssumeRole

func (p *Paramstore) AssumeRole(roleArn, roleSessionName, prevCreds string) (string, error)

func (*Paramstore) Bootstrap

func (p *Paramstore) Bootstrap(serviceName, prefix string, environment string, parameters []service.DeployServiceParameter) error

func (*Paramstore) DeleteParameter

func (p *Paramstore) DeleteParameter(serviceName, parameter string) error

func (*Paramstore) GetParameterValue

func (p *Paramstore) GetParameterValue(name string) (*string, error)

func (*Paramstore) GetParameters

func (p *Paramstore) GetParameters(prefix string, withDecryption bool) error

func (*Paramstore) GetParamstoreIAMPolicy

func (p *Paramstore) GetParamstoreIAMPolicy(serviceName string) string

func (*Paramstore) GetPrefix

func (p *Paramstore) GetPrefix() string

func (*Paramstore) GetPrefixForService

func (p *Paramstore) GetPrefixForService(serviceName string) string

func (*Paramstore) IsEnabled

func (p *Paramstore) IsEnabled() bool

func (*Paramstore) PutParameter

func (p *Paramstore) PutParameter(serviceName string, parameter service.DeployServiceParameter) (*int64, error)

func (*Paramstore) RetrieveKeys

func (p *Paramstore) RetrieveKeys() error

type RegisteredInstanceResource

type RegisteredInstanceResource struct {
	InstanceId       string
	RegisteredMemory int64
	RegisteredCpu    int64
}

registered instance resource

type SNSPayload

type SNSPayload struct {
	Message          string `json:"Message"`
	MessageId        string `json:"MessageId"`
	Signature        string `json:"Signature"`
	SignatureVersion string `json:"SignatureVersion"`
	SigningCertURL   string `json:"SigningCertURL"`
	SubscribeURL     string `json:"SubscribeURL"`
	Subject          string `json:"Subject"`
	Timestamp        string `json:"Timestamp"`
	Token            string `json:"Token"`
	TopicArn         string `json:"TopicArn"`
	Type             string `json:"Type" binding:"required"`
	UnsubscribeURL   string `json:"UnsubscribeURL"`
}

SNS payload

type SNSPayloadEcs

type SNSPayloadEcs struct {
	Version    string              `json:"version"`
	Id         string              `json:"id"`
	DetailType string              `json:"detail-type" binding:"required"`
	Source     string              `json:"source"`
	Account    string              `json:"account"`
	Time       string              `json:"time"`
	Region     string              `json:"region"`
	Resources  []string            `json:"resources"`
	Detail     SNSPayloadEcsDetail `json:"detail"`
}

ECS SNS Event

type SNSPayloadEcsDetail

type SNSPayloadEcsDetail struct {
	ClusterArn           string                          `json:"clusterArn"`
	ContainerInstanceArn string                          `json:"containerInstanceArn"`
	Ec2InstanceId        string                          `json:"ec2InstanceId"`
	RegisteredResources  []ContainerInstanceResource     `json:"registeredResources"`
	RemainingResources   []ContainerInstanceResource     `json:"remainingResources"`
	Status               string                          `json:"status"`
	Version              int64                           `json:"version"`
	VersionInfo          EcsVersionInfo                  `json:"versionInfo"`
	UpdatedAt            string                          `json:"updatedAt"`
	RegisteredAt         string                          `json:"registeredAt"`
	Attributes           []SNSPayloadEcsDetailAttributes `json:"attributes"`
}

type SNSPayloadEcsDetailAttributes

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

type SNSPayloadGeneric

type SNSPayloadGeneric struct {
	Version    string `json:"version"`
	Id         string `json:"id"`
	DetailType string `json:"detail-type" binding:"required"`
}

generic payload (to check detail type)

type SNSPayloadLifecycle

type SNSPayloadLifecycle struct {
	Version    string                    `json:"version"`
	Id         string                    `json:"id"`
	DetailType string                    `json:"detail-type" binding:"required"`
	Source     string                    `json:"source"`
	Account    string                    `json:"account"`
	Time       string                    `json:"time"`
	Region     string                    `json:"region"`
	Resources  []string                  `json:"resources"`
	Detail     SNSPayloadLifecycleDetail `json:"detail"`
}

lifecycle event

type SNSPayloadLifecycleDetail

type SNSPayloadLifecycleDetail struct {
	LifecycleActionToken string `json:"LifecycleActionToken"`
	AutoScalingGroupName string `json:"AutoScalingGroupName"`
	LifecycleHookName    string `json:"LifecycleHookName"`
	EC2InstanceId        string `json:"EC2InstanceId"`
	LifecycleTransition  string `json:"LifecycleTransition"`
}

type TaskDefinition

type TaskDefinition struct {
	Family               string                `json:"family"`
	Revision             int64                 `json:"revision"`
	ExecutionRoleArn     string                `json:"executionRole"`
	ContainerDefinitions []ContainerDefinition `json:"containerDefinitions"`
}

Task definition and Container definition

Jump to

Keyboard shortcuts

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